Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple Moving Average (SMA)

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

    Simple Moving Average (SMA)

    The following code gives the error...

    Cannot implicitly convert type 'NinjaTrader.Indicator.SMA' to 'double'

    The help menu says the SMA function accepts a dataseries (BarsArray) and returns a double (MovingAverage). What am I doing wrong?


    Code:
    // Moving Averages
    double[,] MovingAverage=newdouble[3,7];
     
    // store values
    MovingAverage[0,0]=SMA(BarsArray[0],20);

    #2
    You are not accessing any of the indicators values.

    Code:
    MovingAverage[0,0]=SMA(BarsArray[0],20)[0];
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by muratb35, Today, 03:36 AM
    0 responses
    3 views
    0 likes
    Last Post muratb35  
    Started by fernlicht, Today, 02:16 AM
    2 responses
    12 views
    0 likes
    Last Post fernlicht  
    Started by fernlicht, 04-12-2021, 06:01 PM
    1 response
    29 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by memonolog, Today, 02:10 AM
    3 responses
    8 views
    0 likes
    Last Post memonolog  
    Started by orenytz, Today, 12:25 AM
    0 responses
    10 views
    0 likes
    Last Post orenytz
    by orenytz
     
    Working...
    X