Hi,
Is there a way to remove all the inside bars, so that the code ignores them in its calculations? So for example I am looking for a directional bar down (Low> Low[1]) , (High < High[1]) ,relative to the previous bar that is not an inside bar.
I would still like to display all the bars as normal on the chart.
Many thanks in advance.
Sorry I meant (low<Low[1]) and (High<High[1]).
Is this what you mean?
InsideBAR = 0
IF (high <= high[1]) AND (low >= low[1]) THEN
InsideBAR = 1
ENDIF
Signal = 0
IF Not InsideBAR THEN
IF (low < low[1]) AND (high < high[1]) THEN
Signal = 1
ENDIF
ENDIF
RETURN Signal AS "My Pattern"
Not quite. Unless I have misunderstood how to use your code.
I am working on an indicator that requires inside bars (or multiple inside bars) to be ignored completely. The problem comes when a bar down comes after an inside bar but itself is an inside bar to a previous larger bar.
I am looking to find a low bar relative to the previous bar that is not an inside bar. I thought if I removed all inside bars from the calculations then the (Low<Low[1]) and (High< High[1]) would work correctly based on the remaining bars.
Pic attached
This modified version tracks an InsideBAR until any of its limits are broken, thus preventing signals from being returned:
ONCE InsideBAR = 0
ONCE InsideHH = 0
ONCE InsideLL = 0
IF InsideBAR THEN
IF (high > InsideHH) OR (low < InsideLL) THEN
InsideBAR = 0
InsideHH = 0
InsideLL = 0
ENDIF
ENDIF
IF ((high <= high[1]) AND (low >= low[1])) AND Not InsideBAR THEN
InsideBAR = 1
InsideHH = high[1]
InsideLL = low[1]
ENDIF
Signal = 0
IF Not InsideBAR THEN
IF (low < low[1]) AND (high < high[1]) THEN
Signal = 1
ENDIF
ENDIF
RETURN Signal AS "My Pattern"