Identify tight ranges on chart with breakout price

I want to achieve an outcome like in the image, I am not sure how or where to begin. Appreciate any pointers on how to achieve it

Consider playing with Lowest/Highest Functions:


1 Like

Thanks for the reply, I would like to access the candle with red arrow.

My current code below is giving me Error 10. Array Subscript Out of Range

for( i = 0; i < BarCount; i++ )
	if( High[i] < High[i - 1] AND Low[i] > Low[i - 1] );

i+1 also is giving me same error.

Do not loop!

condition = H < Ref( H, -1 ) AND L > Ref( L, -1 );

where condition returns Boolean.

1 Like

Thanks for the reply.

I need to find the high of the bar when the condition is met and using below code code to identify the price high. I am seeing a line only on the last high bar. I used watch to see the values in val , it is basically the High array.

_SECTION_BEGIN("Mini Coil");

val = Null;
P = Param( "Period", 3, 2, 10, 1 );
Cond1 = H < Ref( H, -1 ) AND L > Ref( L, -1 );
Val = ValueWhen(Cond1 = True, H);
PlotGrid(LastValue(Val), colorTurquoise, 1, 1);



This = is ASSIGNMENT, not comparison. Comparison is ==. Please read the manual before anything else AFL Reference Manual

Also boolean value is already True or False. You don't need to compare boolean value to True to get True. Statements like if( Cond == True ) make no sense because it is essentially the same as saying if( Cond ) because that == True is redundant.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.