Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving averages for multi instrument indicators

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

    Moving averages for multi instrument indicators

    I would like to create a Weighted moving average of the weighted price for a multi instrument indicator.

    But for some reason NJ does not let me create the WMA, from the weighted prices. Gives me an error that states

    "The best overloaded method match for NinjaTrader.Indicator.Indicator.WMA(NinjaTrader.Da ta.IDataSeries, int)' has some invalid arguments" &
    "Argument '1': cannot convert from 'double' "

    Ive added the second data series like so
    PHP Code:
    Add("$EURUSD",BarsPeriod.Id,BarsPeriod.Value); // Dataseries 1 
    
    Since it wont let me reference the weighted prices directly when I first added the data series, I get the weighted prices using method below.
    PHP Code:
    Weighteds[1][0]; 
    
    When I tried to feed the weighted prices to the WMA

    PHP Code:
    int Fast=5;
    WMA(Weighteds[1][0],Fast); 
    
    I get the error stated above.

    I don't think I can use BarsArray like below because I specifically want to use the weighted prices of the secondary instruments,

    PHP Code:
    WMA(BarsArray[1], Fast)[0]) 
    
    Do I need to create yet another data series just to hold the all the weighted prices for each added instrument data series. That would created double the number of dataseries and there just seems to be a better way or I am doing something wrong.
    Last edited by cutzpr; 02-02-2014, 06:43 AM.

    #2
    Forget it, I found the answer,

    You have to use this syntax instead
    PHP Code:
    WMA(Weighteds[1],5)[0]; 
    

    Comment


      #3
      Hello cutzpr,

      Thank you for your post and the update on this matter.

      This is the correct method to access the price data such as Typicals and Weigtheds.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X