I've been trying to write an indicator that will draw lines over price action (similar to zigzag) using simple bar (candle) counting rules. Despite my efforts, I've been unable to do so. Can anyone help me out with the code? Leg counting rules are as follows:
1. Upbar is up direction
2. Downbar is down direction
3. Inside and Outside bars continue direction of the previous bar.
Here is the code I have for the actual candles:
Def UpBar = high > high[1] and low >= low[1];
Def DownBar = low < low[1] and high <= high[1];
def insidebar = high <= high[1] and low >= low[1];
def outsidebar= high >= high[1] and low <= low[1];
I can't figure out the rest (everything I've thrown together has errors and is not worth adding here). Btw, here's a nice video on bar counting (and the specific logic I've mentioned above)
.
I don't currently care about labeling the actual leg counts. I just want the line to follow the legs. Thanks in advance for your help.
1. Upbar is up direction
2. Downbar is down direction
3. Inside and Outside bars continue direction of the previous bar.
Here is the code I have for the actual candles:
Def UpBar = high > high[1] and low >= low[1];
Def DownBar = low < low[1] and high <= high[1];
def insidebar = high <= high[1] and low >= low[1];
def outsidebar= high >= high[1] and low <= low[1];
I can't figure out the rest (everything I've thrown together has errors and is not worth adding here). Btw, here's a nice video on bar counting (and the specific logic I've mentioned above)
I don't currently care about labeling the actual leg counts. I just want the line to follow the legs. Thanks in advance for your help.