|
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.....
|