Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy is being disabled when backtesting although order reference is transitioned

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

    #16
    Hello Emily,

    I will try to update the version and let you know.

    One thing I noticed is, we still have a difference in our backtesting time ranges. Your trace output is:

    Code:
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): StrategyBase (ES/Backtest) has loaded.
    OnStateChange() state: Historical
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): [B]Bar number 0[/B] was the first bar processed of the session at [B]3/24/2024 10:01:00 PM[/B].
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Reset values on session start.
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Set significant market values.
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/[B]Bar 110[/B]/BarsInProgress 0): Placed long entry limit order at: 5286.5​
    OnStateChange() state: SetDefaults
    OnStateChange() state: Terminated​
    etc.
    In the backtest throwing the error it is:
    Code:
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): StrategyBase (ES/Backtest) has loaded.
    OnStateChange() state: Historical
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): [B]Bar number 0[/B] was the first bar processed of the session at [B]25/03/2024 00:01:00[/B].
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Reset values on session start.
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Set significant market values.
    TitanEdgeRandomEntry 0.0.4(ES/Backtest/[B]Bar 1369[/B]/BarsInProgress 0): Placed long entry limit order at: 5279,5
    OnStateChange() state: SetDefaults
    OnStateChange() state: Terminated
    OnStateChange() state: Terminated
    Strategy 'TitanEdgeStrategyRandomEntryV4/281664542' has been disabled because it attempted to modify a historical order that has transitioned to a live order. Please see the help guide for more information on transitioning order references from historical to live.
    I have marked the differences as bold. From what I see the limit entry order in your backtest is not placed near the end of the backtesting time range - maybe therefore it could not trigger the error. I will have a look at timezone differences, maybe rework the script to just place the entry order on a specific bar number. Default 24 x5 should be a session starting and ending at 00:00, right?

    Thank you for your support.

    Comment


      #17
      Originally posted by Padan View Post
      Hello Emily,

      I will try to update the version and let you know.

      One thing I noticed is, we still have a difference in our backtesting time ranges. Your trace output is:

      Code:
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): StrategyBase (ES/Backtest) has loaded.
      OnStateChange() state: Historical
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): [B]Bar number 0[/B] was the first bar processed of the session at [B]3/24/2024 10:01:00 PM[/B].
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Reset values on session start.
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Set significant market values.
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/[B]Bar 110[/B]/BarsInProgress 0): Placed long entry limit order at: 5286.5​
      OnStateChange() state: SetDefaults
      OnStateChange() state: Terminated​
      etc.
      In the backtest throwing the error it is:
      Code:
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): StrategyBase (ES/Backtest) has loaded.
      OnStateChange() state: Historical
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): [B]Bar number 0[/B] was the first bar processed of the session at [B]25/03/2024 00:01:00[/B].
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Reset values on session start.
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Set significant market values.
      TitanEdgeRandomEntry 0.0.4(ES/Backtest/[B]Bar 1369[/B]/BarsInProgress 0): Placed long entry limit order at: 5279,5
      OnStateChange() state: SetDefaults
      OnStateChange() state: Terminated
      OnStateChange() state: Terminated
      Strategy 'TitanEdgeStrategyRandomEntryV4/281664542' has been disabled because it attempted to modify a historical order that has transitioned to a live order. Please see the help guide for more information on transitioning order references from historical to live.
      I have marked the differences as bold. From what I see the limit entry order in your backtest is not placed near the end of the backtesting time range - maybe therefore it could not trigger the error. I will have a look at timezone differences, maybe rework the script to just place the entry order on a specific bar number. Default 24 x5 should be a session starting and ending at 00:00, right?

      Thank you for your support.
      The Default 24 X 5 Trading Hours session is 12am to 12am M-F EST:
      World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


      You may find more information about Trading Hours templates in the Control Center > Tools > Trading Hours window.

      I look forward to your updates with the additional results.

      Comment


        #18
        Hello Emily, when you have selected Default 24 x 5 why does your backtest output start at .... the first bar processed of the session at 3/24/2024 10:01:00 PM ?

        Comment


          #19
          Originally posted by Padan View Post
          Hello Emily, when you have selected Default 24 x 5 why does your backtest output start at .... the first bar processed of the session at 3/24/2024 10:01:00 PM ?
          That is because my platform is set to MST which is 2 hours behind the EST time zone.

          Comment


            #20
            Hello Emily,

            thank your for the clarification.

            As promised I now have tested this error on some other machines with different data providers and NinjaTrader versions.

            First attempt was on NinjaTrader 8.1.1.7 64-bit with Rithmic.
            Here is the output:
            Code:
            OnStateChange() state: SetDefaults
            OnStateChange() state: Configure
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): Set values in State.Configure.
            OnStateChange() state: DataLoaded
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): StrategyBase (ES/Backtest) has loaded.
            OnStateChange() state: Historical
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Bar number 0 was the first bar processed of the session at 25.03.2024 00:01:00.
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Reset values on session start.
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Set significant market values.
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 1369/BarsInProgress 0): Placed long entry limit order at: 5279,5
            OnStateChange() state: SetDefaults
            OnStateChange() state: Terminated
            OnStateChange() state: Terminated
            Strategy 'TitanEdgeStrategyRandomEntryV4/306601665' has been disabled because it attempted to modify a historical order that has transitioned to a live order. Please see the help guide for more information on transitioning order references from historical to live.
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): Cancelled all entry orders.
            OnStateChange() state: Terminated
            OnStateChange() state: SetDefaults
            OnStateChange() state: SetDefaults
            OnStateChange() state: Terminated
            The second test I made was on NinjaTrader 8.1.2.1 64-bit with Tradovate as data provider.
            Here is the output:
            Code:
            OnStateChange() state: SetDefaults
            OnStateChange() state: Configure
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): Set values in State.Configure.
            OnStateChange() state: DataLoaded
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): StrategyBase (ES/Backtest) has loaded.
            OnStateChange() state: Historical
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Bar number 0 was the first bar processed of the session at 25.03.2024 00:01:00.
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Reset values on session start.
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 0/BarsInProgress 0): Set significant market values.
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar 1369/BarsInProgress 0): Placed long entry limit order at: 5279,5
            OnStateChange() state: SetDefaults
            OnStateChange() state: Terminated
            OnStateChange() state: Terminated
            Strategy 'TitanEdgeStrategyRandomEntryV4/323533003' has been disabled because it attempted to modify a historical order that has transitioned to a live order. Please see the help guide for more information on transitioning order references from historical to live.
            TitanEdgeRandomEntry 0.0.4(ES/Backtest/Bar -1/BarsInProgress 0): Cancelled all entry orders.
            OnStateChange() state: Terminated
            OnStateChange() state: SetDefaults
            OnStateChange() state: SetDefaults
            OnStateChange() state: Terminated

            Comment


              #21
              Hello Padan,

              Thank you for your reply.

              Please reduce your strategy by commenting out portions of code that do not cause this error and/or adding print statements to narrow down which line of code is the last thing processed before the error is thrown. This way we can narrow down the potential cause of this error and also create a test strategy to see if it is indeed related to something specific with IsLiveUntilCanceled orders. For more information on using prints and comments for debugging, please see the links below:Once you have narrowed this behavior down to a more reduced sample, please provide that sample along with the settings/steps that you took that still produce the error message so I may test again on my end.

              I look forward to your reply.

              Comment


                #22
                Hello Emily,

                thank you for your reply.
                Unfortunatly I won't be able to commit more time on this subject and produce a reduced sample. The error itself is not that critical as it only occurs in backtests and I have already posted a solution that works for me.

                I thank you very much for your effort and support and wish you a nice day.

                Comment


                  #23
                  Hey! It looks like your strategy isn't switching to real-time as it should, causing the error. Make sure your code logic is solid and meets the transition conditions. Simplify your code if needed and keep exploring. Also, for more IT advice, check out https://www.proximitum.com/ . They should have useful solutions. Good luck!
                  Last edited by Nothinox; 04-05-2024, 07:11 AM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Today, 05:17 AM
                  0 responses
                  50 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  126 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  69 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  42 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  46 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X