Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Development of moving average

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

    Development of moving average

    Hello,

    Would it be possible to develop an Moving Average in NinjaTrader 7 that can change its period depending on the time interval of the chart?
    E.g. When i choose the 60 minute interval a period of 33, when i choose the 30 minute interval a period of 65 and on the 10 minute interval a period of 195? I want to build a procedure that can check the time interval and then adjust the period of the moving average.

    If so could you give me some clue where to start? I read through the Ninjascript section in the help menu, but im new to C#.

    Greetings.
    Last edited by ModularMix; 01-22-2010, 11:24 AM.

    #2
    Hello ModularMix,

    Thank you for your post.

    You should be able to do this with NinjaTrader 6.5 and 7.

    Code:
     
    if ((Bars.Period.Id == PeriodType.Minute) && (Bars.Period.Value == 60) )
    Value.Set(SMA(33)[0]);

    The snippet above will plot the 33 period simple moving average if the chart is a 60 minute chart.

    Using the Bars.Period property.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks, the code snippet you suggested worked for me.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      43 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      25 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      163 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      98 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      158 views
      2 likes
      Last Post CaptainJack  
      Working...
      X