I have a question: how to get the index of the bar where I placed order in the past(ticket # is known.).

To add comments, please log in or register
zeeyeetee
76
zeeyeetee  

I have a question: how to get the index of the bar where I placed order in the past(ticket # is known.).

thanks

Fernando Carreiro
4795
Fernando Carreiro  
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:

zeeyeetee
76
zeeyeetee  
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
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
To add comments, please log in or register