Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Long & Short Order Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Long & Short Order Problem

    Hi

    Not sure what I am doing wrong, I am trying to place 2 orders at the same time one long one short, but only the first order is getting placed. I am trying to capture a break out in either direction.

    Any idea what I am doing wrong?

    protected override void OnBarUpdate() {

    if (Position.MarketPosition == MarketPosition.Flat) {
    if (ValidEntry) {
    SetStopLoss("Short", CalculationMode.Ticks, 20, false);
    SetProfitTarget("Short", CalculationMode.Ticks, 50);
    shortOrder = EnterShortStop(ShortEntry, "Short");

    SetStopLoss("Long", CalculationMode.Ticks, 20, false);
    SetProfitTarget("Long", CalculationMode.Ticks, 50);
    longOrder = EnterLongStop(LongEntry, "Long");
    }
    }
    }


    Thanks

    Mike

    #2
    Mike, in the managed approach in NT you would run into the order handling rules here leading to ignored orders (can be easily spotted when working with TraceOrders - http://www.ninjatrader.com/support/h...raceorders.htm)

    NT7 now offers a new unmanaged order submission mode, which deactives the order handling rules under the hood so any orders can be placed via the SubmitOrder, CancelOrder and ChangeOrder methods -

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    59 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    161 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    97 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    283 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X