• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Indicator issues with 1 minute time frame

  • Filter
  • Time
  • Show
Clear All
new posts

    Indicator issues with 1 minute time frame

    I have a created indicator that when the time frame is 1 minute, the indicator will only plot until Dec 22, 2014 and nothing from that date on.
    On the other hand the indicator will fully plot in any other intraday time frame other than 1 minute.

    The indicator will be plotted everytime with the market replay and a 1 minute time frame as well as other time frames,.

    Is this a coding issue, if then how can I solve this problem with this indicator and the 1 minute time frame?

    Any suggestions will be greatly appreciated.

    Hello 2Look4Me,

    Are there any errors in the Log Tab?

    Would you be willing to post the indicator so I can test it on my end?
    Cal H.NinjaTrader Customer Service


      Hi Cal,

      I just noticed that the log tab has errors, but I'm not sure what to do with that info.

      I'm attaching the file, thanks for testing and looking into it



        Maybe you have download tick data, but did not download minute data for the period after December 22. In that case no historical minute data is in your data base.

        The indicator does not have any issues with minute data.


          Hello 2Look4me,

          Thank you for posting the code.

          I tested this and found an overflow error in the log.

          The issue is with the following code:

          VarST1.Set(100 *
          (Close[0] - ((
          SMA(Close,Len1)[0] +
          SMA(SMA(Close,Len1),Len1)[0] +
          SMA(SMA(SMA(Close,Len1),Len1),Len1)[0] +
          SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1)[0] +
          SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1),Len1)[0] +
          SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1),Len1),Len1)[0] +
          SMA(SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1),Len1),Len1),Len1)[0] +
          SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1),Len1),Len1),Len1),Len1)[0] +
          SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1),Len1),Len1),Len1),Len1),Len1)[0] +
          SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(SMA(Close,Len1),Len1),Len1),Len1),Len1),Len1),Len1),Len1),Len1),Len1)[0]) / 10))
          / (High[HighestBar(Close, Len2 - 1)] - Low[LowestBar(Close, Len2 - 1)]));
          The issue is not with all of the SMA calls, these are able to call ok. The issue is that your math causes some infinities to be thrown. When this happens a NaN gets saved in the dataseries VarST1. When you try and set the plot to this value this later in the if statements this is when the overflow error crashes the script.

          Attached a modified version of your script that prints to the output window to show you what is going on. Please also have a look at the code to see how I debugged this with prints to give you an idea of how to find the source of an issue like this in the future.

          Follow these steps to import the NinjaScript:
          1. Download the script to your desktop, keep it in the compressed .zip file.
          2. From the Control Center window select the menu File > Utilities > Import NinjaScript
          3. Select the downloaded .zip file
          4. NinjaTrader will then confirm if the import has been successful.

          Critical *Note that on any files that say "File already exists on your PC" that start with an "@" symbol are the ones that came preloaded inside of NinjaTrader so you would say "No" so that you do not override those files.

          (Also I'm including instructions for exports so that you can export code for posting or sharing)

          To export your script do the following:
          1. Click File -> Utilities -> Export NinjaScript
          2. Enter a unique name for the file in the value for 'File name:'
          3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
          4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message

          By default your exported file will be in the following location:
          • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>

          Below is a link to the help guide on Exporting NinjaScripts.
          Attached Files
          Chelsea B.NinjaTrader Customer Service


            Chelsea, I can now see the issue with the math, at times there's a division by zero, therefore creating the overflow error. Thanks for taking the time to look at the logic in the math as well as for the detailed additional script and for the link on exporting Ninjascripts.

            Hey Harry, thanks also for your comment.


            Latest Posts


            Topics Statistics Last Post
            Started by lavalampmj, Today, 05:25 PM
            0 responses
            Last Post lavalampmj  
            Started by Antares66, Today, 05:19 PM
            0 responses
            Last Post Antares66  
            Started by jmneto, Today, 05:18 PM
            0 responses
            Last Post jmneto
            by jmneto
            Started by Bobbyj78, Today, 02:21 PM
            2 responses
            Last Post bltdavid  
            Started by EnveousColnago, Today, 02:10 PM
            1 response
            Last Post NinjaTrader_Ariana