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:
o, yeah, order ticket # --> orderselect --> OrderOpenTime() --> iBarShift() --> bar index