Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 wzgy0920, 04-20-2024, 06:09 PM
      2 responses
      27 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, 02-22-2024, 01:11 AM
      5 responses
      32 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, 04-23-2024, 09:53 PM
      2 responses
      49 views
      0 likes
      Last Post wzgy0920  
      Started by Kensonprib, 04-28-2021, 10:11 AM
      5 responses
      193 views
      0 likes
      Last Post Hasadafa  
      Started by GussJ, 03-04-2020, 03:11 PM
      11 responses
      3,235 views
      0 likes
      Last Post xiinteractive  
      Working...
      X