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,278 / 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

  #121 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,352 given, 83,230 received


Fat Tails View Post
Have modified the indicator code to include 1-tick repainting in VisualMode and FirstTickMode for other bar types than fixed period bars.

The 1-tick repainting will be activated, when

-> the primary bar series and the secondary bar series called by the indicator use the same bar type
-> the closing time of the primary and secondary candles is identical
-> VisualMode or FirstTickMode is selected

In StrategyMode nothing will be repainted, but the result of the calculation from the secondary bar series will only be used for the next bar of the primary bars.

Update notifications sent.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #122 (permalink)
Elite Member
Portugal
 
Futures Experience: Beginner
Platform: Ninjatrader, Multicharts
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: ES, 6E
 
Braulio's Avatar
 
Posts: 230 since Aug 2009
Thanks: 404 given, 216 received

Possible problem

Fat Tails,

I'm using the latest version of the anaVisualSMA and today I noticed the following on my charts :

You can see on the attached pictures that the first one(TRADE#8) was taken yesterday while I was trading, and the second one was taken at the exact same spot today(after shutting down my computer and closing ninja).

The VisualSMA's look different but everything else is in place.

Thanks.

B

Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-trade-8.jpg.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-capture.jpg  
Reply With Quote
The following user says Thank You to Braulio for this post:
 
  #123 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary



Braulio View Post
Fat Tails,

I'm using the latest version of the anaVisualSMA and today I noticed the following on my charts :

You can see on the attached pictures that the first one(TRADE#8) was taken yesterday while I was trading, and the second one was taken at the exact same spot today(after shutting down my computer and closing ninja).

The VisualSMA's look different but everything else is in place.

Thanks.

B

On the charts

-> it is not clear which are the VisualSMAs
-> you have hidden all indicator settings, which makes it impossible to analyze any problem

Please, if you post a chart next time, make sure that the indicator settings are visible and that the indicators are labeled.

Reply With Quote
 
  #124 (permalink)
Elite Member
Portugal
 
Futures Experience: Beginner
Platform: Ninjatrader, Multicharts
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: ES, 6E
 
Braulio's Avatar
 
Posts: 230 since Aug 2009
Thanks: 404 given, 216 received

Sorry about that...here goes.

I've also attached the template I used.

Thanks.


Fat Tails View Post
On the charts

-> it is not clear which are the VisualSMAs
-> you have hidden all indicator settings, which makes it impossible to analyze any problem

Please, if you post a chart next time, make sure that the indicator settings are visible and that the indicators are labeled.


Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-capture.jpg  
Attached Files
Register to download File Type: xml TESTING.xml (37.8 KB, 8 views)
Reply With Quote
The following user says Thank You to Braulio for this post:
 
  #125 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


Braulio View Post
Sorry about that...here goes.

I've also attached the template I used.

Thanks.

I have checked it and not found a problem so far. If you use multi-timeframe indicators, range charts are quite particular. For minute, tick and volume charts, you can find the higher time-frame bars by combining two of them. For example two 5-minute bars will make up for one 10-minute bar, three 233-tick bars will make up for one 699-tick bar etc. However, for range bars this relationship does not hold. In a sideways moving market it may well take 10 or 15 4-range bars to produce an 8-range bar, and the typical price of the current 8-range bar remains constant.

The template abuses the VisualSMA to find the typical price of a secondary bar series. Honestly this is nonsense. It takes a few minutes to code an indicator, which displays the typical price of the a secondary and tertiary bar series. No need to use a complex indicator with interpolation algorithms. But of course the VisualSMA(1) will give you the close, if you apply it to the close, or the typical price, if you apply it to the typical price.


If you want to check the values of the VisualSMA, this is what you can do:

Just for testing, add two new DataSeries to your chart, one with 8-range bars and another one with 10-range bars. Then apply a SMA(Typical, 1) to each of the DataSeries. The values shown should be identical with the values displayed by the VisualSMA in visual mode. If they are not, something is wrong.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #126 (permalink)
Elite Member
Portugal
 
Futures Experience: Beginner
Platform: Ninjatrader, Multicharts
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: ES, 6E
 
Braulio's Avatar
 
Posts: 230 since Aug 2009
Thanks: 404 given, 216 received

Thank you for the explanation and honest comments.

I've attached 3 more trades where the VisualEMA's do not match the before and after restarting Ninja.

I've also noticed that they normally match my trades before 01:30PM(GMT) before big news came out. See the pic I've attached called 'Going Crazy', the EMA's are completely off, am I right? Are they plotting correctly there?

I followed you suggestion on the last pic and yes, they seem to plot at the exact same place on both dataseries, but if you don't mind me saying (you're the expert here)... that doesn't mean there isn't a problem and I believe there is, we just haven't figured out how to find it. There has to be an explanation for the difference we see on the charts!

Here's what I think might be causing this:
1. From your explanation I understood that range bars are quite particular and not as linear as minute or tick. So although the plotting of the VisualSMA may seem OK now, in real-time things might be different.
2. Or yesterday was a special day right at 01:30PM, where the market went bezerk and messed everything up. I would sure like to have a picture right at that time for before/after comparison of the VisualSMA's.

There's one other thing we can try : run market replay and see what happens.

But from what I understood and please correct me if I'm wrong, you created these VisualSMA and VisualEMA indicators primarily not for equal dataseries and same bar types like 8range+10range but different ones like 8range+5min or 377tick+5min, am I right?

Also, if I'm not asking for too much (and I understand if I am) would you point me in the right direction about coding what you've mentioned? something that displays the typical price of the a secondary and tertiary bar series? I have some coding experience and with your help I could try making a simpler version. I tried a while ago to code a MTF indicator but as soon as I added a secondary dataseries I didn't know how the reference both in the code.

Thank you.

B


Fat Tails View Post
I have checked it and not found a problem so far. If you use multi-timeframe indicators, range charts are quite particular. For minute, tick and volume charts, you can find the higher time-frame bars by combining two of them. For example two 5-minute bars will make up for one 10-minute bar, three 233-tick bars will make up for one 699-tick bar etc. However, for range bars this relationship does not hold. In a sideways moving market it may well take 10 or 15 4-range bars to produce an 8-range bar, and the typical price of the current 8-range bar remains constant.

The template abuses the VisualSMA to find the typical price of a secondary bar series. Honestly this is nonsense. It takes a few minutes to code an indicator, which displays the typical price of the a secondary and tertiary bar series. No need to use a complex indicator with interpolation algorithms. But of course the VisualSMA(1) will give you the close, if you apply it to the close, or the typical price, if you apply it to the typical price.


If you want to check the values of the VisualSMA, this is what you can do:

Just for testing, add two new DataSeries to your chart, one with 8-range bars and another one with 10-range bars. Then apply a SMA(Typical, 1) to each of the DataSeries. The values shown should be identical with the values displayed by the VisualSMA in visual mode. If they are not, something is wrong.


Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-trade-4.jpg.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-trade-4_after.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-trade-5.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-trade-5_after.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-trade-6.jpg.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-trade-6_after.jpg.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-going-crazy.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-data-series.jpg  
Reply With Quote
The following user says Thank You to Braulio for this post:
 
  #127 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


Braulio View Post
Thank you for the explanation and honest comments.

I've attached 3 more trades where the VisualEMA's do not match the before and after restarting Ninja.

I've also noticed that they normally match my trades before 01:30PM(GMT) before big news came out. See the pic I've attached called 'Going Crazy', the EMA's are completely off, am I right? Are they plotting correctly there?

I followed you suggestion on the last pic and yes, they seem to plot at the exact same place on both dataseries, but if you don't mind me saying (you're the expert here)... that doesn't mean there isn't a problem and I believe there is, we just haven't figured out how to find it. There has to be an explanation for the difference we see on the charts!

