Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Value outside of valid range

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

    Value outside of valid range

    I get the above Log error from this Indicator code:

    if ( CurrentBar < 40 ) return;

    Avg.Set( ( avg1 + avg2 ) / 2 );

    Value.Set( VMA(Avg,6,6)[0] );

    ............

    Avg plots fine if I comment out the Value.Set line...so the rest of the code is not causing the error

    Print( VMA(Avg,6,6)[0] ); outputs 'NaN' as a value. which is why the Log error....

    Question is why a 6 VMA does not calculate a value when the are > 40 bars in the chart
    Last edited by ATI user; 08-25-2012, 05:55 AM.

    #2
    problem solved

    I was dividing by zero in calculation of avg1 and/or avg2

    Comment


      #3
      ATI User,

      Please feel free to let us know if you require additional assistance.
      Adam P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by alrafer, Today, 05:39 AM
      0 responses
      1 view
      0 likes
      Last Post alrafer
      by alrafer
       
      Started by varun12343, Today, 03:09 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Marco  
      Started by Lance El Camino, Yesterday, 04:14 PM
      2 responses
      27 views
      0 likes
      Last Post NT-Roland  
      Started by MatthewLesko, Yesterday, 11:13 PM
      1 response
      15 views
      0 likes
      Last Post NT-Roland  
      Started by kevinenergy, Today, 01:44 AM
      0 responses
      8 views
      0 likes
      Last Post kevinenergy  
      Working...
      X