【问题标题】:How to buy on the first candle with a low above the lower boll band, sell on first candle with a high below upper boll band如何在第一根蜡烛线下方的低点上方买入,在第一根蜡烛线上方的高点下方卖出
【发布时间】:2021-05-26 22:58:53
【问题描述】:

我想知道如何在布林带上破或下破时开仓和平仓。例如,如附图中所示,每个绿色条的高点都高于上铃带,我想在第一个高点低于上铃带的条上卖出。谢谢点击链接查看图片。 (用Heiken Ashi蜡烛,我知道利弊)

图片:在第一根蜡烛线的低点高于下铃铛带时买入,在第一根蜡烛线的高点低于上铃铛带时卖出:

【问题讨论】:

    标签: pine-script


    【解决方案1】:

    在低于最低线的第一个低点买入,在低于最高线的第一个高点卖出

    //@version=4
    study(shorttitle="BB", title="Bollinger Bands", overlay=true, resolution="")
    length = input(20, minval=1)
    src = input(close, title="Source")
    mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
    basis = sma(src, length)
    dev = mult * stdev(src, length)
    upper = basis + dev
    lower = basis - dev
    offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)
    plot(basis, "Basis", color=#872323, offset = offset)
    p1 = plot(upper, "Upper", color=color.teal, offset = offset)
    p2 = plot(lower, "Lower", color=color.teal, offset = offset)
    fill(p1, p2, title = "Background", color=#198787, transp=95)
    
    //
    buy = low > lower and low[1] < lower[1]
    sell = high < upper and high[1] > upper[1]
    
    plotshape(buy, color = color.green, size = size.tiny)
    plotshape(sell, color = color.red, size = size.tiny)
    

    【讨论】:

      猜你喜欢
      • 2021-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      相关资源
      最近更新 更多