@Braulio: Lots of details, I would be interested to discuss this via Skype. The multi-timeframe indicators are sensitive to the use of real-time versus historical data, and the results may also depend on the session template used.

Looking at your charts in detail: Chart 1, 3, 5 and 7 do not show indicator settings. The indicators are probably calculated from real-time data. The indicator values do not look correct, but again, I cannot check the settings.

The charts 2, 4, 6, and 8 look about right. In particular chart 8 confirms that the VisualSMA displays correct values on historical data. The SMA on the lower panel is set to CalculateOnBarClose = true, which explains that the last swing is missing.

So if there is a problem with the indicator, the problem only occurs on real-time data. I can only check this, when the market is open, and then the easiest way to do it would be to run the template of chart 8 and compare the visual appearance of the VisualSMA and the SMA, which is directly applied to an 8-range chart.


Braulio View Post
Here's what I think might be causing this:
1. From your explanation I understood that range bars are quite particular and not as linear as minute or tick. So although the plotting of the VisualSMA may seem OK now, in real-time things might be different.
2. Or yesterday was a special day right at 01:30PM, where the market went bezerk and messed everything up. I would sure like to have a picture right at that time for before/after comparison of the VisualSMA's.

1. This is not specifically related to range bars. If there is a problem, it occurs with real-time data only and will affect various bar types.

2. Do not know.


Braulio View Post
There's one other thing we can try : run market replay and see what happens.

But from what I understood and please correct me if I'm wrong, you created these VisualSMA and VisualEMA indicators primarily not for equal dataseries and same bar types like 8range+10range but different ones like 8range+5min or 377tick+5min, am I right?

