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

Infinite Loop Problem

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

    Infinite Loop Problem

    Hey guys I am using an indicator AutoTrendH, it works fine with no references to the variables below but when I run my backtest, this line of code appears to be stuck in an inifinite loop. Any idea how to avoid this? If i comment the line, it does not occur. The indiactor is in the indicator library on this forum.

    Print("AutoTrendLine: " + AutoTrendH(true, true, 1500).TrendPrice + " Up or Down: " + AutoTrendH(true, true, 1500).Direction + " Close: " + Close[0]);

    Thanks,
    EliteTraderNYC

    #2
    How much data are you backtesting this on? So if you load the default shared indicator on the same data amount, would it take this long to load up as well?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi, what is the default shared indicator?

      Comment


        #4
        The one that you've downloaded from the sharing section here...
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I was backtesting on 1 years data minute. Yes it was the one directly from the forum, no modifications.

          Comment


            #6
            Right, but if you applied the indicator directly without any calls from your strategy, how would it perform?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              It works okay without the statement: Print("AutoTrendLine: " + AutoTrendH(true, false, 1500).TrendPrice + " Up or Down: " + AutoTrendH(true, false, 1500).Direction + " Close: " + Close[0]); even though I add it to the chart. When I end the backtest, it says object reference not set.

              Comment


                #8
                I see, I would suggest contacting the original author then to inquire about a potentially upgraded version available and if he had seen the same return accessing those exposed values. I think he also added a strategy demo working with the same indicator?
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Hello ElitetraderNYC:
                  The problem is that you are using a Strength parameter setting of 1500. AutoTrendH uses the built-in Ninja Swing indicator internally. This indicator has a limitation of a lookback of 250 bars. If you open your output window (icon located at top of your chart) you should see this error thrown with values above 250.
                  The Strength parameter is a lookback setting that determines the strength of the trend, typically it would be considerably less then 1500 (maybe between 5-30 bars)
                  Hope this helps

                  Comment


                    #10
                    Hello EliteTrader
                    The line is just a debugging Print statement when the indicator was being drawn. It should have been removed prior to posting. Commenting it out or deleting it is fine.

                    DerekPhelps

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by andrewtrades, Today, 04:57 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by chbruno, Today, 04:10 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post chbruno
                    by chbruno
                     
                    Started by josh18955, 03-25-2023, 11:16 AM
                    6 responses
                    436 views
                    0 likes
                    Last Post Delerium  
                    Started by FAQtrader, Today, 03:35 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post FAQtrader  
                    Started by rocketman7, Today, 09:41 AM
                    5 responses
                    20 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Working...
                    X