Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding an instrument in a indicator turns SMA return to negative number

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

    Adding an instrument in a indicator turns SMA return to negative number

    When I add the VIX instrument to my indicator with Add ("VX 05-19", PeriodType.Tick, 100); Which is the same tick value as the primary instrument YM
    , the value from my YX average = SMA(rawDuration, fbPeriod); suddenly goes from a valid number to a negative number like -8975 after compiled successfully.

    #2
    Hello jkt1120, Thanks for your post.

    It sounds like the script is running into invalid data points between the RTY series and the VIX series. Comparing 100 tick VIX and RTY charts shows the VIX is sparse compared to the RTY. If the script accesses the secondary VIX series on every index of the primary series you should check that the series index is valid with IsValidDataPoint(). Printing out the values of the rawDuration series could also shed light on what's being calculated for the SMA result.

    I look forward to hearing of your results.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Pete77, Today, 10:22 AM
    0 responses
    2 views
    0 likes
    Last Post Pete77
    by Pete77
     
    Started by dtl-saw, Today, 08:51 AM
    0 responses
    2 views
    0 likes
    Last Post dtl-saw
    by dtl-saw
     
    Started by Lindsay10, Today, 08:22 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by Carlito178, Today, 06:49 AM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by space_trader, Today, 04:20 AM
    0 responses
    11 views
    0 likes
    Last Post space_trader  
    Working...
    X