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

      Comment

      • Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DaveCro, Today, 09:05 PM
        0 responses
        14 views
        0 likes
        Last Post DaveCro
        by DaveCro
         
        Started by magnatauren, Today, 08:26 PM
        0 responses
        7 views
        0 likes
        Last Post magnatauren  
        Started by SharonSS, Today, 07:21 PM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by bmccoard, Today, 06:48 PM
        0 responses
        12 views
        0 likes
        Last Post bmccoard  
        Started by omololu, Today, 05:10 PM
        0 responses
        16 views
        0 likes
        Last Post omololu
        by omololu
         
        Working...
        X