Strategy Tester - how to insert an opening order to get it going

 

Hello all:

Thanks first to those of yo who have helped me with the instant buy-back code based on looking at Order Close Hostory. It works!

On that note, me new EA begins first by querying for open orders. If there are open orders, then it does xyz calculation, But if there are no open orders, it queries the OrdersHistroyTotal() and OrderCloseTime() to figure out what the last trade was. Then, based on this last trade, the EA will then make the appropriate order to get in the market. So if the execution of an order is based on the previous close of an order, how then do I get something to even "launch" the program in Tester mode? In live mode, I can neter my starting trade, and the program picks up from there. But in tester mode, I can't start a trade per se and then test the program. In short, then, where could I embed a simple line of code that would do a simple buy order using ordersend, and then never-ever execute again (since for the duration of the EA, the start function is checking the order history as its primary means of determining which new order to open). As it is, when I run the EA in tester, I obviously have a big zero for everything, since nothing ever fires due the fact that that strategy tester does not pull up a history.


Any ideas how I can test an otherwise well-functioning EA?


Thanks,

Andre

 
Fix the EA to handle the case, HistoryTotal() == 0