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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X