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

SMA of Volume

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

    SMA of Volume

    I think I asked this question once before but i have searched and I can not find it.

    Assume I have a strategy that is daytrading a single day's information based on tick price and tick volume.

    I want to add some "constants" to my strategy.

    For example, I use a Pivot Point number or two, certain medium term highs/lows, and a couple of moving averages.


    Is there a simple way, at the beginning of each trading session, for me to calculate a 10 day, 30 day, 60 day and 90 day SMA Volume? Whenever I load my day bars (index 1) as follows:

    Volumes[1][0] or Volumes [1] [1] etc...

    into the following:

    double avgVolume = SMA (Volumes[1][0], 30) [0];

    I generate the error that my IData series can not be forced into a double in this manner (is more or less what it says).


    Also, I am not sure that I have enough day bars loaded to support these calcs, and I am not sure that I want to for performance reasons.

    Thanks in advance for any advice,

    Andrew
    Last edited by alabell; 09-04-2012, 02:09 PM.

    #2
    You can use the VOL() method with the added series and then nest this inside of the SMA()

    Code:
    double avgVolume = SMA(VOL(BarsArray[1]), 30)[0];
    You can also just use the Volume Moving Average (VOLMA):

    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sdauteuil, 09-23-2021, 10:16 AM
    7 responses
    1,247 views
    0 likes
    Last Post marcus2300  
    Started by sofortune, 05-18-2024, 11:48 AM
    2 responses
    32 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by Zach55, 02-19-2024, 07:22 PM
    2 responses
    66 views
    0 likes
    Last Post lbadisa1  
    Started by JGriff5646, Yesterday, 05:47 PM
    1 response
    15 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by AlphaOptions, 06-18-2013, 08:24 AM
    9 responses
    2,203 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X