Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter Long Stop Problem

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

    Enter Long Stop Problem

    I have applied by stratgey to a chart and I am looking on the chart at the time and price that Ninja shows my execution. On the chart at a bar at 09:2636 Ninja says I have a long entry at the price of 1.3433.

    That entry seems to be a result of an EnterLongStop that I place at the prior bar at 09:2433. I think that entry order should not have filled.

    Here is output of key variables printed in OnOrderUpdate at 09:2433:

    **NT** Disabling NinjaScript strategy 'D/acdcc8c7391c4999b9ae9c78c44a111f'
    **NT** Enabling NinjaScript strategy 'D/c50bdcb200374995ba47bfc3bf3c3dee' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True MaxRestarts=4 in 5 minutes
    20110214 92433
    In OnOrderUpdate
    orderState: PendingSubmit
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: Accepted
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: Working
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: PendingSubmit
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: Accepted
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: Working
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: PendingSubmit
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: Accepted
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: Working
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False
    20110214 92433
    In OnOrderUpdate
    orderState: Filled
    Stop Price: 1.3433
    High[0]: 1.3432
    is entryOrder null: False

    How can I be getting a fill at 09:2433 with a stop price of 1.3433 when the high of the bar is at 1.3432?

    Why is the Ninja chart showing the entry on the next bar?

    #2
    Hello,

    Just to be clear this is on historical/backtest correct?

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      Yes this is historical data. It is ZenFire 6E data from 2/12/2011 to 3/12/2011.

      Comment


        #4
        Hello,

        Ok, In Backtest/Historical. NinjaTrader always takes order action on the open price of the next bar. Since we feel this is better to simulate real market conditions.

        Secondly, the fill engine be set to either liberal or default for order fills. Please see this information that should clear up when you get fills in backtest.

        Understanding historical processing options



        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          So you are saying my output shows a fill at the prior bar, even though that bar never reached the stop of my EnterLongStop. And that higher price at which the trade filled is actually the opening of the next bar. Is that correct?

          So I can't backtest, or test using historical data, a strategy that uses an EnterLongStop and then on the first tick of the next bar tries to cancel that order - because the the fill is based on the open of the new bar and my cancel is ineffective because the artificial fill occurred?

          Just to rephrase - I can't backtest a strategy that uses the following approcah -

          EnterLongStop above the current bar
          At first tick of next bar cancel that stop if I decide not to take the trade based on how the prior bar closed!

          I can't test that because the fill (based on the new bar open price) occurs before my cancel?

          Presumably the stratgey approach is viable in a live market though. Is that correct?

          Comment


            #6
            Hello,

            Its not that you cant backtest it. ITs just that it will not fill at the stop price. If the previous bar goes above or hits the stop price level it will trigger it as good to fill for when fill processing next occurs. Then on the open price of the next bar when fill processing occurs it will then fill the order.

            This is the same on stop loss orders as well. So you could get a worse, or better fill then expected in backtest.

            Let me know if I can be of further assistance.
            BrettNinjaTrader Product Management

            Comment


              #7
              Originally posted by dkrumholz View Post
              So you are saying my output shows a fill at the prior bar, even though that bar never reached the stop of my EnterLongStop. And that higher price at which the trade filled is actually the opening of the next bar. Is that correct?

              So I can't backtest, or test using historical data, a strategy that uses an EnterLongStop and then on the first tick of the next bar tries to cancel that order - because the the fill is based on the open of the new bar and my cancel is ineffective because the artificial fill occurred?

              Just to rephrase - I can't backtest a strategy that uses the following approcah -

              EnterLongStop above the current bar
              At first tick of next bar cancel that stop if I decide not to take the trade based on how the prior bar closed!

              I can't test that because the fill (based on the new bar open price) occurs before my cancel?

              Presumably the stratgey approach is viable in a live market though. Is that correct?
              For that kind of backtesting, you are better off using MarketReplay and forward testing on history.

              Comment


                #8
                koganam - if i use market replay data - will Ninja no longer use the opening price of the next bar to decide whether or not to fill my order?

                Comment


                  #9
                  Originally posted by dkrumholz View Post
                  koganam - if i use market replay data - will Ninja no longer use the opening price of the next bar to decide whether or not to fill my order?
                  MarketReplay is a streaming replay (you can speed it up), of the day's action (often minus the erratic ticks), so the fills are just as they are in real time, whatever you decide.

                  A LongStop is a waiting order, so it will be waiting where you put it. It will be cancelled when you say. If you want to do that on FirstTickOfBar, then CalculateOnBarClose must be false, otherwise FirstTickOfBar is pretty meaningless, if you are going to calculate when the bar closes anyway.

                  You can only truly test COBC false using a data stream, not static history.
                  1. I usually start off using the Simulator, because then I can control the market to do what I want while testing.
                  2. Once I think I have it down, I will use a MarketReplay at high speed for the next test.
                  3. If that testing still looks correct, I will use MarketReplay and advance to just before the condition I want to test, and play at 1x speed.
                  4. If that is correct, I will then use MarketReplay,for a few days, at about 10x speed and check the logs to be sure that things are still tickety-boo.
                  Last edited by koganam; 04-07-2011, 05:03 PM.

                  Comment


                    #10
                    koganam - thanks!

                    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
                    573 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X