0

我正在尝试检查收盘是否在过去的 3 分钟 TF 内穿过布林带 (BB),例如 15 根蜡烛,然后一旦出现回调,在突破超级趋势后进入 1 分钟 TF。我无法对回顾条件进行编码,以检查过去 X 根蜡烛的收盘价是否越过 BB。

以下是代码摘录;

// 回顾蜡烛

     BBlookbackInput = input.int(30, "Lookback in bars", minval = 1, maxval = 4999)

// 长和短

   if ((STHigherTFLONG and ta.change(direction) < 0) or (STHigherTFSHORT and ta.change(direction) > 0))                       
 for i = 1 to BBlookbackInput
     if ta.crossover(close[i], HigherTFLONG )
           strategy.entry("long", strategy.long, when = window())
           
     else if ta.crossunder(close[i], HigherTFSHORT)
             strategy.entry( "short", strategy.short, when = window()



         if EMALONG
strategy.close("long", when = window())  // Exit when close EMA


        if EMASHORT
strategy.close("short", when = window())    

strategy.close_all(when = hour == 14 and minute == 57)
  1. STIGHERTFLONG - 指 3 分钟内的超级趋势为 +ve
  2. STHIGHERTFSHORT - 指 3 分钟内的超级趋势为 -ve
  3. HIGHRTFLONG = 是 3 分钟时间范围内的上布林带值
  4. HIGHERTFSHORT = 是 3 分钟时间范围内的下布林带值

现在我正在尝试获得以下输出 -

如果 3 分钟超级趋势为 +ve 且 1 分钟超级趋势有 +ve 交叉 ,则检查最后 X 1 分钟蜡烛是否在 3 分钟时间框架内越过布林带上方,如果是,则做多入场。

任何输入将不胜感激 - 谢谢

4

0 回答 0