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 rbeckmann05, Yesterday, 06:48 PM
              1 response
              12 views
              0 likes
              Last Post bltdavid  
              Started by llanqui, Today, 03:53 AM
              0 responses
              6 views
              0 likes
              Last Post llanqui
              by llanqui
               
              Started by burtoninlondon, Today, 12:38 AM
              0 responses
              10 views
              0 likes
              Last Post burtoninlondon  
              Started by AaronKoRn, Yesterday, 09:49 PM
              0 responses
              15 views
              0 likes
              Last Post AaronKoRn  
              Started by carnitron, Yesterday, 08:42 PM
              0 responses
              11 views
              0 likes
              Last Post carnitron  
              Working...
              X