Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 -

    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rodriguesdanny, 05-15-2024, 12:06 PM
    7 responses
    30 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by warpinator, 05-16-2024, 10:44 AM
    9 responses
    52 views
    0 likes
    Last Post ETFVoyageur  
    Started by StefanA, Today, 11:24 AM
    6 responses
    15 views
    0 likes
    Last Post StefanA
    by StefanA
     
    Started by Austiner87, Today, 11:19 AM
    2 responses
    7 views
    0 likes
    Last Post Austiner87  
    Started by ETFVoyageur, Today, 12:26 PM
    1 response
    1 view
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X