Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strange variable issue

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

    Strange variable issue

    I have this strange issue when I run optimizations where everyone once in a while I will get a "Value of property 'Period' of NinjaScript 'SMA' is 0 and not in valid range between 1 and 2147483647" error. This doesn't make sense for a number of reasons, one is that it only throws this error once every couple thousand tests. So if I run a 10k GO optimization it might occur half a dozen times or so. The second reason it doesn't make sense is that the EMA period is only set in the OnStateChange() State.SetDefaults. I added a Print right before the EMA is calculated that tracks what value that is in the EMA Period variable and what is even more strange is that it will have a good value for a number of candles and then suddenly be 0 for 1 iteration.

    Below is a log of the period variable that goes into the EMA function, the Print() statement has been placed immediately before EMA().

    6/6/2013 8:35:00 AM - Find Price Extreme RSI: Trend Period - 14
    6/6/2013 3:25:00 AM - Find Price Extreme RSI: Trend Period - 0
    Value of property 'Period' of NinjaScript 'SMA' is 0 and not in valid range between 1 and 2147483647.

    Below is everywhere in code that this variable exists

    Code:
    [Range(1, int.MaxValue), NinjaScriptProperty]
            [Display(ResourceType = typeof(Custom.Resource), Name = "RSI Period", GroupName = "Identifying Price Strength", Order = 3)]
            public int RSIPeriod
            { get; set; }

    Shortened for brevity

    Code:
    protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    ...
                    RSIPeriod = 14;
                    ...
                }
                else if (State == State.Configure)
                {                
                    ...
                }
            }

    Code:
    Print(Time[0] + " - Find Price Extreme RSI: Trend Period - " + RSIPeriod);
                double previousRSI = RSI(BarsArray[2], RSIPeriod, RSISmooth).Avg[1];

    #2
    It just hit me that if NT8's back-testing is multi-threaded then my output is showing Prints() from multiple tests running in parallel, and the log is all mashed up. That still doesn't help fix the issue of values initializing to 0, but that might help me understand the output a little better.

    Comment


      #3
      Hello,

      Thank you for the questions.

      I wanted to check, do you have a simplified script that can demonstrate the error in your original question?

      If so can you provide it for testing? I am uncertain of the sequence that may have caused the error you are seeing, so I would likely need a sample to try to re create this in order to report it.



      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Waxavi, Today, 02:10 AM
      0 responses
      6 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Started by TradeForge, Today, 02:09 AM
      0 responses
      11 views
      0 likes
      Last Post TradeForge  
      Started by Waxavi, Today, 02:00 AM
      0 responses
      2 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Started by elirion, Today, 01:36 AM
      0 responses
      4 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by gentlebenthebear, Today, 01:30 AM
      0 responses
      5 views
      0 likes
      Last Post gentlebenthebear  
      Working...
      X