NexusFi: Find Your Edge


Home Menu

 





Coding Multi Time Frame (MTF) Indicators with NinjaTrader


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 180 posts (562 thanks)
    2. looks_two Zondor with 19 posts (29 thanks)
    3. looks_3 madLyfe with 16 posts (10 thanks)
    4. looks_4 BankRobberNT with 14 posts (16 thanks)
      Best Posters
    1. looks_one gomi with 3.7 thanks per post
    2. looks_two Fat Tails with 3.1 thanks per post
    3. looks_3 Zondor with 1.5 thanks per post
    4. looks_4 BankRobberNT with 1.1 thanks per post
    1. trending_up 189,095 views
    2. thumb_up 743 thanks given
    3. group 87 followers
    1. forum 424 posts
    2. attach_file 166 attachments




 
Search this Thread

Coding Multi Time Frame (MTF) Indicators with NinjaTrader

  #411 (permalink)
 bltdavid 
San Jose, CA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Posts: 112 since Dec 2013
Thanks Given: 35
Thanks Received: 103


teee View Post
Is there a way to achieve having different time periods of Daily EMA/SMAs on same chart?

Add the indicator multiple times.

For example, if you want 2 different VisualEMA's on the chart, just right click and add the indicator (again), just like you did when adding the first indicator.

Update the 2nd VisualEMA parameters as desired ... all "duplicate" indicators & parameters are kept separate, and display separately on the chart, as you would expect.

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
36 thanks
Spoo-nalysis ES e-mini futures S&P 500
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #412 (permalink)
 
teee's Avatar
 teee 
Sydney Australia
 
Experience: Beginner
Platform: CQG,NinjaTrader
Trading: Oil, ES, Bund, Currencies
Posts: 47 since Nov 2014
Thanks Given: 134
Thanks Received: 103


Fat Tails View Post
You can set the VisualEMA / VisualSMA to 1440 min, and it will display a daily SMA or EMA.

In that case SMA or EMA will be calculated from the last traded prices as per session template.

Thank you! Shouldve thought of that

Visit my NexusFi Trade Journal Reply With Quote
  #413 (permalink)
 Bjorn P 
Nykobing Mors
 
Experience: Intermediate
Platform: Ninjatrader
Trading: NQ DAX
Posts: 3 since Jul 2017
Thanks Given: 0
Thanks Received: 0


Hi

Is there a way to add UniRenko Bars as secondary Bartype?
I want to add UniRenko T5R15O5

Reply With Quote
  #414 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


Bjorn P View Post
Hi

Is there a way to add UniRenko Bars as secondary Bartype?
I want to add UniRenko T5R15O5


Why would you wish to calculate indicator values from UniRenkoBars?

Renko bars do not show real price action but have a fake open, and mostly false highs or lows.

Also they have a complex structure that often leads to valse values when calling them.

I have already exposed some of these problems in this thread.

Therefore I will definitely not add this as an option, because it will likely create technical problems.


But again, what do you need that for?

Which bar type do you wish to use for calculations and which bar type would you like to use for displaying the result?

Maybe there is another solution.

Started this thread Reply With Quote
  #415 (permalink)
 Bjorn P 
Nykobing Mors
 
Experience: Intermediate
Platform: Ninjatrader
Trading: NQ DAX
Posts: 3 since Jul 2017
Thanks Given: 0
Thanks Received: 0


Fat Tails View Post
Why would you wish to calculate indicator values from UniRenkoBars?

Renko bars do not show real price action but have a fake open, and mostly false highs or lows.

Also they have a complex structure that often leads to valse values when calling them.

I have already exposed some of these problems in this thread.

Therefore I will definitely not add this as an option, because it will likely create technical problems.


But again, what do you need that for?

Which bar type do you wish to use for calculations and which bar type would you like to use for displaying the result?

Maybe there is another solution.

I trade on a 2-6-2 RenkoChart and want to add EMAs from 4-12-4 to my Indicator.
So I can have only one chart on my screen
Here I have it on TickChart 233 to display both Tick 233 and 699


Reply With Quote
  #416 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


Bjorn P View Post
I trade on a 2-6-2 RenkoChart and want to add EMAs from 4-12-4 to my Indicator.
So I can have only one chart on my screen
Here I have it on TickChart 233 to display both Tick 233 and 699



In that case there is an easy approximation that you can use.

