I’m able to connect with a segment 2 lows between them by zigzag. Here’s the code :
1
2
3
4
5
6
7
8
9
10
11
zz=zigzag[2](low)
creux=zz[0]>zz[1]andzz[1]<zz[2]
b=zz[1]
ifcreuxthen
oldbar=barindex-1
Price=low[1]
DRAWARROWUP(oldbar,b-0.1)
DRAWSEGMENT(oldbar,Price[0],oldbar[1],Price[1])
endif
return
But now I search to connect 3 lows together with a segment (by zigzag). So if the segment between the lows 1 and 2 and the segment between the lows 2 and 3 have pretty much the same angle then we draw a line connecting the 3 lows.
Without data arrays, a rough idea is to measure the rate of change (slope) between 2 lows (divide the price distance by the bars quantity between them). If the next slope is in the same range of value (to be defined), then the 2 extreme lows should be aligned.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue