【问题标题】:Pine Script arithmetic limit orderPine Script算术限价令
【发布时间】:2021-11-18 02:54:40
【问题描述】:

可能很简单的答案,但我正在尝试设置我的限价单来执行这样的事情

if ta.barssince(enterLong) < 3
    strategy.entry(id="EL", direction=strategy.long, limit=low[1] * -0.01)

我不确定如何为此编写算术。目标是根据前一个蜡烛触发创建限价订单,但要通过负数计算限制,以便根据百分比创建下限,因此在这种情况下,在前一个蜡烛低点的 -1% 处创建限价入口。

【问题讨论】:

    标签: pine-script


    【解决方案1】:

    在你的逻辑中,-1% 不是 99% 吗?

    if ta.barssince(enterLong) < 3
        strategy.entry(id="EL", direction=strategy.long, limit=low[1] * 0.99)
    

    【讨论】:

    • 我终于想通了。它与我的止损计算相同,但我要求来自 strategy.position_avg_price * (1 - percCalc) 而不是 low[1] * (1 - percCalc) 的价格
    猜你喜欢
    • 2022-01-19
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-13
    • 1970-01-01
    • 2021-12-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多