I've been struggling to place my stop orders in my strategy for a bit, so decided to post this up and ask the pros for some guidance.
I have a strategy that places a Stop Order at the HH/HL (Swing), each time there is a new swing the strategy places a new Stop Order at the new level. The problem I'm having is that if the price does not reach that level within the next bar after the level has been set, the order seems to get cancelled. I would like for the Stop Order to remain in place at the Swing High price level until it gets triggered or there is a new Swing High and move the order to the new price. I'm printing a green diamond to check if the swing is being detected at the correct time, and also placed at the desired price (swing high + tick). I would also like to clarify that this is a Long setup only, no short orders are being placed anywhere.
Screenshot and code below, any help would be much appreciated.
---
TimeInForce = TimeInForce.Gtc;
---
I'm detect the new swing high by comparing it with the previous - the lookback is set to (4). Then place the stop order at the swing price + 1 tick, draw diamond at the same price level.
if (Swing1.SwingHigh[5] != Swing1.SwingHigh[0])
{
EnterLongStopMarket(Convert.ToInt32(DefaultQuantit y), (Swing1.SwingHigh[0] + (1 * TickSize)) , "long" + CurrentBar); // STOP ORDER AT SWING
Draw.Diamond(this, "LongDiamond" + CurrentBar, true, 0, (Swing1.SwingHigh[0] + (1 * TickSize)) , Brushes.Green); // DRAW DIAMOND AT SWING
}

Comment