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:
- HHV - highest high value
- HHVBars - bars since highest high
- Highest - highest value
- HighestBars - bars since highest value
- HighestSince - highest value since condition met (AFL 1.4)
- HighestSinceBars - bars since highest value since condition met (AFL 1.4)
- LLV - lowest low value
- LLVBars - bars since lowest low
- Lowest - lowest value
- LowestBars - bars since lowest
- LowestSince - lowest value since condition met (AFL 1.4)
- LowestSinceBars - barssince lowest value since condition met (AFL 1.4)
Then,
- Cross - crossover check
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.
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);
_SECTION_END();
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.