1
votes

OrderSelect(,,MODE_HISTORY)

In a live metatrader account, does it store all closed positions from the first time i opened an account with a broker?

I wanted to make an expert advisor that calculates my winrate on a certain pair. I need to find out the data limit mt4 handles. Can I go say, 100 trades back? Will that still be available or would that have been deleted by mt4? If so, how about 500 trades? 1000? What is the limit? Is there any?

I guess an answer to this question will also reveal the maximum possible integer output for OrdersTotal, if there is any.

2

2 Answers

0
votes

Go to terminal window -> Account History -> Right-Mouse Click -> Select all history. You can read all the history that is shown using OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) but if you do not have that history (e.g., you chosen last months and on 31th January it shows all January, next day it shows only February) then it will not return past trades.

0
votes

It depends on your broker (i.e., its trading server settings). Normally, brokers choose to "compress" the past order data to store only last 1-3 months of history.