Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pending cancels

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

    Pending cancels

    Greetings,

    I wish to have a strategy enter a "long" trade by:

    --Possibly entering the position IF proper conditions exist on the CURRENT bar
    --If conditions on the CURRENT bar are met, place a "buy" limit order 2 pips above the HIGH of the CURRENT bar for entry on the NEXT bar...

    When conditions seem to be in place for a possible trade entry a "pending" order is established, my issue is that (I believe) when the CURRENT bar is completed the strategy immediately cancels the order if the NEXT bar is not 2 pips above the high...my code for orders is as follows:

    EnterPlace = (High[0] + 2) * TickSize; //entry 2 pips above high
    EnterLongLimit(
    1, EnterPlace, "Condition 1 Entry");
    ExitPlace = (Low[
    0] - 1) * TickSize; //stop 1 pip below low
    SetStopLoss(
    "EnterLongLimit", CalculationMode.Ticks, ExitPlace, true);

    Do I possibly need to cancel the "Calculate upon bar close" or is it some other issue? Thanks in advance.

    #2
    You need to keep resubmitting the order on every bar or else the order will be cancelled if it was not filled. If you wish it to persist there is a feature in NT6.5 that allows you to set a liveUntilCancelled bool to true.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks. So are you saying there is no way for me to instruct to place the order on the NEXT bar (the bar after the current bar when trade entry conditions became true) at 2 pips above the high and ONLY for that next bar?

      Comment


        #4
        - When you are running a strategy on the close of a bar basis, orders are always submitted on the the next bar
        - You can never place an order using the high/low of the next bar since this information is not know
        - You can place an order using the high/low of the closes bar (CurrentBar)
        RayNinjaTrader Customer Service

        Comment


          #5
          Thank you. "You can place an order using the high/low of the closes bar (CurrentBar)" -- that is what I wish to do. When I run my strategy using a "real-time" feed I'm noticing that the trade entry positions do not seem to be made at the correct levels (2 pips above HIGHS/2 pips below LOWS)...I'm trying to correct that.

          Comment


            #6
            I see.

            You will then have to debug this in your code. I see in your 1st post you have an incorrect calculation. To get the high + 2 pips you will need to:

            High[0] + (2 * TickSize);

            If you are on Beta 6.5 and working in sub-pips, then it would be (20 * TickSize)
            RayNinjaTrader Customer Service

            Comment


              #7
              Thank you, I'll correct that...I guess that would kinda make a difference

              Comment


                #8
                Greetings,

                Well I have what seems to be the proper entry behavior coded, however this leads to another question. Using the screenshot I've attached it can be seen that the little markers do in fact appear 2 pips above/below the highs/lows of the bar the trade condition became true...

                My question is why these postions appear to remain "open" even after the bar following has passed (I only want a possible trade to trigger on the bar after the bar a trade condition became true--not on following bars). Thus if the trade is not executed on the following bar it should cancel...thank you.
                Attached Files

                Comment


                  #9
                  Do not submit the order again on the following bar to cancel it. Executions are plotted based on time and it is possible:

                  - Condition true on Bar 1
                  - Order is filled a split second before Bar 2 is closed
                  - Execution time stamp falls on Bar 3
                  RayNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks but if you look at my screenshot, orders are being taken up several bars after the "condition true" bar...each bar is 5 minutes. It is not a matter of seconds...the entry is clearly remaining "live" for following bars to take up for quite some time...the price level on the "bar 2" (the bar the trade should be executed, if at all) never comes close to those entry points...

                    Comment


                      #11
                      Then this is because your order remains live since you keep re-submitting it.

                      If every close of the bar looks like this:

                      OnBarUpdate()
                      {
                      EnterLongLimit(Low[0]);
                      }

                      You will have a working limit order on every bar until this order fills.
                      RayNinjaTrader Customer Service

                      Comment


                        #12
                        OK, thank you I understand. What is the command used to cancel the order after the following bar ("bar 2") has completed and the order was not taken up?

                        Comment


                          #13
                          Please review this section of our Help Guide -



                          Specifically this sub section "Order Submission for Entry and Exit Methods"
                          RayNinjaTrader Customer Service

                          Comment


                            #14
                            Thanks for the link, that should clear things up a bit...but I do have another related issue to this.

                            If you look at this screenshot it's clear that the 3 "short" positions do not have the little entry markers placed 2 pips below the low of the previous bar (the bar the trade condition became true). I do not know why this is the case, there are also no "profit/loss" lines connecting those points to other points...I thought perhaps that indicated a "canceled" trade however on 2 of those bars the price did in fact reach a level 2 pips below the low of the previous bar, so I don't know what to make of it...
                            Attached Files

                            Comment


                              #15
                              Those are executions plotted on your chart that may or may not have been generated by your strategy.

                              If you simply place an order anywhere in NinjaTrader, executions are optionally plotted on a chart.

                              You will only see strategy related trades (with connector lines) when a strategy is running.
                              RayNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              576 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              334 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              553 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              551 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X