Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Daily SMA on Intraday Chart

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

    Daily SMA on Intraday Chart

    In ThinkOrSwim I can have daily simple moving averages displayed on my intraday charts. Their code looks like this.

    input price = FundamentalType.CLOSE;
    input aggregationPeriod = AggregationPeriod.DAY;
    input period_SMA20 = 20;
    input period_SMA50 = 50;
    input period_SMA100 = 100;
    input period_SMA200 = 200;
    input displace = 0;
    input averageType = AverageType.SIMPLE;
    plot SMA_20 = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod), period_SMA20);
    plot SMA_50 = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod),period_SMA50);
    plot SMA_100 = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod),period_SMA100);
    plot SMA_200 = MovingAverage(averageType, Fundamental(price, period = aggregationPeriod),period_SMA200);

    Is there a way for NinjaTrader to display daily moving averages on the intraday charts?

    Thanks
    doug_p

    #2
    Hello,

    Yes, this is possible.

    It would be easy to do through the user interface itself. Please see the following video on how to add multiple data series to a chart and calcualte an indicator from the added data series:



    It would also be possible using custom programming to have indicator display this information as well. I'd suggest reviewing our Help Guide article on Multi-Time Frame Indicators for information on how this would be done:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Hello!
      How can we do the same thing, but coding in strategy script?
      Thanks a lot!

      Comment


        #4
        Hi Vvu1980,

        You can add multiple data series by using the Add() function with NinjsScript.
        http://www.ninjatrader.com/support/h....html?add3.htm

        Additionally, please take a look the link below on how to use multiple time frames with NinjaScript and how that data is referenced.
        http://www.ninjatrader.com/support/h...nstruments.htm

        Let me know if I can be of further assistance.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Can you help me more exactly!?
          For example, this sentence corect for adding 120-min KAMA chart to 30-min main chart?

          KAMA PlotC = KAMA(BarsArray[2], 2, periodKAMA, 30);
          Add(new Plot(Color.Green, "PlotC"));

          Comment


            #6
            Hi Vvu1980,

            You add the 120 minute time frame from the initialize section of the code
            Code:
            protected override void Initialize()
            {
            			Add("AAPL", PeriodType.Minute, 120); // BarsArray [1]
                                    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "KAMALine"));
            }
            Then you can add the KAMA to the new plot using the BarsArray[1]
            Code:
            private override void OnBarUpdate()
            {
                  KAMALine.Set(KAMA(BarsArray[1], 2, periodKAMA, 30));
            
            }
            You will also need to add a properties code for the plot data series

            Code:
            #region Properties
                    [Browsable(false)]	
                    [XmlIgnore()]		
                    public DataSeries KAMALine
                    {
                        get { return Values[0]; }
                    }
            #endregion
            Cal H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            599 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            345 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            558 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            558 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X