I'm trying to send to the market one OCO order for entry one tick above swinghigh or one tick below the swinglow.
one should be a long stop order and the other one a sell stop order. As I don't know how to do it I have been looking for all examples I could find and this is the result:
BloqueRap is number of contracts to buy
DiferencialHigh and DiferencialLow are how many ticks from swinghigh and swinglow entry price must be.
ocoString = string.Format("EntradaRap{0}",DateTime.Now.ToStrin g("hhmmssffff"));
//entrada largo
SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.StopMarket, BloqueRap, 0, (Swing1.SwingHigh[0] + DiferencialHigh * TickSize), ocoString, "LargoRap");
//entrada corto
SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.StopMarket, BloqueRap, 0, (Swing1.SwingLow[0] + (DiferencialLow * TickSize)), ocoString, "CortoRap");
I'm not sure even if this oco orders will work.
Next step is to change the price in the pending orders when the swinghigh or swinglow changes and I don't know how to do it as I'm not sure how to reference the orders. I tried with the entry name LargoRap but it doesn't work. It says: The name LargoRap doesn't exists on actual context (code CS0103)
ChangeOrder(LargoRap, BloqueRap, 0, (Swing1.SwingHigh[0] + DiferencialHigh * TickSize));
Thanks
Comment