I have a question: how to get the index of the bar where I placed order in the past(ticket # is known.).
zeeyeetee: I have a question: how to get the index of the bar where I placed order in the past(ticket # is known.).
By using the "Open Time" of the order and then searching for that time within the bars. You can use the iBarShift() function for that:
Fernando Carreiro:
By using the "Open Time" of the order and then searching for that time within the bars. You can use the iBarShift() function for that:
o, yeah, order ticket # --> orderselect --> OrderOpenTime() --> iBarShift() --> bar index
thx Fernando,

iBarShift - Timeseries and Indicators Access - MQL4 Reference
- docs.mql4.com
Index of the bar which covers the specified time. If there is no bar for the specified time (history "gap"), the function will return -1 or the nearest bar index (depending on

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have a question: how to get the index of the bar where I placed order in the past(ticket # is known.).
thanks