Simply add a second EMA to your chart and quadruple the period. For example, if you wish to display an EMA(20) calculated from 4-12-4 Unirenko Charts, you may simply add an EMA(80) calculated from the chart bars.

Why do I suggest to use a factor 4?

On a minute chart or a tick chart, when doubling the chart period, you may simply double the indicator period instead. For example if you want to use an hourly EMA(20) on a 30 minute chart, you may simply use an EMA(40) on the 30 minute chart. Although this EMA(40) is not identical with the hourly EMA(20), it comes close enough. This approach does not work with all types of moving averages, but it works very well with SMAs and EMAs, as long as you apply them to time-based charts (daily, minute, second chart), tick charts and volume charts.

With range or renko bars this approach does not work, because 2 smaller range or renko bars will not make up for a larger range or renko bar, which is due to the overlap. However, you may use the rule that ranges are approximately proportional to the square root of time. Applying this rule means that you need to take approximately four bars to construct a "double period" range or Renko bar. Although this method is not at all exact, it is good for all practical purposes, if you wish to use a higher time frame trend.

Also a larger period EMA applied to the primary bars is much more robust than a complex multi-timeframe calculation. The CPU load is considerably reduced by chosing the way of simplicity.

So this is your solution: Simply apply an EMA to your 2-6-2 Renko bars and quadruple the indicator period. The resulting higher timeframe EMA comes close to your EMA calculated from 4-12-4 Renko bars and will be fit for all purposes.

Started this thread Reply With Quote
Thanked by:
  #417 (permalink)
 Bjorn P 
Nykobing Mors
 
Experience: Intermediate
Platform: Ninjatrader
Trading: NQ DAX
Posts: 3 since Jul 2017
Thanks Given: 0
Thanks Received: 0


Fat Tails View Post
In that case there is an easy approximation that you can use.

Simply add a second EMA to your chart and quadruple the period. For example, if you wish to display an EMA(20) calculated from 4-12-4 Unirenko Charts, you may simply add an EMA(80) calculated from the chart bars.

Why do I suggest to use a factor 4?

On a minute chart or a tick chart, when doubling the chart period, you may simply double the indicator period instead. For example if you want to use an hourly EMA(20) on a 30 minute chart, you may simply use an EMA(40) on the 30 minute chart. Although this EMA(40) is not identical with the hourly EMA(20), it comes close enough. This approach does not work with all types of moving averages, but it works very well with SMAs and EMAs, as long as you apply them to time-based charts (daily, minute, second chart), tick charts and volume charts.

With range or renko bars this approach does not work, because 2 smaller range or renko bars will not make up for a larger range or renko bar, which is due to the overlap. However, you may use the rule that ranges are approximately proportional to the square root of time. Applying this rule means that you need to take approximately four bars to construct a "double period" range or Renko bar. Although this method is not at all exact, it is good for all practical purposes, if you wish to use a higher time frame trend.

Also a larger period EMA applied to the primary bars is much more robust than a complex multi-timeframe calculation. The CPU load is considerably reduced by chosing the way of simplicity.

So this is your solution: Simply apply an EMA to your 2-6-2 Renko bars and quadruple the indicator period. The resulting higher timeframe EMA comes close to your EMA calculated from 4-12-4 Renko bars and will be fit for all purposes.

Thanks I will try that

Reply With Quote
  #418 (permalink)
 nxfradar 
HK + HK
 
Experience: Beginner
Platform: NinjaTrader 8
Trading: futures
Posts: 13 since Mar 2017
Thanks Given: 7
Thanks Received: 4

First of all, I would like to Thank You for all the Indicators, your valuable knowledge to solve all User queries & this helpful Platform.

I have got many of my queries solved by searching through the posts where you shared your knowledge and explained ways to achieve the results.


I have a query for TSSupertrend Indicator for Ninjatrader 8 and would like to see same output results in amaSuperTrendU11 in Ninjatrader 8.
Can you please help me out to achieve similar results in amaSuperTrend11 / basically I want to replicate TSSupertrend results in amaSuperTrendU11


I tried a lot with parameters but I am not getting similar results.
Many a times - amaSuperTrendU11 is always 2-4 bars behind in showing results similar to TSSupertrend.




Right now using the following parameters in TSSupertrend:
Supertrend mode : ATR
Period : 14
Multiplier : 3.2
Moving Average Type : HMA
Smooth : 14


