How to test HISTORIC results?

 
I would like to analyze last profit trades in my EA before open a new trade.

How can I do that?

Using:

OrderSelect(0, SELECT_BY_POS, MODE_HISTORY)

doesn't seems to bring last close trade...

Thanks
 
You will need to loop down through the history pool from OrdersHistoryTotal()-1 to 0, checking the sign of OrderProfit() - and OrderCloseTime() if you need to.
If the account could possibly have manual orders etc, then you'll need to identify those placed by your EA using OrderSymbol(), OrderComment(), OrderMagicNumber() etc.

CB