I need to back test a strategy, and eventually fully or semi fully, automate the trading the strategy.... assuming the back tested results prove to be profitable.
Here's what I'm trying to do...
At Xpm, I want to enter a buy and sell order for X market. At this time, I will want both a buy and a sell order the enter the market at +&- 25 ticks from the Xpm closing bar.
Up until this point, I think I've been able to program the logic. Where I run into trouble, is with the following logic:
Whichever order executes first, will cancel out the other order. So if the buy executes before the sell, the sell will be canceled Next it will pace a sell/buy limit (based on what order executed), and a stop.
Also, it will be necessary to only execute one order, once the first order is filled, no other orders will be placed for the day.
Lastly, if the order has not filled before the market close, all orders will be withdrawn from the market.
I've attached what I have so far. Any help is appreciated.
Regards,
Brian
Comment