0

I wrote a simple Amibroker AFL exploration code to get today's OI at Today's start and OI at current price and calculate their difference. The current price is getting correct value but not the value at todays start. Here is the code:



_SECTION_BEGIN("OI_Change_Intra");
//Get OI at current bar
currentOI =  OI ;

bi = BarIndex();
nd = Day() != Ref(Day(), -1);
firstb = ValueWhen( nd, bi); 

firstbarOI = ValueWhen(bi == firstb, OI);
currentOI = TimeFrameGetPrice("I", 3*in1Minute);
changeInOI = (currentOI - firstbarOI) / 50 ;

Filter = 1;
AddColumn(currentOI, "Current OI");
AddColumn(firstbarOI, "First OI");
AddColumn(changeInOI, "OI Change",1,colorWhite,colorBlue);

test =1;

_SECTION_END();

I initially hardcoded firstbarOI = ValueWhen(bi == firstb, OI); as firstbarOI = ValueWhen(TimeNum() == 091500, OI);

but it still not getting correct value.

0 Answers0