Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop limit order?

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

    Stop limit order?

    I'm creating a simple strategy using the Strategy Wizard.

    I'd like to enter a long position by a stop limit order. I'd like my offset to be 2 ticks.

    What should my Parameters be? By default the wizard has:
    Limit price 0
    Stop price 0

    Thanks

    #2
    benww604, you would need to decide for a stop price (i.e. High[0]) and then add the desired offset to it to arrive at your limit price.

    This might be also useful to clarify our NinjaScript offered order types -

    Comment


      #3
      hmmm, it still doesn't execute any trades... what am I missing:

      // Condition set 1
      if (Close[0] > WMA(30)[0])
      {
      EnterLongStopLimit(DefaultQuantity, 0, High[0] + 2 * TickSize, "");
      }

      // Condition set 2
      if (Close[0] < WMA(30)[0])
      {
      ExitLong("", "");

      Thanks

      Comment


        #4
        Originally posted by benww604 View Post
        ... EnterLongStopLimit(DefaultQuantity, 0, High[0] + 2 * TickSize, "");
        What is your intent with that line?
        What is the error in your log?

        Comment


          #5
          When the previous bar closes above the 30 WMA, I'd like to enter a long position, but limit my slippage to 2 ticks. I know a stop order becomes a market order, hence I'd like to use a stop limit order.

          I don't know if it should trigger at the high, low, open, close of the following bar. I think it should be the open of the following bar, since the last bar closed above the 30 WMA.

          Sorry as I'm new to Ninjatrader but love the capabilities it has to offer.

          Comment


            #6
            Originally posted by benww604 View Post
            When the previous bar closes above the 30 WMA, I'd like to enter a long position, but limit my slippage to 2 ticks. I know a stop order becomes a market order, hence I'd like to use a stop limit order.

            I don't know if it should trigger at the high, low, open, close of the following bar. I think it should be the open of the following bar, since the last bar closed above the 30 WMA.

            Sorry as I'm new to Ninjatrader but love the capabilities it has to offer.
            So what is the error in your log?

            Comment


              #7
              pop up message:
              CQG, Limit price can't be smaller than stop price. affected Order: Buy 1 StopLimit @ 52.71 x 0

              Comment


                #8
                I tried on ES at first. Log:
                Name='Buy' New state=Rejected Instrument='ES 03-15' Action=Buy Limit price=0 Stop price=2089.25 Quantity=1 Type=StopLimit Filled=0 Fill price=0 Error=OrderRejected Native error='Limit price can't be smaller than stop price.'

                code:
                {
                Add(WMA(30));
                SetProfitTarget("", CalculationMode.Ticks, 50);
                SetStopLoss("", CalculationMode.Ticks, 50, false);

                CalculateOnBarClose = true;
                }

                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
                protected override void OnBarUpdate()
                {
                // Condition set 1
                if (Close[0] > WMA(30)[0])
                {
                EnterLongStopLimit(DefaultQuantity, 0, High[0] + 2 * TickSize, "");
                }

                // Condition set 2
                if (Close[0] < EMA(9)[0])
                {
                ExitLong("", "");
                }
                }

                Comment


                  #9
                  You need to set the limit price and the stop price for stop limit orders.

                  Currently your setting stop price but not setting anything for limit price which is causing the order to be submitted with a limit price of 0 which errors.

                  You would need to do something like this: EnterLongStopLimit(DefaultQuantity, High[0] + 2 * TickSize, High[0] + 2 * TickSize, "");

                  This submits a stop limit order with a stop price and limit price at the same price for example. You can do this in the strategy wizard by filling out the limit price field just like you did the stop price field. (Or adjust depending on your trading logic you need).
                  BrettNinjaTrader Product Management

                  Comment


                    #10
                    Thank you =) great way to start the weekend with a working strategy I can test now =))

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    648 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    369 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
                    572 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    574 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X