Hello I have this simple code that tells me the where are the lows and highs
pHigh = (high[1] > high[2]) and (high <= high[1] )
pLow = (low[1] < low[2]) and (low >= low[1] )
plotshape(pHigh, style=shape.triangledown, location=location.abovebar, offset = -1)
plotshape(pLow, style=shape.triangleup, location=location.belowbar, offset = -1)
Can you please let me know how can I do this:
For each pLow I want to consider the pHighs and pLows in front of it and compute the degree, then if the degrees are equal 50 I draw lines.
eg. lets say there is a plow at bar_index[100]
, then I want to compute the degree between the the highest phigh between 1) the plow[100]
and phigh[i]
(100>i>=0) and 2) lowest low between the phigh[100]
and
plows[k] (k<i and k<100 and it is moving forward basically).
If the degree between the lines for every three points (plow[100]
, phigh[i]
, plow[k]
) are 50 I want to draw a line like what I showed in the fig.
As we move ahead, the highest high between the plow and phigh[i]
and lowest low between the phigh[i]
and plows
(from i forward , ie plow[k]) should be considered for checking the degree.
when computing the degrees we only draw lines if the degree is equal to 50. otherwise we ignore.