如何为我的策略设置默认时间表?

时间:2020-10-21 16:51:55

标签: pine-script tradingview-api

您注意到在TradingView中创建的策略的结果会随时间变化。

在23H时间范围内表现出色

Good performance at 23H Timeframe

在1H时间范围内效果不佳

Not as good performance at 1H Timeframe

即使我更改当前时间范围图表,我也正在寻找在特定时间范围运行的策略。

//Long entry 
if (longCondition5_13 and longCondition5_01 and longCondition5_02 and longCondition20 and longCondition20_01 or longCondition2_02)

   strategy.entry  ("Long", strategy.long, when = window())
   strategy.exit   ("Long exit", "Long",   when = window(), profit = highestAtr * 2, loss = lowestAtr)
    

//Short entry
if (shortCondition5_13 and shortCondition5_01 and shortCondition5_02 and shortCondition20_01 or shortCondition20_02)`

    strategy.entry("Short", strategy.short, when = window())
    strategy.exit("Short exit", "Short",    when = window(), profit = lowestAtr * 2, loss = highestAtr)

0 个答案:

没有答案