Support Resistance Algorithm - Technical analysis

后端 未结 11 591
悲哀的现实
悲哀的现实 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:32

    If you are looking for horizontal SR lines, I would rather want to know the whole distribution. But I think it is also a good assumption to just take the max of your histogram.

    # python + pandas
    
    spy["Close"][:60].plot()
    hist, border = np.histogram(spy["Close"][:60].values, density=False)
    sr = border[np.argmax(hist)]
    plt.axhline(y=sr, color='r', linestyle='-')
    
    

    You might need to tweak the bins and eventually you want to plot the whole bin not just the lower bound.

    lower_bound = border[np.argmax(hist)]
    upper_bound = border[np.argmax(hist) + 1]
    

    PS the underlying "idea" is very similar to @Nilendu's solution.

提交回复
热议问题