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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    367 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    571 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X