View Single Post
  #22 (permalink)  
Old 08-13-2008, 12:40 AM
omelette omelette is offline
Senior Member
 
Join Date: Jan 2006
Posts: 1,119
omelette is on a distinguished road
Quote:
Originally Posted by lcfxtrader View Post
Omelette,

I do not understand what you mean by "OrdersHistoryTotal() problem as described above". The problem I have experienced is that the EA would open the wrong position size after a loss.

EX:

1st trade = .1 lot resulting in a loss

then it would open

2nd trade = .3 lots

It should have been .2 lots
OrdersHistoryTotal() is buggy, meaning it will not work properly when backtesting. Also, when it is used in an EA that is being forward-tested, (such as this one) if there is no closed orders visible in the 'Accounts History' tab, the 'LotSizeFactor' variable (which is causing the problem) will not be set correctly...

That said, I have had a proper look at the code and the problem seems to be a 'recovery' issue, and not the code per-se - so I have restored the original code and added some 'recovery' code! (original post) Making an EA 'robust' to account for 'recovery' problems can be more difficult then writing the EA itself! And there is no guarantee with what I've done here - so let me know how it goes!
Reply With Quote