Indicator to draw major support/resistance levels

 

Hi,

I want to make an indicator that draws  major support resistance levels on a 4 hour chart, only going back what is wissible in the image below ( about 16 days (100 -120  bars)).

On the current chart the 2 resistance lines drawn should be this.


But right now I have no clue how I should find this levels programatically.
Vissible I have no problems finding them. But how can I find them programattically?

Any one that can help me out here?


Br Morten

 
Morten Kruse:

Hi,

I want to make an indicator that draws  major support resistance levels on a 4 hour chart, only going back what is wissible in the image below ( about 16 days (100 -120  bars)).

On the current chart the 2 resistance lines drawn should be this.

But right now I have no clue how I should find this levels programatically.
Vissible I have no problems finding them. But how can I find them programattically?

Any one that can help me out here?

Br Morten

I can imagine you'll need to break the problem into two parts:

(1) Look for peaks/troughs within the period of interest - indicators that may be useful are zigzags/fractals.

(2) Look for median and perhaps even standard deviation to make sure the level you draw is of certain level of significance.