NexusFi: Find Your Edge


Home Menu

 





Ninja 8-How to apply higher time frame MA to lower time frame.


Discussion in Traders Hideout

Updated
      Top Posters
    1. looks_one BillTrader54 with 1 posts (2 thanks)
    2. looks_two renavie with 1 posts (0 thanks)
    3. looks_3 trendisyourfriend with 1 posts (0 thanks)
    4. looks_4 Fi with 1 posts (0 thanks)
    1. trending_up 663 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 BillTrader54 
Oshkosh Wisconsin
 
Experience: Intermediate
Platform: Ninjatrader, TradeStation
Broker: NinjaTrader
Trading: Futures
Posts: 3 since Mar 2015
Thanks Given: 0
Thanks Received: 1

Ninja 8-How do I apply an indicator from a higher time frame to my chart without distorting the bar spacing on my smaller time frame chart? I change my second Data Series to OHLC and color the bars transparent and apply to panel one. This allows the higher time frame indicator to show on the lower time frame chart when choosing the higher time frame input series but spreads out the bars based on the close of the higher time frame. I have seen charts where the bar spacing stays the same but the indicator which is a MA scrunch up and conform to the lower time frame spacing. thx Bill


Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
Hormuz Completely Closed: US Strikes Day 2, Iran Shoots …
Traders Hideout
Four New E-mini Futures Launch June 29 -- Russell 3000, …
Emini and Emicro Index
Trump Media to sell instant access to market-moving soci …
Traders Hideout
Warsh Confirmed 54-45 on PPI Day -- 97% Say He Holds in …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
4 thanks
Darmok and Jalad at Tanagra
1 thanks
  #2 (permalink)
 
Fi's Avatar
 Fi 
NexusFi
 


BillTrader54 View Post
I change my second Data Series to OHLC and color the bars transparent and apply to panel one. This allows the higher time frame indicator to show on the lower time frame chart when choosing the higher time frame input series but spreads out the bars based on the close of the higher time frame.

@BillTrader54,

You're hitting a classic NT8 multi-timeframe challenge. The bar spacing issue happens because when you plot directly from the higher timeframe series, it only has values at HTF bar closes -- so the chart stretches to accommodate those intervals.

The fix is to plot the indicator values on every bar of your primary series, not just when the HTF bar closes. Here's the approach:
  • Add your HTF data series (which you've done)
  • In your indicator code, calculate the MA using the HTF series
  • Store that value in a variable
  • Plot that stored value on every primary series bar -- not just when BarsInProgress == 1

The key is your plotting logic. Instead of only updating when the HTF bar closes, you hold the last HTF value and draw it continuously across all the smaller timeframe bars. This creates that "scrunched" stair-step look you've seen on other charts.

If you're using a built-in MA indicator, you may need a custom wrapper that handles this plotting logic. Search the NT8 forums for "MTF indicator" or "multi-timeframe plot" -- there are several free indicators that handle this exact scenario.

I'm not sure which specific third-party indicators are currently maintained for NT8, but the NinjaTrader ecosystem has quite a few MTF solutions floating around.

-- Fi
"The chart shows what you tell it to show -- sometimes you just need to tell it differently."


Learn more about Fi AI trading companion
IMPORTANT: I can make mistakes! Always verify data before relying on it.

Please leave feedback here. You can disable my ability to reply to your posts by placing me on your ignore list.

Fi provides educational information on a best-effort basis only. You are responsible for your own trading decisions and for verification of all data. This message is not trading advice.
Reply With Quote
  #3 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,581 since Oct 2009
Thanks Given: 4,267
Thanks Received: 6,208


I have not tested the script but asked Gemini to try to code it:
 
Code
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.Indicators;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion

namespace NinjaTrader.NinjaScript.Indicators
{
	public class MTF_SMA_Wrapper : Indicator
	{
		private SMA smaHTF;
		private double lastHTFValue = 0;

		protected override void OnStateChange()
		{
			if (State == State.SetDefaults)
			{
				Description									= @"Plots a Higher Time Frame SMA on a Lower Time Frame chart without bar spreading or scale distortion.";
				Name										= "MTF SMA Wrapper";
				Calculate									= Calculate.OnBarClose;
				IsOverlay									= true;
				DisplayInDataBox							= true;
				DrawOnPricePanel							= true;
				PaintPriceMarkers							= true;
				ScaleJustification							= NinjaTrader.Gui.Chart.ScaleJustification.Right;
				
				// Required: Defines the plot so Value[0] can be assigned
				AddPlot(new Stroke(Brushes.Goldenrod, 2), PlotStyle.Line, "HTF SMA");
				
				Period										= 20;
			}
			else if (State == State.DataLoaded)
			{
				// Initialize the SMA using the secondary data series (BarsArray[1])
				// Ensure you have added a second Data Series to your chart.
				if (BarsArray.Length > 1)
					smaHTF = SMA(BarsArray[1], Period);
			}
		}

		protected override void OnBarUpdate()
		{
			// 1. Safety check: Ensure we have at least two data series and enough bars
			if (BarsArray.Length < 2 || CurrentBars[1] < Period)
				return;

			// 2. Logic for Higher Time Frame series (BarsInProgress 1)
			if (BarsInProgress == 1)
			{
				lastHTFValue = smaHTF[0];
			}
			
			// 3. Logic for Primary series (BarsInProgress 0)
			if (BarsInProgress == 0)
			{
				// Prevent the plot from dropping to $0.00 and ruining the chart scale
				if (lastHTFValue > 0)
				{
					Value[0] = lastHTFValue;
				}
			}
		}

		#region Properties
		[Range(1, int.MaxValue), NinjaScriptProperty]
		[Display(Name="SMA Period", GroupName="Parameters", Order=1)]
		public int Period { get; set; }
		#endregion
	}
}


Reply With Quote




Last Updated on February 7, 2026


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts