When setting an entry using a limit order, that works fine, I also set the stoploss and profit target values using your methods;
SetStopLoss("buyOrder", CalculationMode.Pips, StopLoss,true);
SetProfitTarget("sellOrder", CalculationMode.Pips, ProfitTarget);
SetStopLoss("sellOrder", CalculationMode.Pips, StopLoss,true);
In the strategy I have a place where my orders are to be closed, I may not have hit my stops / targets, and therefore any corresponding stops / profit orders need to be cancelled.
I close any positions I have first and then proceed to cancel these orders, but it does not seem to be correct. I get closed out and the price could be above any market prices observed. Is this potentially a problem with the stops / profits or with my closing the trade?
I have included a code snippet of the entrties and exits.
ExitLong(1, "exitBuy", "buyOrder");
EnterShortLimit(0, true, Qty, entryPriceSell, "sellOrder");
ExitShort(1, "exitSell", "sellOrder");
Do I need to reference these stops / profit orders within "OnOrderUpdate()" or should they work automatically when the order is closed and just shut themselves down.
Thanks
Comment