Coding Multi Time Frame (MTF) Indicators with NinjaTrader - NinjaTrader | futures io social day trading
futures io futures trading


Coding Multi Time Frame (MTF) Indicators with NinjaTrader
Updated: Views / Replies:103,256 / 411
Created: by Fat Tails Attachments:161

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 161  
 
Thread Tools Search this Thread
 

Coding Multi Time Frame (MTF) Indicators with NinjaTrader

  #41 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,652 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


Zondor View Post
Tested on an 80 tick chart of YM going back 2 days. Plotted the 10 period JMA and the 10 period RSX of the 2 period 2 minute VisualEMAX4

No errors appeared in the output window. Worked fine for the PREVIOUS day, but for the CURRENT (latest) day, got a flat line for both indicators.

This is a big improvement. Looks very promising. Thanks again.

I have tested the indicator on tick charts by calling it from JMA with the settings period = 2 and 2 minutes and it works well. I currently cannot reproduce the flat line.

Could you eventually post a screenshot of the chart and the indicator settings and share the tick data you have tested it on?

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #42 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

Problem solved

My VisualEMAX was flat lining on Friday because I did not have any minute historical data for that particular day.

The historical data manager took care of that in short order, and now the VisualEMAX4 and indicators based on it are working fine when I use a low period VisualEMAX as a proxy for the price series in a different time frame.

This is an extremely valuable tool, giving insights into multiple time frames on a single chart.
It's one of the best new ideas in quite a while. Nice work, FT.

Reply With Quote
 
  #43 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,652 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary



Zondor View Post
My VisualEMAX was flat lining on Friday because I did not have any minute historical data for that particular day.

The historical data manager took care of that in short order, and now the VisualEMAX4 and indicators based on it are working fine when I use a low period VisualEMAX as a proxy for the price series in a different time frame.

This is an extremely valuable tool, giving insights into multiple time frames on a single chart.
It's one of the best new ideas in quite a while. Nice work, FT.

The innovation of the indicator is the intrapolation of datapoints for visual display. It takes into account both equidistant and non-equidistant spacing. If you use it just to be called from other indicators, the xcMovAvg, which is much simpler, should also do. It can be downloaded here:

Links and Downloads Manager - NinjaTrader Support Forum

Why would you take an obfuscated assembly, if a simple, open code indicator may suit your needs?

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #44 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,652 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary

Opening Range V34 MTFX4

This is the fourth pre-version of the multi-timeframe version of the OpeningRange indicator. I have found two minor bugs, which affected the training period of the indicator (first trading day after CurrentBar == 0).

I am relatively sure that it does now, what it is expected to do.

The indicator is a great improvement, if you use tick, volume or range charts, as the opening range will be calculated from the secondary minute bar series. It will no more rely on the primary bars, which cannot exactly provide the required information, as they may overlap with the end of the opening range.

See an example below, where the opening range cannot be calculated from the primary bar series, but can be correctly displayed, if the multi-timeframe indicator is used.

Other applications of this concept include a high resolution VWAP for larger time frames, and modified SuperTrend and MultiPeriodCandle indicators.

Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-tf-09-11-12-min-11_06_2011.jpg  
Attached Files
Register to download File Type: zip OpeningRangeV34MTFX4.zip (9.0 KB, 84 views)
Reply With Quote
The following 3 users say Thank You to Fat Tails for this post:
 
  #45 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,652 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary

Using ChartControl in OnStartUp() or OnBarUpdate()

There is quite a number of indicators, which access ChartControl in OnStartUp() or OnBarUpdate(). All these indicators
cannot be called by other indicators or strategies unless ChartControl is checked for null prior to being accessed.

With the help of NinjaTrader's support team, here is the correct way to check, whether a chart uses equidistant bars or not:

 
Code
bool equidistantbars = true;
if(ChartControl == null)
{ 
     // do something here
}
else if (ChartControl.EquidistantBars)
    equidistantBars = true;
else
    equidistantBars = false;
There is actually a number of indicators affected by this problem. If you check for the candle style of a chart, you also need to check for null first, otherwise the indicator will not run, when called by another indicator or a strategy! This is an example that I have frequently seen and used for paint bars.

 
Code
if(ChartControl == null)
{ 
   // do something here
}
else if (ChartControl.ChartStyleType == ChartStyleType.CandleStick)
{
   BarColor = Color.Transparent 
}
else
   BarColor = upColor;
All the indicators that use ChartControl without checking for null first need to be modified. This includes some of my own indicators such as the anaSuperTrend or the MACDdeLuxe2. Note that these indicators will work correctly, if applied to a chart, but they won't work (nor produce false results), if they are called.

Updated install file for VisualEMA is attached.

Attached Files
Register to download File Type: zip VisualEMAX5.zip (40.4 KB, 125 views)
Reply With Quote
The following 6 users say Thank You to Fat Tails for this post:
 
  #46 (permalink)
Elite Member
Paris
 
