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 186,462 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

  #81 (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


gomi View Post
The indicator considers that the default session template used in the instrument manager is what defines RTH, whatever session template you use for your chart.

@gomi: That consideration is more than strange!

If you set this option, it excludes ETH data from your charts. I have not a single instrument, where the session template selected in the instrument manager is the RTH session.

For all my session related indicators, I use segmented sessions, which allow me to catch the RTH information, but to display ETH price action as well. Then, I only use charts with the session template <instrument settings>. This allows me to toggle between instruments, without the need change any indicator parameters.

For example, below is my session template for ES defined under instrument settings. The chart shows ES with the pre-session high and low and the opening range calculated by a MTF indicator. If I set the instrument session template to RTH, I will never see that pre-session range again.

Obviously this does not invalidate your concept, but is just a minor detail.

Attached Thumbnails
Click image for larger version

Name:	Session Template ES.JPG
Views:	238
Size:	46.1 KB
ID:	42987   Click image for larger version

Name:	ES 09-11 (7 Min)  08_07_2011 Opening Range.jpg
Views:	252
Size:	86.4 KB
ID:	42988  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Futures True Range Report
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
GFIs1 1 DAX trade per day journal
22 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
  #82 (permalink)
 gomi 
Paris
Market Wizard
 
Experience: None
Platform: NinjaTrader
Posts: 1,270 since Oct 2009
Thanks Given: 282
Thanks Received: 4,505


Fat Tails View Post
If you set this option, it excludes ETH data from your charts.

Actually, no, it doesn't.
The indicator uses the default instrument session defined in instrument manager as RTH, but you can use any kind of session on your chart.
For instance on, the ES, I have default instrument session set as CME RTH, but if on my chart I use 24/7 and select "use only RTH", I will see only the RTH values of the indicator, on a full ETH chart. If I don't select "use only RTH", I see whole ETH values.
Obviously it won't work if you split the whole ETH session in the default session in the instrument manager ;-)

Reply With Quote
Thanked by:
  #83 (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



gomi View Post
Actually, no, it doesn't.
The indicator uses the default instrument session defined in instrument manager as RTH, but you can use any kind of session on your chart.
For instance on, the ES, I have default instrument session set as CME RTH, but if on my chart I use 24/7 and select "use only RTH", I will see only the RTH values of the indicator, on a full ETH chart. If I don't select "use only RTH", I see whole ETH values.
Obviously it won't work if you split the whole ETH session in the default session in the instrument manager ;-)

Thank you for the explanation. So you use the Instrument.Master.Instrument.Session to collect the instrument session template. I am just thinking how to solve this.....

If I define a shadow instrument for each instrument which I trade by adding "ZZ" (ES -> ESZZ), I could define a second session template for the shadow instrument, in order to use the second template for GOMMultiTFIndicatorBase. I could then in GOMMultiTFIndicatorBase call the MasterInstrument, convert it to a "string" value, append "ZZ" to the string and then convert it back to the shadow instrument to collect the other session template.

Would this work? Ou est-ce que j'ai l'esprit trop tordu?

Started this thread Reply With Quote
  #84 (permalink)
 gomi 
Paris
Market Wizard
 
Experience: None
Platform: NinjaTrader
Posts: 1,270 since Oct 2009
Thanks Given: 282
Thanks Received: 4,505


Fat Tails View Post
Thank you for the explanation. So you use the Instrument.Master.Instrument.Session to collect the instrument session template.

Yes, that way I have 2 sessions for 1 instrument : the RTH defined by the Instrument.Master.Instrument , and the ETH defined by the chart. I thought it would be the simplest way to deal with the RTH problem.


Fat Tails View Post
Would this work? Ou est-ce que j'ai l'esprit trop tordu?

I think it would, but it really really wouldn't fit the KISS principle. So yes, I guess , you are twisted

Reply With Quote
  #85 (permalink)
 RambleDog 
Nampa, ID
 
Experience: Intermediate
Platform: TradeStation and Ninja
Broker: AMP - Zenfire
Trading: ES
Posts: 39 since Jan 2011
Thanks Given: 22
Thanks Received: 30

Hey Guys, I am trying to do something "multi time frame" that I think should be really easy, but I haven't been able to get it figured out. I use an indicator called xcMovAvg that plots a 5 minute EMA on my "other time frame" charts. Unfortunately I would like this code my indicator so that I can use Rising / Falling etc. to play other indicators off of it. To Date I have not been able to get this coded. I can't seem to figure out how to get Ninja to do it.

I thought I was onto something with a separate data series until I realized that every bar must have a value. Anyway, I know some of you have written indicators that do the same thing as the xcMovAvg, but I just can't seem to figure the method? Don't even need the code per se, just a shove in the right direction.

Thanks much.

Visit my NexusFi Trade Journal Reply With Quote
  #86 (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


