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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      38 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      287 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      289 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      134 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      95 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X