Futures Experience: None
Platform: NinjaTrader
 
Posts: 1,175 since Oct 2009
Thanks: 227 given, 4,092 received

Here's my contribution : a class GomMultiTFIndicator you can derive from.
This class allows you to
  • Add another time series that will be sent to your indicator for calculations
  • Use only RTH (as defined in master instrument)
  • Reset your internal data on bar, daily, weekly, monthly, quarterly and annually

You will nee to define 4 methods
  • GomInitialize : replaces Initialize method
  • GomOnReset : is called on the beginning of each new bar/day/week etc.
  • GomOnData : this is where you receive the secondary time series data and update your internal objects
  • GomOnDataDone : data sent, update your indicators here.

Here is an example of code to get simple volume (included as demo in zip)

 
Code
                            
         protected override void GomInitialize()
        {
            
Add(new Plot(Color.FromKnownColor(KnownColor.RoyalBlue), PlotStyle.Bar"Vol"));
            
Overlay                false;
        }
        
        protected 
override void GomOnReset()
        {
            
vol=0;
        }
        
        protected 
override void GomOnData(double opendouble highdouble lowdouble closeint volume)
        {
            
vol+=volume;
        }
        
        protected 
override void GomOnDataDone()
        {
            
Vol.Set(vol);
        } 
And what you get :
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Using RTH only :
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


All the indicators will inheritate these settings:
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Attached Files
Register to download File Type: zip GomMultiTFIndicator1.0.zip (3.8 KB, 135 views)
Reply With Quote
The following 12 users say Thank You to gomi for this post:
 
  #47 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,652 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


gomi View Post
Here's my contribution : a class GomMultiTFIndicator you can derive from.
This class allows you to
  • Add another time series that will be sent to your indicator for calculations
  • Use only RTH (as defined in master instrument)
  • Reset your internal data on bar, daily, weekly, monthly, quarterly and annually

You will nee to define 4 methods
  • GomInitialize : replaces Initialize method
  • GomOnReset : is called on the beginning of each new bar/day/week etc.
  • GomOnData : this is where you receive the secondary time series data and update your internal objects
  • GomOnDataDone : data sent, update your indicators here.


This looks fantastic! Will at least try to understand how it works and do some experiments.

Thank you.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #48 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

GOM MTF

Thanks Gomi, this is a wonderful contribution.

Reply With Quote
 
  #49 (permalink)
Banned: trolling
NYC + NY / USA
 
Futures Experience: Advanced
Platform: "I trade, therefore, I AM!"; Theme Song: "Atomic Dog!"
Favorite Futures: EMD, 6J, ZB
 
kronie's Avatar
 
Posts: 798 since Oct 2009
Thanks: 216 given, 498 received


gomi View Post
Here's my contribution : a class GomMultiTFIndicator you can derive from.
This class allows you to
  • Add another time series that will be sent to your indicator for calculations
  • Use only RTH (as defined in master instrument)
  • Reset your internal data on bar, daily, weekly, monthly, quarterly and annually

You will nee to define 4 methods
  • GomInitialize : replaces Initialize method
  • GomOnReset : is called on the beginning of each new bar/day/week etc.
  • GomOnData : this is where you receive the secondary time series data and update your internal objects
  • GomOnDataDone : data sent, update your indicators here.

thanks, this really holds promise for having a unified chart instead of three charts linked to inverse contracts,

hopefully I will be able to show inverse relationships,
between contracts all on one chart,
and then only have two or three main charts,
instead of a 4plex (multi monitor) confusion of charts

Reply With Quote
 
  #50 (permalink)
Elite Member
Grand Rapids, Michigan, United States
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: TF, 6E
 
Posts: 318 since Dec 2010
Thanks: 263 given, 111 received

Just Wanted To Say


A heartfelt THANKS to Fat Tails for his terrific work on MTF indicators. Also for the contributions of Zondor and others to help fine tune the indicators. I am only using VisualSMAX3 right now on the TF and it has made a dramatic improvement in my ability to read what's happening in the market and consequently, my bottom line. Thanks guys. HUGH ROCK!

Kindest Regards
Chuck

Reply With Quote

Reply



futures io > > > > Coding Multi Time Frame (MTF) Indicators with NinjaTrader

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi Time Frame Strategy Cancellation jthom NinjaTrader Programming 2 October 9th, 2014 12:00 PM
Close bar recognization in multi time frame strategy pinto552 NinjaTrader Programming 6 September 6th, 2011 10:07 AM
Multi-time frame strategy with periods of different size pequemec NinjaTrader Programming 2 February 24th, 2010 01:41 PM
visual multi-time frame scoring system. benbrooke Traders Hideout 1 October 4th, 2009 06:49 PM
Multi Volume/Time Frame Trading wh The Elite Circle 7 September 15th, 2009 05:55 PM


All times are GMT -4. The time now is 01:03 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-13 in 0.15 seconds with 20 queries on phoenix via your IP 54.82.79.109