if i move the mouse on the chart, the index of the specific bar is shown like the picture,
how can i get this index ? i means get the index of bar depends on the location of mouse....
i would like to express by comment() function.
Thanks a lot your help ~
Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,0),", ", iOpen("USDCHF",PERIOD_H1,0),", ",
iHigh("USDCHF",PERIOD_H1,0),", ", iLow("USDCHF",PERIOD_H1,0),", ",
iClose("USDCHF",PERIOD_H1,0),", ", iVolume("USDCHF",PERIOD_H1,0));
What info do you get with this ??
thanks, I just try to use this inform for checking the size of bar,
i tested, but they could't show up the index when i move the mouse point.
yes, i can get the index of bar by crosshair tool,
but i need to comment(about index of bars) in the chart, cause for this value, i will calculate something.... impossible ??
could you explain more ?
Old post, but I found this thread because I wanted to be able to see the index of a bar.
The index is useful to me when writing indicators—especially when I have a problematic bar. I can dump debugging information for a very specific bar, like this:
if ( i == 31212 )
PrintFormat("i [%d] rates_total [%d] time [%s] SizeBody [%f]",
I call this using a scalpel instead of a sledgehammer.
So I created a simple indicator to be used as a tool to find this index number. Pretty simple, really. Hover over the bar to see the index number and time.
I've attached it for posterity.
It looks something like this:
Why have you attached mq5 code?
This section is for MT4 and mql4