Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry Offset

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

    #16
    Don't believe that is what the issue is. The issue is in relation with your stop price and the currently traded market price.
    Josh P.NinjaTrader Customer Service

    Comment


      #17
      I'm totally lost. I use the SuperDome on the test case and it works perfectly. The Strategy fails on the same data.

      Comment


        #18
        You can't submit stop orders with a stop price below the currently traded market price. As stated earlier, in a fast moving market when your code tries to do Close + TickSize that is too close to the market and the market price can be well above close+1 tick by the time it is processed. The same situation does not occur in the SuperDOM because generally speaking you are not fast enough to do such an order.
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          OK, so I'm using Limit orders as in:

          EnterLongLimit(Close[0]);
          EnterShortLimit(Close[0]);

          This usually works but there were several Short Entries where the High of the next bar was equal to the Close of the trigger bar. In those instances the order was not placed.

          How can I force an order in those cases?
          Last edited by jerryvellutini; 11-19-2009, 04:14 PM.

          Comment


            #20
            jerry, are the orders being submitted and then cancelled directly after? Unless there is an error, the order was submitted.

            The default behavior for limit orders is for the order to be cancelled if the conditions that caused the order are no longer true, which is what I believe is what is happening to you.

            Please read this great post by Josh that explains how to debug unexpected order behavior.
            AustinNinjaTrader Customer Service

            Comment


              #21
              I get "Canceled Expired Order":
              Bars in Progress = 0
              Filled = 0
              Fill Price = 0
              Yes, in these cases the price never passes through the Close of the trigger bar. My question is how can I deal with this.

              I want to place the order at the Close of the trigger bar.
              Last edited by jerryvellutini; 11-19-2009, 04:26 PM.

              Comment


                #22
                jerry, in this case it will be necessary to work with the overload that specifies that orders are live until cancelled. Here is the help guide page for EnterLongLimit() - take a look at the sections about liveUntilCancelled.

                Basically, the code will look something like this:
                Code:
                // the first argument, barsInProgressIndex will always be 0 unless you're working with a multi-instrument strategy
                // EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)
                EnterLongLimit(0, true, 1, Close[0], "long order till cancelled");
                AustinNinjaTrader Customer Service

                Comment


                  #23
                  If I understand, this will keep the order open through subsequent bars. That's not what I want. I want to buy at the High of the next bar if it doesn't contain the Close price of the trigger bar.

                  I want to buy at the Close Price of the trigger bar....

                  Comment


                    #24
                    Originally posted by jerryvellutini View Post
                    I want to buy at the High of the next bar if it doesn't contain the Close price of the trigger bar.
                    Ok, so if I correctly understand what want, this code should do the trick:
                    Code:
                    if (Low[0] > Close[1])
                    {
                         EnterLongLimit(High[0])
                    }
                    In English, the above code says this: if the current bar's low is greater than the previous bar's close (that's how I interpreted "if it doesn't contain the Close price") then enter long limit at the high of the current bar.

                    Let me know if this isn't what you're looking for.
                    AustinNinjaTrader Customer Service

                    Comment


                      #25
                      I'm not sure. The building bar will never get above the close value of the trigger bar. I want to buy at the close value of the trigger bar.

                      To try this, do I change to
                      CalculateOnBarClose = false;
                      and change my trigger algorithms from [0] to [1]?

                      Thanks for your help.
                      Last edited by jerryvellutini; 11-19-2009, 05:21 PM.

                      Comment


                        #26
                        Jerry, it depends on what you're looking for. I think in your case it would be necessary to change CalcOnBarClose = false and adjust the barsBack accordingly just like you mentioned. You might have to go as far as changing some of the [1]'s to [2]'s.
                        AustinNinjaTrader Customer Service

                        Comment


                          #27
                          You suggested:

                          Code:
                          if (Low[0] > Close[1])
                          {
                          EnterLongLimit(High[0])
                          }

                          I don't understand. I was trying to sell short in the case of a red trigger bar where the High of the building bar just reaches but doesn't exceed the Close of the trigger bar.

                          Isn't it a usual occurrence for someone to want to enter trades at the close price of a trigger bar? It seems to me that that would be a very common requirement.

                          It's easily done manually using the SuperDom as I discussed earlier. Why is it so difficult using NinjaScripts?

                          Comment


                            #28
                            Jerry, per default strategies are evaluated at the close of the bar, so with CalculateOnBarClose set to 'true', then next trade location is the open of the next bar...however you could work with CalculateOnBarClose set to false and then submit the order on the building next bar -

                            if (redTriggerBar && High[0] == Close[1])
                            EnterShortLimit(Close[1]);

                            Comment


                              #29
                              Bertrand,

                              This doesn't place a Sell in the case where the High of the building bar is equal to the Close of the trigger bar. I believe it's because the data in the building bar never passes through the Close of the trigger bar. I think that's why in doing this with the SuperDom you enter a Long Stop Limit order with the Limit at the Close of the trigger bar - one tick and the Stop set at the Close of the trigger bar. This works but I get errors if I try to code it in NinjaScript.
                              Last edited by jerryvellutini; 11-20-2009, 12:25 PM.

                              Comment


                                #30
                                Jerry, I'm not sure what you refer to, in your last post you were talking about a short, now about a long, if the triggerBar in each setup is not the most recent closed one, then I suggest you save the relevent trigger bar close value to a variable and use this then in your condition. Also when placing you need to take into consideration the current bid / ask (will be replaced by Close in backtesting) to make sure the order you attemp to place is valid (some as in the SuperDOM). I would also suggest you add drawings to your conditions to idendify exactly when your conditions hit home and you could expect an order to be placed.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                663 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                376 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                110 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                575 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                580 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X