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 ??
You can use the Crosshair tool (Ctrl+F). Click on last candle (index 0), hold down and move your mouse to the desired candle. First number is index.
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, rates_total, TimeToString(time[i]), SizeBody(i) ); }
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:
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:
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
Why have you attached mq5 code?
This section is for MT4 and mql4
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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 ~