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

strategy analyzer does not run my strategy

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

    strategy analyzer does not run my strategy

    Hi,

    I have a strategy using multiple timeframe on a custom indicator. I have the custom indicator run on the primary data series. And I also add another data series (same instrument, different timeframe) in State.Configure. Then run the custom indicator on the secondary data series:
    Code:
    myFirstCustomData = CustomIndicator(params1, params2);
    mySecondCustomData = CustomIndicator(Inputs[1], params1, params2);
    To get data from "mySecondCustomData", I expose some variable from the custom indicator because for some reason the data from mySecondCustomData does not update. Only myFirstCustomData get updated properly. Why is that?
    Code:
    [Browsable(false)]
            [XmlIgnore]
            public double GetBotZone
            { //call OnBarUpdate before returning
                get  {  Update(); return BotZone;   }
            }​
    The strategy works fine on Playback Mode and Live. But once I tried on Strategy Analyzer, it does not return any result. I looked at the Output window from Ninjascript editor, it seems to run fine as there were no error that I can spot. But no results from Strategy Analyzer

    I then removed the secondary data series where I define
    Code:
    mySecondCustomData = CustomIndicator(Inputs[1], params1, params2);
    and removed some related code. The strategy analyzer returns results. So it looks like Strategy Analyzer does not like my custom indicator running on another timeframe. Please help. What do I need to do get this run on Strategy analyzer? And I use Tick Replay option.
    Last edited by affilife; 01-31-2024, 01:50 AM.

    #2
    Hello affilife,

    That would be difficult to say what may be happening without knowing what code was used in the indicator. You will very likely need to add prints into the indicator to see how your logic is equating in that use case.

    The strategy analyzer uses historical data when processing where playback and live use realtime data so depending on the settings your strategy uses that may also play a role.


    JesseNinjaTrader Customer Service

    Comment


      #3
      Adding some print, I found that the strategy stop right after this code in the strategy OnBarUpdate()
      Code:
      if (CurrentBars[0] < 110 || CurrentBars[1] < 110)
                      return;​
      It looks like that it never pass this condition in Strategy Analyzer. I have historical data for the dates that I selected. Not sure why it stop there. But looks like it has nothing to do with my custom indicator

      Comment


        #4
        Now I see that the secondary data series only load up 22 bars whereas the primary data set load to 275 bars. How can I force it to load more data?

        Comment


          #5
          Hello affilife,

          That statement will return if the CurrentBars for either series is less than that value. You can use a Print before that statement to see what historical data was loaded

          Print("BIP: " + BarsInProgress + " CurrentBar: " + CurrentBar);
          JesseNinjaTrader Customer Service

          Comment


            #6
            Hello affilife,

            You would need to select a date using the start date in the analyzer if you need to load more data.
            JesseNinjaTrader Customer Service

            Comment


              #7
              thank you so much. That solve the problem.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by geddyisodin, 04-25-2024, 05:20 AM
              8 responses
              58 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by halgo_boulder, 04-20-2024, 08:44 AM
              2 responses
              21 views
              0 likes
              Last Post halgo_boulder  
              Started by mishhh, 05-25-2010, 08:54 AM
              19 responses
              6,189 views
              0 likes
              Last Post rene69851  
              Started by gwenael, Today, 09:29 AM
              0 responses
              5 views
              0 likes
              Last Post gwenael
              by gwenael
               
              Started by Karado58, 11-26-2012, 02:57 PM
              8 responses
              14,830 views
              0 likes
              Last Post Option Whisperer  
              Working...
              X