Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pending cancels

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

    #16
    Thanks. They must have been strategy-generated, I do not manually enter trades. Could they have been plotted as "historical" trades since I don't believe the strategy was running at those times?...

    Why would the entry markers not be in the "correct" locations (2 pips below the low of "condition true" bar)?

    Comment


      #17
      Originally posted by Burga1 View Post
      Why would the entry markers not be in the "correct" locations (2 pips below the low of "condition true" bar)?
      Have you tried setting slippage = 0 ?

      Comment


        #18
        From the screenshot it looks like you don't have a strategy running. They look like trades you have executed before. If you can post your latest rendition of code we may be able to get some hints to why the trades are being filled at the prices presented in the picture. It looks relative to the close price offset a few ticks rather than low price to me from the pic.
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          Thank you. KBJ I set the slippage to "0" in the properties window when I start the strategy.

          Here's the code from the strategy for "Condition 3" (the condition that triggered those trades as can be seen in the screenshot)...

          // Condition set 3
          if (High[0] > High[1]
          && Close[
          0] < Close[1]
          && Low[
          0] >= Low[1]
          && SMIndex(
          2, 13, 3, 25).SMI[0] < SMIndex(2, 13, 3, 25).SMI[1])
          {
          EnterPlace = Low[
          0] - (2 * TickSize);
          EnterShortLimit(
          1, EnterPlace, "Condition 3 Entry");
          ExitPlace = High[
          0] + (1 * TickSize);
          SetProfitTarget(CalculationMode.Ticks,
          4);
          SetStopLoss(
          "EnterShortLimit", CalculationMode.Ticks, ExitPlace, true);
          }

          Thanks again.

          Comment


            #20
            Your SetStopLoss() condition is most likely not working as you intended. Right now you have it set to stop you out if the price drops (High + 1 Tick Size) in ticks.

            If you want to stop out at that specific price you want to use CalculationMode.Price not CalculationMode.Ticks

            Also, please use some print commands to output the EnterPlace and ExitPlace variables. This will help you debug where your order was intended to fill at.
            Josh P.NinjaTrader Customer Service

            Comment


              #21
              Thanks for the input Josh. I have a question regarding "cancels" of an order if not taken up...if my code reads:

              if(some condition is true)
              {
              EnterPlace = High[0] + (2 * TickSize);
              EnterLongLimit(1, EnterPlace, "Condition 1 Entry");
              ExitPlace = Low[0] - (1 * TickSize);
              SetProfitTarget(CalculationMode.Ticks, 4);
              SetStopLoss("Condition 1 Entry", CalculationMode.Price, ExitPlace, true);
              ExitLongLimit(1, "Condition 1 Entry");
              }

              Should the "ExitLongLimit" command be placed after the "EnterLongLimit" command OR before? I would think it should be placed before so that a placed order doesn't immediately cancel itself...I only want to cancel an order that was never taken up...

              Is there a system variable that is set when an order has been placed? In that case the code could read something like "If(order placed variable is false){then ExitLongLimit;}"

              Comment


                #22
                Sorry I don't follow. If your entry order was never filled you don't need to Exit it. There is no position to exit.
                Josh P.NinjaTrader Customer Service

                Comment


                  #23
                  Hi,

                  I'm trying to follow-up on comments from earlier in this post (from post on 11/30 2:34pm). Since my order logic is in the "OnBarUpdate" function this causes the logic to leave the order "open" so that it is being filled on later bars (when I don't want it to do so...)

                  Comment


                    #24
                    If you do not resend your order it will automatically expire in the case of it not being filled. This is by design. The only possibility as to orders remaining active after the original entry condition is if that exact entry condition reevaluated to be true again.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #25
                      If that is true then those orders within my screenshot in that post could not have possibly executed, but they did as you can see...

                      Comment


                        #26
                        Burga1. Your conditions ARE evaluating to true on multiple subsequent bars. This is why your orders are staying alive. If you do not believe me put print functions as recommended in this debugging tip. Place the print inside your if condition to print every time it is evaluated to true. Use it along with TraceOrders and you will see exactly how your orders are working.

                        Further more you can play with the attached reference strategy. Watch how they behave in the output window. The strategy will print every bar number. If the condition evaluated to true on that bar it will print another line. From the output you can discern that orders that are resubmitted are kept alive. Once an order is not resubmitted you will see the order is effectively timed out.

                        Code:
                        CurrentBar: 14
                        CurrentBar: 15
                        CurrentBar: 16
                        CurrentBar: 17
                        12/2/2007 7:06:48 PM Condition Evaluated True on Bar 17 [COLOR=Red]<-- true so order submitted but never filled[/COLOR]
                        12/2/2007 7:06:49 PM Entered internal PlaceOrder() method at 12/2/2007 7:06:49 PM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=133.85 StopPrice=0 SignalName='longlimit' FromEntrySignal=''
                        CurrentBar: 18
                        12/2/2007 7:06:51 PM Condition Evaluated True on Bar 18 [COLOR=Red]<-- true so order resubmitted and kept alive[/COLOR]
                        12/2/2007 7:06:52 PM Entered internal PlaceOrder() method at 12/2/2007 7:06:52 PM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=133.86 StopPrice=0 SignalName='longlimit' FromEntrySignal=''
                        12/2/2007 7:06:52 PM Amended matching order: Action=Buy OrderType=Limit Quantity=1 LimitPrice=133.86 StopPrice=0 SignalName=longlimit' FromEntrySignal=''
                        CurrentBar: 19
                        12/2/2007 7:06:54 PM Condition Evaluated True on Bar 19 [COLOR=Red]<-- true so order resubmitted and kept alive[/COLOR]
                        12/2/2007 7:06:55 PM Entered internal PlaceOrder() method at 12/2/2007 7:06:55 PM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=133.88 StopPrice=0 SignalName='longlimit' FromEntrySignal=''
                        12/2/2007 7:06:55 PM Amended matching order: Action=Buy OrderType=Limit Quantity=1 LimitPrice=133.88 StopPrice=0 SignalName=longlimit' FromEntrySignal=''
                        CurrentBar: 20
                        12/2/2007 7:06:57 PM Condition Evaluated True on Bar 20 [COLOR=Red]<-- true so order resubmitted and kept alive[/COLOR]
                        12/2/2007 7:06:58 PM Entered internal PlaceOrder() method at 12/2/2007 7:06:58 PM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=133.89 StopPrice=0 SignalName='longlimit' FromEntrySignal=''
                        12/2/2007 7:06:58 PM Amended matching order: Action=Buy OrderType=Limit Quantity=1 LimitPrice=133.89 StopPrice=0 SignalName=longlimit' FromEntrySignal=''
                        CurrentBar: 21 [COLOR=Red]<-- NOT TRUE so order NOT resubmitted. order cancelled[/COLOR]
                        12/2/2007 7:07:01 PM Cancelled expired order: BarsInProgress=0: Order='3ca0d030afc847519fde42c0b1c0e62b/Sim101' Name='longlimit' State=Working Instrument='AAPL' Action=Buy Limit price=133.89 Stop price=0 Quantity=1 Strategy='orderautocancel' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='3ca0d030afc847519fde42c0b1c0e62b' Gtd='12/1/2099 12:00:00 AM'
                        Attached Files
                        Last edited by NinjaTrader_JoshP; 12-02-2007, 09:15 PM.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #27
                          Yes, I understand that the orders are "staying alive" because subsequent bars evaluate to true...that's not the problem. My question is why the "original" entry point (the "first true evaluation" bar) remains used for the subsequent bars...if subsequent bars evaluate to true then the entry point should "shift" on each subsequent bar (in my case 2 pips above/below the high/low of the bar).

                          For example if "bar 1" evaluates to "true" with an entry point 2 pips above the high of the bar, say a price of 1.4236...then if that price is not met on subsequent bars BUT those bars ALSO evaluate to true then the high + 2 pips of those bars should be the new calculated entry point...not the original 1.4236 point...

                          The screenshot is showing entries being made at price levels that were not originaly met on the bar after the condition became true (the "original" entry price was not met on that "bar 2" but reached on later bars...).

                          Comment


                            #28
                            Again, use TraceOrders to see what limit price your orders are being submitted with. If you look at the output from my previous post you will see the limit price resubmission is changing to reflect the state of the new orders.

                            Also, please realize that limit orders will let you get filled at the specified price or better. From the screenshot it looks like you are getting "better" fills. Any price below your High + 2 ticks is considered a better price.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #29
                              Well, I guess I'll try to take a look at TraceOrders but just to comment about your mention of "better fills"--that is basically my problem. I don't want "better" fills, I simply want the fill to happen (or not happen at all) on "bar 2" (the bar following the entry condition to be "true") at THAT particular price (high/low +/- 2 pips). My strategy depends on only that bar at the specified price level, if the entry is made on bar 3, or bar 5, or bar 13...OR is executed at a "better" price (a price I didn't specify) then that is of no use to me...in fact it more often than not gets me into trades I don't want to be in. Thus I don't want a trade to execute at all except on that "bar 2", and only "bar 2"...at the price I specify.

                              My testing is revealing many executed trades that should not have happened at all because the price level on "bar 2" was not met...thus resulting in many losing trades that shouldn't have triggered to begin with...I'm trying to eliminate this.

                              Comment


                                #30
                                Then I suggest you run a counter and just not resubmit your orders on the subsequent bars.

                                Code:
                                if(some condition is true && subsequentCounter < 1)
                                { 
                                      [SIZE=2][FONT=Courier New]EnterPlace = High[[/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]] + ([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] * TickSize); [/SIZE][/FONT]
                                      [SIZE=2][FONT=Courier New]EnterLongLimit([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2], EnterPlace, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"Condition 1 Entry"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
                                      [SIZE=2][FONT=Courier New]ExitPlace = Low[[/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]] - ([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] * TickSize); [/SIZE][/FONT]
                                      [SIZE=2][FONT=Courier New]SetProfitTarget(CalculationMode.Ticks, [/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800080]4[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
                                      [SIZE=2][FONT=Courier New]SetStopLoss([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000]"Condition 1 Entry"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2], CalculationMode.Price, ExitPlace, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);
                                      subsequentCounter++;[/SIZE][/FONT]
                                [FONT=Courier New][SIZE=2]}
                                
                                if (Position.MarketPosition == MarketPosition.Long)
                                {
                                      subsequentCounter = 0;
                                }[/SIZE][/FONT]
                                Now this does not guarantee you a fill at the specified price either. There is no true way you can prevent your order from filling at a better price. This will just prevent subsequent resubmission of orders.
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                581 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                336 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                103 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                554 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                552 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X