Hi Experts,
I have written an AFL code which initializes the OHLC values of first 3 candles created. But when I compare those values in 'Exploration' window, the results are erroneous.
Can anyone look into the below code and verify if I am missing something!
// Today first 3 bars
dn = Day();
bi = BarIndex();
firstB = dn != Ref( dn, -1 );
secondB = BarsSince(firstB)==1;
thirdB = BarsSince(firstB)==2;
// First Candle OHLC
firstB_Op = ValueWhen(firstB, O);
firstB_Hi = ValueWhen(firstB, H);
firstB_Lo = ValueWhen(firstB, L);
firstB_Cl = ValueWhen(firstB, C);
// Second Candle OHLC
secondB_Op = ValueWhen(secondB, O);
secondB_Hi = ValueWhen(secondB, H);
secondB_Lo = ValueWhen(secondB, L);
secondB_Cl = ValueWhen(secondB, C);
// Third Candle OHLC
thirdB_Op = ValueWhen(thirdB, O);
thirdB_Hi = ValueWhen(thirdB, H);
thirdB_Lo = ValueWhen(thirdB, L);
thirdB_Cl = ValueWhen(thirdB, C);
Any comments will be very helpful.
Sandeep