View Single Post
  #31 (permalink)  
Old 06-23-2007, 02:16 PM
don_forex's Avatar
don_forex don_forex is offline
Member
 
Join Date: Oct 2005
Posts: 67
don_forex is on a distinguished road
Quote:
Originally Posted by Neo View Post
Okay.... found a few things that needed attention and tidied up the source a little in the process.

Main things were:

1) removed a couple of redundant variables
2) added RefreshRates() at appropriate points

In CheckForBuy() & CheckForSell():

1) added a check for zero lot sizes
2) commented out the "for loops" around the calls to OrderSend() as I couldn't see what they achieved

In Start():

1) added checks for HighestBuyTicket, LowestBuyTicket, HighestSellTicket & LowestSellTicket being zero before trying to select/close the distant order


I've run a quick test from Sept 06 to June 07 and no errors are now being reported either for opening or closing orders. In the test, as a batch of SELLs was closed at a profit, the most losing BUY was also closed and vice-versa.

Obviously, some more checking would be good, just in case I've missed something but the updated source is here.....
I have never used the RefreshRates() before. The for loops was doing that. at least attempting to do that...

I ran backtests from '04 and in July of '04 the errors still occurred. I will look closer at the code and see if I can find anything.

Don
Reply With Quote