• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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, 05: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.
      Patrick H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Vps by stooby
      Started by stooby, Today, 08:32 PM
      0 responses
      11 views
      0 likes
      Last Post stooby
      by stooby
       
      Started by FaaastEddy, Today, 08:25 PM
      0 responses
      3 views
      0 likes
      Last Post FaaastEddy  
      Started by YevhenShynkarenko, Yesterday, 01:22 AM
      2 responses
      39 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by testingsarasa, 05-20-2018, 02:50 PM
      11 responses
      736 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by martyn73, Today, 05:27 PM
      2 responses
      10 views
      0 likes
      Last Post martyn73  
      Working...
      X