Parameters Tried in amaSuperTrendU11 to get results // output similar to TSSupertrend:
Baseline Smoothing : HMA / tried other options
Offset formula : True_Range
Offset Smoothing : Wilder / trid other options
Baseline Period : 14 / tried from 5 to 15
Offset period : 14 tried from 10 to 15
Offset multiplier : 3.2 / tried from 2.5 to 3.2





========================



Fat Tails View Post
I am still relying on NinjaTrader to code my indicators and have recently played around with adding secondary bar series to indicators, so I just want to share my experience and show what currently can be done and what can't be done.

Of course I hope that others will share their experience as well, allowing to better exploit the full potential that lies within this option which has recently been introduced with NinjaTrader 7.

With the first post I just want to summarize, what I have in mind, and what potential improvements can be made.


Increasing the Resolution of Indicators

Some indicators do not show correct values, because the information required to calculate them is not contained with the primary bar series. By adding a secondary high definition bar series, the indicators can be improved. There are three of them that come to my mind immediately.

The current session's VWAP:

If you calculate the volume weighted average price for a 30 min bar series, there is only one value after 30 minutes which could be the typical or any other price calculated from Open, High, Low and Close. It is obvious that this value will be far from reality and that the calculated value will be false. It would be much better to calculate the VWAP from a secondary 1 minute bar series, which would reduce the error to a minimum for all practical purposes.

The opening range indicator:

If you read "The Logical Trader" by Mark Fisher, you will not that he suggests an opening range of 20 minutes for ES. How can you display this range on a 15 min chart? The answer is: You can't. Unless you calculate the opening range from a secondary 1 min data bar series.

Volume profiles:

Let us assume that you want to display a market profile for the current session on a 17 minute chart by using one of the volume zones indicators (such as the dValueArea indicator). The problem which you will encounter here: You cannot calculate 30 min TPOs from 17 minute data. Also you cannot calculate any mode for the volume distribution of the current session from 17 min data, but you need higher resolution data. This again would be a case for a multi time frame indicator.


Displaying Higher Time Frame Signals on Your Chart

This is practically the opposite of the first way to use a secondary bar series. It is technically impossible to display smaller time frame signals on any chart, as the resolution of the chart, that is the grid defined by the visible bar series does not allow it. This limits the use of smaller bar series to cases, where more precision is needed to display some of the more complex indicators. Also smaller time frame traders can be considered as noise traders, so I am rather interested in what the larger time frame traders are doing.

Some of the indicators that are used are already MTF indicators as they tell us something about the actions of the other time frame traders. These indicators use reference points outside the visible fraction of the chart. So although indicator values are mostly calculated from price, and just represent a reduced version of price, it is their time frame transfer capability that makes them interesting for the trader.

Existing indicators include market profile, daily, weekly and monthly pivots, average daily range, fibonacci confluence indicators, which all add some information from the more distant past.

But now, with adding data series, anything should be possible. Moving averages, oscillators, divergence indicators, actually the whole set of NinjaTrader default indicators as a MTF version allowing you to calculate them on a 60 min bar series, but display the results on a 157 tick or 6 range chart.

However, there is a number of traps, which have to be avoided, when creating such indicators. My intention is to document some of those traps with a simple multi time frame EMA. I also want to release a modified version of the SuperTrend indicator.


Reply With Quote
Thanked by:
  #419 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


kashyapjdave View Post
First of all, I would like to Thank You for all the Indicators, your valuable knowledge to solve all User queries & this helpful Platform.

I have got many of my queries solved by searching through the posts where you shared your knowledge and explained ways to achieve the results.


[B]I have a query for TSSupertrend Indicator for Ninjatrader 8 and would like to see same output results in amaSuperTrendU11 in Ninjatrader 8.

@kashyapjdave: Please post your questions in an appropriate thread. This thread is about multi-timeframe indicators that use data from higher timeframe bars. The SuperTrend has nothing to do with coding multi-timeframe indicators.

Please search for "anaSuperTrend", and you will easily find a few threads that match the subject.

I have therefore taken the liberty to answer your question in a different place. You will find my answer here:


Started this thread Reply With Quote
Thanked by:
  #420 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MNQ
Frequency: Daily
Duration: Minutes
Posts: 559 since Mar 2011
Thanks Given: 1,434
Thanks Received: 581


Hi @Fat Tails

do you consider to convert your VisualEMA and VisualSMA to NT8.

Missing does 2 a lot

Thanks
Michael

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on April 19, 2022


© 2024 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 - Privacy Policy - Downloads - Top
no new posts