What is the difference between these two codes

DOpen = TimeFrameGetPrice( "O", inDaily, 0 ); // gives you Todays Open price. 
AddColumn(DOpen,"Open",1.2,colorBlack,colorLightGrey);


AddColumn(Open,"OP",1.2,colorBlack,colorLightGrey);


GETTING SAME RESULT IN BOTH CODE...

I WANT TO KNOW, "TimeFrameGetprice" is any special code??

@hirenvyas you need to read about Multiple Time Frame functions.
https://www.amibroker.com/guide/h_timeframe.html

If you are using data with different timeframes then you will see the difference.

AddColumn(Open,"OP",1.2,colorBlack,colorLightGrey);

This is going to output the Open price of each bar - so if your data is 1 minute bars, it will be the Open of each minute, if your data is 5 minute bar then the Open of each 5 minute bar. If you have Daily data, then it is the Open of each Daily bar.

The MultiTimeFrame function in your next code will get the Open of the timeframe you specify, and in your example you used inDaily.

DOpen = TimeFrameGetPrice( "O", inDaily, 0 ); // gives you Todays Open price. 

You can see the difference if you run your Exploration on different data, in this example 5 minute bars.

dn = DateNum();
newDay = dn != Ref( dn, -1 ); // to help our explore we will identify the start of a new day

DOpen = TimeFrameGetPrice( "O", inDaily, 0 ); // gives you Todays Open price. 

Filter=1;
AddColumn(newDay, "newDay", 1.2, colorDefault, IIf(newDay, colorGreen, colorDefault));
AddColumn(DOpen,"Open",1.2,colorBlack,colorLightGrey);
AddColumn(Open,"OP",1.2,colorBlack,colorLightYellow);

image

3 Likes

Thanks sir.. Now I understand .....