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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    50 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    16 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X