Support Resistance Algorithm - Technical analysis

后端 未结 11 564
悲哀的现实
悲哀的现实 2020-12-12 09:23

I have an intra-day chart and I am trying to figure out how to calculate support and resistance levels, anyone knows an algorithm for doing that, or a good starting point?

11条回答
  •  既然无缘
    2020-12-12 09:29

    Here is the PineScript code for S/Rs. It doesn't include all the logic Dr. Andrew or Nilendu discuss, but definitely a good start:

    https://www.tradingview.com/script/UUUyEoU2-S-R-Barry-extended-by-PeterO/

    //@version=3
    study(title="S/R Barry, extended by PeterO", overlay=true)
    FractalLen=input(10)
    isFractal(x) => highestbars(x,FractalLen*2+1)==-FractalLen
    
    sF=isFractal(-low), support=low, support:=sF ? low[FractalLen] : support[1]
    rF=isFractal(high), resistance=high, resistance:=rF ? high[FractalLen] : resistance[1]
    plot(series=support, color=sF?#00000000:blue, offset=-FractalLen)
    plot(series=resistance, color=rF?#00000000:red, offset=-FractalLen)
    
    supportprevious=low, supportprevious:=sF ? support[1] : supportprevious[1]
    resistanceprevious=low, resistanceprevious:=rF ? resistance[1] : resistanceprevious[1]
    plot(series=supportprevious, color=blue, style=circles, offset=-FractalLen)
    plot(series=resistanceprevious, color=red, style=circles, offset=-FractalLen)
    

提交回复
热议问题