【问题标题】:Pivot points add exit strategy枢轴点添加退出策略
【发布时间】:2022-08-20 18:18:15
【问题描述】:

我在基于枢轴点的 Tradingview 上找到了这个策略。我试图在 R3 / S3 上添加退出策略,但它不起作用。有人能帮我吗?

strategy.risk.allow_entry_in(tradeDirection)
longCondition = crossover(Source, R1) and inDateRange
shortCondition = crossunder(Source, S1) and inDateRange

strategy.entry(\"Buy\", strategy.long, when=longCondition, oca_name=\"oca\", 
oca_type=strategy.oca.cancel)
strategy.exit(\"Exit Long\", stop=R3)
strategy.entry(\"Sell\", strategy.short, when=shortCondition, oca_name=\"oca\", 
oca_type=strategy.oca.cancel)
strategy.exit(\"Exit Short\", stop=S3)

    标签: pivot pine-script


    【解决方案1】:

    停止使用限制

    if (buy)
        strategy.entry("My Long Entry Id", strategy.long)
        
        strategy.exit("Exit Long", from_entry="My Long Entry Id",limit=R1)
        
    if (sell)
        strategy.entry("My Short Entry Id", strategy.short)
        
        strategy.exit("Exit short", from_entry="My Short Entry Id",limit=S1)
    

    【讨论】:

    • 通过添加有关代码的作用以及它如何帮助 OP 的更多信息,可以改进您的答案。
    猜你喜欢
    • 2020-08-31
    • 2020-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-30
    • 1970-01-01
    • 1970-01-01
    • 2023-02-06
    相关资源
    最近更新 更多