Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Order expired BarProgress

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

    Order expired BarProgress

    Hi,

    There's something weird going on.

    I'm using 3min chart and addin a 15min of same instrument in script...

    In replay a bar that should be closed at 10:45:00 but actually closed at 10:45:15... Actually both bars (3min and 15min) are closing at the same time ->10:45:00... But because of that BarProgress number 1 that (15min) is closing my order.... In backtest, I mean historical data it doesn't happen when the bar closes at 10:45:00..... I saw it in realtime and I can also see it in replay.... What's happening ? I give no command within OnBarUptade event refering BarProgress==1...

    This is the output of the real and replay situation, followed buy the historical one:

    22/07/2014 10:42:01 Entered internal PlaceOrder() method at 22/07/2014 10:42:01: BarsInProgress=0 Action=SellShort OrderType=StopLimit Quantity=5 LimitPrice=2222,5 StopPrice=2222,5 SignalName='EntryShort' FromEntrySignal=''
    22/07/2014 10:45:16 Entered internal PlaceOrder() method at 22/07/2014 10:45:16: BarsInProgress=0 Action=SellShort OrderType=StopLimit Quantity=5 LimitPrice=2223,0 StopPrice=2223,0 SignalName='EntryShort' FromEntrySignal=''
    22/07/2014 10:45:16 Amended matching order: Action=SellShort OrderType=StopLimit Quantity=5 LimitPrice=2223,0 StopPrice=2223,0 SignalName=EntryShort' FromEntrySignal=''
    22/07/2014 10:45:16 Cancelled expired order: BarsInProgress=1: Order='a2fe24f18e5f401cb6eef6ef0908371b/Replay101' Name='EntryShort' State=Accepted Instrument='WDO 08-14' Action=SellShort Limit price=2223 Stop price=2223 Quantity=5 Strategy='GuiLongShort' Type=StopLimit Tif=Day Oco='' Filled=0 Fill price=0 Token='a2fe24f18e5f401cb6eef6ef0908371b' Gtd='01/12/2099 00:00:00'

    HISTORICAL

    22/07/2014 10:42:00 Entered internal PlaceOrder() method at 22/07/2014 10:42:00: BarsInProgress=0 Action=SellShort OrderType=StopLimit Quantity=5 LimitPrice=2222,5 StopPrice=2222,5 SignalName='EntryShort' FromEntrySignal=''
    22/07/2014 10:45:00 Entered internal PlaceOrder() method at 22/07/2014 10:45:00: BarsInProgress=0 Action=SellShort OrderType=StopLimit Quantity=5 LimitPrice=2223,0 StopPrice=2223,0 SignalName='EntryShort' FromEntrySignal=''
    22/07/2014 10:45:00 Amended open order: Action=SellShort OrderType=StopLimit Quantity=5 LimitPrice=2223,0 StopPrice=2223,0 SignalName=EntryShort' FromEntrySignal=''
    22/07/2014 10:45:00 Entered internal PlaceOrder() method at 22/07/2014 10:45:00: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=5 LimitPrice=0 StopPrice=2226,0 SignalName='StopShort' FromEntrySignal='EntryShort'
    22/07/2014 10:45:00 Entered internal PlaceOrder() method at 22/07/2014 10:45:00: BarsInProgress=0 Action=BuyToCover OrderType=Limit Quantity=5 LimitPrice=2218,0 StopPrice=0 SignalName='GainShort' FromEntrySignal='EntryShort'

    #2
    Hello agenor,

    Thank you for your post.

    In real-time and Market Replay the bar does not close until it receives the opening tick for the next bar. This can take time depending on the movement of the market. In backtesting the close of the bar is already known as the bars are historical.

    Please let me know if I may be of further assistance.

    Comment


      #3
      Ok, I know it...That is not my point....Why BarsInProgress 1 is closing my order in real time and in backtest it doesn't ? The EntryOrder was associated with BarsInProgress 0....you can sse it in the output... I don't know if the issue is happening because of the first tick comming 15seconds after....Can you help me ?

      Comment


        #4
        Hello agenor,

        Thank you for your response.

        There is no designation of what bar series the orders fill on when using the same instrument for both. In backtesting the orders execute on the primary series unless set to execute on another bar series.

        Comment


          #5
          ok. But the order was amended to be valid until the end of next candle ... you can see through the output....Why is it being canceled imidiatelly ? It should not be working like that... it doesnt happen in back test....Can you help me ??

          Comment


            #6
            Hello agenor,

            Thank you for your response.

            Are there any messages listed in the Log tab of the NinjaTrader Control Center when this occurs? Do you use Exit On Close when running in real-time?

            Comment


              #7
              No message in the log tab and I do not use Exit on Close, actully I set it to false in Initialize....
              ExitOnClose = false;

              It;s weird because it doesn't happen in backtest but happened in real time and it also happens through the replay I recorded....

              If I set the ordet to be live until canceled the issue stops happening in replay...but it's not the way I want to do in my strategy.... Can you help me ?

              Comment


                #8
                Hello agenor,

                Thank you for your response.

                May I test your strategy on my end? If so, please send the strategy's .cs file to platformsupport[at]ninjatrader[dot]com with this thread in the subject line: http://www.ninjatrader.com/support/f...ad.php?t=67648

                You will find the strategy's .cs file in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Strategy.

                Comment


                  #9
                  Hello,

                  Now I know for sure it's a bug in your system: NINJA TRADER.

                  I was addin the 15min of the same instrument to a 3min chart in Initialize like that
                  Add(PeriodType.Minute,15);

                  Then through OnBarUpdate I was using
                  if(BarsProgress==1){ //getting here what I wanted };

                  and the problem I described before was happening.

                  Then I created an Indicator that gets what I want from 15min chart and simply call it on script, so I could remove the Add of 15 min from Initialize...

                  Now, the problem described disapeared...

                  It's a problem that is happening because of the late tick of next bar, because it works fine on other circunstances both historical and real-time/replay

                  Comment


                    #10
                    I'm having this exact same issue. Trying to add a small 66 tick data series to a UniRenko chart for back-testing purposes as I need intrabar data for trade management. Other than programming an indicator, is there a work-around for this?

                    Comment


                      #11
                      Hello agenor,

                      Thank you for your post.

                      There would not be a way around this in the strategy as the executions can occur on any bar type if they all rely on the same instrument.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by KonAdams, 05-07-2024, 10:53 PM
                      9 responses
                      25 views
                      0 likes
                      Last Post KonAdams  
                      Started by haas88, 03-21-2024, 02:22 AM
                      16 responses
                      193 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by JimB17, 01-10-2020, 10:27 AM
                      75 responses
                      2,793 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by JGriff5646, 05-07-2024, 10:02 PM
                      3 responses
                      29 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by dp8282, Today, 07:35 AM
                      1 response
                      9 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Working...
                      X