Market replay makes sense. Try to run the VisualSMA and the SMA on an 8-range chart in parallel with market replay. The market replay will use real-time data, so that should reproduce the problem.

The indicators can be used for equal dataseries and different dataseries. For equal dataseries I have another, simpler indicator, which can be used instead.


Braulio View Post
Also, if I'm not asking for too much (and I understand if I am) would you point me in the right direction about coding what you've mentioned? something that displays the typical price of the a secondary and tertiary bar series? I have some coding experience and with your help I could try making a simpler version. I tried a while ago to code a MTF indicator but as soon as I added a secondary dataseries I didn't know how the reference both in the code.

Will come back with a separate post.

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


Braulio View Post
Also, if I'm not asking for too much (and I understand if I am) would you point me in the right direction about coding what you've mentioned? something that displays the typical price of the a secondary and tertiary bar series? I have some coding experience and with your help I could try making a simpler version. I tried a while ago to code a MTF indicator but as soon as I added a secondary dataseries I didn't know how the reference both in the code.

MTF indicators are not easy to understand. First of all, the VisualSMA repaints in VisualMode or FirstTickMode. In only repaints the unstable period, exactly as the SMA does which is directly applied to the 8-range or 10-range bar series. The unstable period covers all 4-range bars, which fall into the time period of the last incomplete 8-range bar. If the market moves sideways, this can be quite a lot.

So if you want to base any strategy on the VisualSMA, you should only use it in StrategyMode. In StategyMode it does not repaint but only uses the indicator value retrieved from the secondary bar series, once the secondary bar has closed. This introduces a lag of one bar.

The repainting in VisualMode only affects the time period from the second but the last (closed) bar of the secondary bars and the last (incomplete) bar of the secondary bars. The repainted values are calculated by two interpolation algorithms, one for equidistant and another one for non-equidistant bar spacing.

If you just want to use the typical price, why the hell would you want to run a multi-timeframe SMA that uses interpolation algorithms?

I have attached a simple indicator that I have coded for one of the other followers of Perry's method. It just shows how you can calculate your arrows by directly using the typical price from the secondary bars to get your entry conditions. Note that the real-time data is not identical with historical data. Historical range bars are 1-tick-bars, real-time data is made up of multi-tick bars. Multi-tick bars can trigger arrows intrabar, which will disappear again once the bar has closed.

The indicator attached draws an arrow up, if the three following conditions are met

(a) the typical price (also known as SMA(Typical,1)) has crossed above the SMA(Typical,3)
(b) the typical price of an 8-range bar is greater than the typical price of the previous 8-range bar
(c) the typical price of a 10-range bar is greater than the typical price of the previous 10-range bar

Down arrows follow a similar logic.

Attached Files
Register to download File Type: zip CrossingArrowsMTF.zip (5.8 KB, 111 views)
Reply With Quote
The following 13 users say Thank You to Fat Tails for this post:
 
  #129 (permalink)
Membership Permanently Revoked
hartford
 
Futures Experience: Intermediate
Platform: nt
Favorite Futures: cl
 
Posts: 52 since Jun 2011
Thanks: 54 given, 5 received

dont know what you just said Fat brains,but I will throw it on my charts and see if it sticks!

Reply With Quote
 
  #130 (permalink)
Elite Member
Portugal
 
Futures Experience: Beginner
Platform: Ninjatrader, Multicharts
Broker/Data: Amp Futures/Zen-Fire
Favorite Futures: ES, 6E
 
Braulio's Avatar
 
Posts: 230 since Aug 2009
Thanks: 404 given, 216 received


Charts 1,3,5 are pictures from real-time data.
Charts 2,4,6 with "_After" are historical while disconnected from my datafeed (today).
The settings are the same on all charts from the template I posted.

I also believe the problem only occurs in real-time.

Is the CrossingArrowsMTF the simpler indicator you talk about?
I don't wanna be a party spoiler but I've already identified a situation where the CrossingArrowsMTF should be plotting a down arrow but there isn't one...yes, I'm that fast... see the pic, I also attached the template.

Awesome! I cannot thank you enough for this.

P.S. - will PM my skype ID.

B

EDIT : wait! I just read the conditions....on the attached pic that means only when the Typical(8) is BELOW Typical (10) will the arrow plot? That's why we don't see an arrow on the chart, am I right? If so, we need to change it and add this condition...

EDIT2 : forget the previous edit....that's not true...I just looked at the code and it should be drawing an arrow....

Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-capture.jpg  
Attached Files
Register to download File Type: xml TESTING.xml (41.5 KB, 12 views)

Last edited by Braulio; September 3rd, 2011 at 04:16 PM.
Reply With Quote
The following user says Thank You to Braulio for this post:

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 12:36 AM.

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.18 seconds with 20 queries on phoenix via your IP 54.221.93.187