RambleDog View Post
Hey Guys, I am trying to do something "multi time frame" that I think should be really easy, but I haven't been able to get it figured out. I use an indicator called xcMovAvg that plots a 5 minute EMA on my "other time frame" charts. Unfortunately I would like this code my indicator so that I can use Rising / Falling etc. to play other indicators off of it. To Date I have not been able to get this coded. I can't seem to figure out how to get Ninja to do it.

I thought I was onto something with a separate data series until I realized that every bar must have a value. Anyway, I know some of you have written indicators that do the same thing as the xcMovAvg, but I just can't seem to figure the method? Don't even need the code per se, just a shove in the right direction.

Thanks much.

The xcMovAvg often produces a step function, so it is not easy to collect information such as rising or falling MA. After all a step function is mostly flat and does not tell you whether the higher timeframe indicator rises or falls. It would be necessary to expose that information separately to access it. This means that the indicator has to be modified. At least this would be my understanding.

Started this thread Reply With Quote
  #87 (permalink)
 RambleDog 
Nampa, ID
 
Experience: Intermediate
Platform: TradeStation and Ninja
Broker: AMP - Zenfire
Trading: ES
Posts: 39 since Jan 2011
Thanks Given: 22
Thanks Received: 30

Thanks Fat Tails,

I actually found my answer on the NT support forum. I added a time period to my indicator (don't even need inputs because I am always interested in what 5 min charts are doing). Then that becomes an indexable "Bars Array." From there you just need to apply the standard EMA to the "Bars Array" and pick a time period.

It does step which is visually less than appealing, but the only way to reflect the truth of a higher time frame. To determine rising or falling I just assign my EMA values to a DataSeries and then compare the current value to one 5 bars ago (if on a 2 min time frame.

Not sure any of this would be helpful if it was tick or range charts, but it works for my 1 min chart. Now the real test is to see if it helps. Thanks Much!!

Visit my NexusFi Trade Journal Reply With Quote
  #88 (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


RambleDog View Post
Thanks Fat Tails,

I actually found my answer on the NT support forum. I added a time period to my indicator (don't even need inputs because I am always interested in what 5 min charts are doing). Then that becomes an indexable "Bars Array." From there you just need to apply the standard EMA to the "Bars Array" and pick a time period.

It does step which is visually less than appealing, but the only way to reflect the truth of a higher time frame. To determine rising or falling I just assign my EMA values to a DataSeries and then compare the current value to one 5 bars ago (if on a 2 min time frame.

Not sure any of this would be helpful if it was tick or range charts, but it works for my 1 min chart. Now the real test is to see if it helps. Thanks Much!!

For a 1min chart it should work, for a tick chart it is not so easy, as you cannot take the value 5 bars ago. The bar duration of tick bars is not constant,. But for minute bars it should work.

Started this thread Reply With Quote
  #89 (permalink)
 maxreturn 
Grand Rapids, Michigan, United States
 
Experience: Intermediate
Platform: NinjaTrader
Trading: TF, 6E
Posts: 319 since Dec 2010
Thanks Given: 264
Thanks Received: 114

Hello Fat Tails. As you know by now I use a 12 tick SBS Renko chart for longer term analysis and a 6 tick SBS Renko chart for timing the entry. One of the most useful indicators I've found for help in timing entry is the Swing Ray2 indicator (see attached) which does a terrific job of highlighting important price pivot support and resistance levels.

What I thought would be useful is to modify this indicator so that when setting up the indi on the 6 tick chart; both the rays from the 6 tick chart and 12 tick chart would print on the 6 tick chart. The lines derived from the 12 tick chart could be made thicker to indicate stronger support and resistance. Your thoughts?

Best Regards
Chuck

Attached Files
Elite Membership required to download: SwingRays.zip
Reply With Quote
  #90 (permalink)
 
davidfa's Avatar
 davidfa 
Barcelona / Spain
 
Experience: Intermediate
Platform: NT
Broker: ZenFire
Trading: CL
Posts: 118 since Feb 2010
Thanks Given: 366
Thanks Received: 148


Hello guys,
I am working on an indicator that would paint minute based bars on top of a range chart. Would also work for other combinations, but that is basically the need.
The idea is similar to @Fat Tails anaMultiPeriodCandles from where I got the plot logic.

The problem I am facing is to put the added second data series as a minute amount parameter as NT logic needs that value in the Initialize proc and it seems doesn't allow that as a parameter.

As I downloaded and had a glance to @gomi GomMultiTFIndicator, I realise that would be a nice workaround. Is there any indicator using this so as I can have it a as a sample implementation?

The code under development and image attached correspond to a version with fixed (no parameter) 5 minute bars as added dataseries.

Thanks for your work.
David

Attached Thumbnails
Click image for larger version

Name:	2011-07-28 CL 4Range with 5m bars.jpg
Views:	430
Size:	271.6 KB
ID:	45008  
Attached Files
Elite Membership required to download: N10t_BiggerTimeFrameBars.cs
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