Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy analyser not working with my strategy

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

    strategy analyser not working with my strategy

    when i ran my strategy today, it picked up trades. when i use the same symbol/strategy and run backtest. it does not pick up any trades. why?

    the only strategy it seems to backjtest properly is the builtin ones.

    #2
    junkone,

    Please debug your strategy by adding print functions throughout it to see what your strategy is processing and what it is not.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      so during the strategy analyser, it will keep printing all those stuff just like regular strategy?

      Comment


        #4
        It should still print regardless of whether backtesting or in real-time.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          i keep getting info that it is in historical. i have afilter to innore hisotical data. is there a way to detect if the strategy is run live or in strategy analyser mode. that way i can accept historical data.

          Comment


            #6
            If you have "if (Historical) return;" in your strategy you will not be able to backtest it. By the definition of backtesting, all data is historical data and they will all be processed as historical bars.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              so is there a way to detect if the strategy is being run under straetgy analyser

              Comment


                #8
                No, you just have to know what you are doing. You can just create yourself a property that is true/false for using Strategy Analyzer and just set it to what you want before you run the strategy.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by junkone View Post
                  so is there a way to detect if the strategy is being run under straetgy analyser
                  How about checking the account name...

                  Code:
                  [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (Account.Name == [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Back101"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
                  [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
                  [SIZE=2][FONT=Courier New]   Print([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"This is running in the Strategy Analyzer"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
                  [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
                  [/SIZE][/FONT]
                  Seems to work for me.

                  Comment


                    #10
                    thats a good way of doing it. i currently have a bool parameter passed when when i am running strategy analyser so i can decide if i can accept historical data or not.
                    if(!inStrategyAnalyser){

                    if (Historical)
                    {
                    Print(
                    "in historical");
                    return;
                    }
                    }

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    103 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    52 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    34 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    37 views
                    0 likes
                    Last Post TheRealMorford  
                    Started by Mindset, 02-28-2026, 06:16 AM
                    0 responses
                    74 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Working...
                    X