Openinterest - prev day close open interst

AW=ParamStr("AW","BANKNIFTY");
MYSYMBOL=aw+NumToStr(A+INCREMENT,1.0,0)+"CE";
pp=10;

SetForeign(MYSYMBOL);

// motive is to plot on intraday curent open interest - prev day (end of day) open interest. to plot Change in open interest
// it not working 
O1 = OI-TimeFrameGetPrice("OI",inDaily,-1); 
C1=C;

mystyle=styleLine|styleThick;
 Plot( O1, MYSYMBOL, ColorGREEN, mystyle);

Moderator comment: added required code tags

@Tomasz

How to get last day's Open interest? The code below shows wrong value.
Thank you

OILASTDAY = TimeFrameGetPrice( "OI", inDaily, -1 );

Please carefully read the manual
https://www.amibroker.com/guide/afl/timeframegetprice.html

It is mentioned in second sentence of upper link.

First parameter - pricefield - is one of the following: "O", "H", "L", "C", "V", "I" (open interest).

So it is:

OILASTDAY = TimeFrameGetPrice( "I", inDaily, -1 );

And if you want to apply time compression from foreign symbol then you have to read this article of knowledge base:

2 Likes

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