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

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

Issue With Strategy Mode

Hello Fat Tails. Yesterday afternoon I noticed that the visual SMA in strategy mode repainted plots a couple of times when I hit the f5 key. This morning I decided to watch the behavior of this indicator in both visual and strategy mode. I selected two times at random, took a before picture, then hit f5, then took an after picture. The indicator in visual mode seems to be working fine but in both instances, the plots in strategy mode changed. I've attached the before and after pictures. The first instance = before1 and after1. Second instance = before2 and after2.

Best Regards
Chuck

Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-before1.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-after1.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-before2.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-after2.jpg  
Reply With Quote
 
  #302 (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

Same Issue With One Tick Correction Mode

Picture before hitting f5 key and after in one tick correction mode. Same issue as with strategy mode.

Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-otcbefore.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-otcafter.jpg  
Reply With Quote
 
  #303 (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,602 received
Forum Reputation: Legendary



maxreturn View Post
Hello Fat Tails. Yesterday afternoon I noticed that the visual SMA in strategy mode repainted plots a couple of times when I hit the f5 key. This morning I decided to watch the behavior of this indicator in both visual and strategy mode. I selected two times at random, took a before picture, then hit f5, then took an after picture. The indicator in visual mode seems to be working fine but in both instances, the plots in strategy mode changed. I've attached the before and after pictures. The first instance = before1 and after1. Second instance = before2 and after2.

Best Regards
Chuck

The critical point is the transition from historical to real-time data, i.e. the moment you open or reload the chart. If you press F5 you replace real-time data with historical data. Also you shift the hybrid bar - the bar which NinjaTrader builds from historical and real-time ticks to the right.

If you observe differences after pressing F5, there can be three reasons:

(1) With F5 you replace real-time data with historical data. Historical bars are built from 1 tick, while real-time bars are built from many ticks, as many ticks as were observed during the bar period. For historical data bars that have the same time stamps will be aligned, while for real-time data this may be different. The NinjaTrader timestamps have a 1-second resolution. On historical data you lose sub-second information.

(2) NinjaTrader is event driven. As historical data is built from 1 tick, you know that the bar is complete, when this 1 tick is detected. This means that you can perform the indicator calculations with every tick and display the values on the chart. Real-time bars are built from many ticks. Although it would be theoretically possible for some bar types to count the ticks or the volume, you will not know for all bar types, when they are completed.

-> for minute bars you will have to wait for the first tick of the next minute to be able to perform calculations for the previous minute bar
-> for range bars you have to wait that the range is exceeded to calculate the value for the previous range bar

This means that you have a 1-tick delay on real-time data, which is due to the inherent logic of some bar types or NinjaTrader architecture, which is event driven.

When you press F5 in some cases the lag created by real-time data can be reduced an the indicator may show 1 tick earlier on historical data.

(3) Your observation relates to the hybrid bar. When you press F5 NinjaTrader inserts an artificial historical tick and then completes the bar with real-time ticks. This additional historical tick "irritates" the multi-timeframe indicator and it inserts an additional "node", which can be seen on the chart.

Once you press F5 the additional "node" will disappear, and eventually the lag will be reduced a little.

Conclusion:

You just need to accept that at the intersection of historical and real-time data there is a little "node", where the indicator deviates from its real value. If you do not press F5 all the time, this interface between historical and real-time data moves away and leaves the chart on the left side.

Example attached.

Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-transition-chart.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-historical-chart.jpg  
Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #304 (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,602 received
Forum Reputation: Legendary


maxreturn View Post
Picture before hitting f5 key and after in one tick correction mode. Same issue as with strategy mode.

Referring to my previous post:

In one-tick-correction mode, the indicator will not be affected by the issues (1) and (2) as it is allowed to repaint one tick and can therefore compensate the lag on real-time data.

The issue(3) related to the transition bar remains, although I tried to reduce the impact of the artificial historical tick inserted. Your charts do not show a significant deviation except for the last bar, which is difficult to judge as it is incomplete.

In general the indicator should not change values when used in one-tick-correction or visual mode, maybe with the exception of the transition bar between historical and real-time data.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #305 (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

Another One Tick Correction Example

Hello Fat Tails. Thanks for the quick response. I figured that this was due to Ninja Trader limitations. I'm not a programmer but I think I understand the meat of what you were trying to tell me. If I understand you correctly this little aberration will correct itself once the next node appears?

I've attached another example of a recent before and after picture using the one tick correction mode. As you can see this difference is more dramatic. From where I am sitting it just appears that if one is depending on this indicator to trade real time, the only reliable mode is the visual mode.

Best Regards
Chuck

Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-otcbefore.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-otcafter.jpg  
Reply With Quote
 
  #306 (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,602 received
Forum Reputation: Legendary


maxreturn View Post
Hello Fat Tails. Thanks for the quick response. I figured that this was due to Ninja Trader limitations. I'm not a programmer but I think I understand the meat of what you were trying to tell me. If I understand you correctly this little aberration will correct itself once the next node appears?

I've attached another example of a recent before and after picture using the one tick correction mode. As you can see this difference is more dramatic. From where I am sitting it just appears that if one is depending on this indicator to trade real time, the only reliable mode is the visual mode.

Best Regards
Chuck

Maybe it is related to the way Renko bars are built. This can induce an additional lag. Personally I would not try to calculate moving averages from range or Renko bars, as you cannot really know how NinjaTrader builds them. If you use SMA from minute, tick or volume bars and apply them to other chart types you should be fine.

For example I have made tests calling the indicator, when it was loading range or Renko bars. There were huge errors, so you cannot call the indicator when these bar types are selected. The next version will take that into account as well.

By the way, if they are errors from retrieving a value for the hybrid bar, this error should correct itself over 3 secondary bars, as you have selected a bar period of 3.

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #307 (permalink)
Elite Member
Des Moines Iowa United States
 
Futures Experience: Intermediate
Platform: NT Ensign MT4
Favorite Futures: drums
 
Posts: 120 since Sep 2010
Thanks: 12,179 given, 36 received


Fat Tails View Post
Maybe it is related to the way Renko bars are built. This can induce an additional lag. Personally I would not try to calculate moving averages from range or Renko bars, as you cannot really know how NinjaTrader builds them. If you use SMA from minute, tick or volume bars and apply them to other chart types you should be fine.

For example I have made tests calling the indicator, when it was loading range or Renko bars. There were huge errors, so you cannot call the indicator when these bar types are selected. The next version will take that into account as well.

By the way, if they are errors from retrieving a value for the hybrid bar, this error should correct itself over 3 secondary bars, as you have selected a bar period of 3.

Hi Fat Tails,

Can you please help me understand ... lag and errors can occur when a SMA is from or applied to range or Renko bars? If the SMA is from minute, tick or volume bars and applied to a range or Renko, would one still experience possible lag and errors?

Thank you for your time.

Reply With Quote
 
  #308 (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,602 received
Forum Reputation: Legendary


rdtw View Post
Hi Fat Tails,

Can you please help me understand ... lag and errors can occur when a SMA is from or applied to range or Renko bars? If the SMA is from minute, tick or volume bars and applied to a range or Renko, would one still experience possible lag and errors?

Thank you for your time.

Any SMA lags by itself. That was not your question.

If you have a multi-timeframe indicator, it calculates an indicator values from a secondary bar series and this indicator value is only displayed when the next bar of the primary series closes. For simplicity, let us imagine a 2-min and a 3-min bar series. The 3-min bar series is used to calculate the indicator value. The result is then transferred to the 2-min bar series, which is visible on the chart for display.

Now imagine a common bar close at the full hour (60 can be divided by 2 and 3), for example at 8:00 AM. Then the next indicator value from the 3 minute bar series will be available at 8:03 AM. But there is no 2-minute bar closing at 8:03 AM, so this result will be transferred to the 8:04 bar of the visible bar series. The display of the result therefore lags by 1 minute.

When you plot an indicator from a different timeframe on your chart, you have the choice between

-> adding a secondary bar series to your chart (1)
-> adding a multi-timeframe indicator to your chart (2)

(1) will create no additional lag, but may cause non-equidistant bar spacing
(2) will maintain equidistant bar spacing, but create an additional lag

You simply can't have it all!

Due to the architecture of NinjaTrader the indicator may temporarily deviate a bit at the intersection of historical and real-time data. But this is just one point on your chart, i.e the moment when you connect. The VisualSMA and VisualEMA let you identify this point via the color of the nodes, as each node will show whether it is a historical or a real-time node.

Otherwise it is best to calculate the VisualSMA from minute, tick or volume charts. This is particularly true if you want to access the indicator in strategy mode from within a strategy.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #309 (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

MTF SMA With Bands

Hello Fat Tails. I'm hoping you can add this request to your "to do" list. For a while now I have been experimenting with Zach's Multi MA Price Channel on a 12 tick renko chart (see image1). I'm not necessarily interested in all the ma types but would simply like to have a "MTF Visual SMA With Bands" indicator using the parameters and plots in image2.
Thanks for your consideration.

Best Regards
Chuck

Attached Thumbnails
Coding Multi Time Frame (MTF) Indicators with NinjaTrader-image1.jpg   Coding Multi Time Frame (MTF) Indicators with NinjaTrader-image2.jpg  
Reply With Quote
The following user says Thank You to maxreturn for this post:
 
  #310 (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,602 received
Forum Reputation: Legendary



maxreturn View Post
Hello Fat Tails. I'm hoping you can add this request to your "to do" list. For a while now I have been experimenting with Zach's Multi MA Price Channel on a 12 tick renko chart (see image1). I'm not necessarily interested in all the ma types but would simply like to have a "MTF Visual SMA With Bands" indicator using the parameters and plots in image2.
Thanks for your consideration.

Best Regards
Chuck

Actually this would not be too difficult to do, but I still have too many other construction sites.

The easiest approach would be to make the VisualSMA callable. I actually have a version that can be called by another indicator. The only problem is the repainting of the distance between the last value and the prior node. So if the indicator is called by another indicator

-> the calling indicator needs to repaint synchronously with the VisualSMA, to do so a parameter needs to be transmitted specifying the number of bars being repainted
-> calling the VisualSMA will only work, if the latter loads minute, tick or volume bars (not possible to call it when it loads range or Renko bars), this is due to the NinjaTrader architecture

Sorry, I still need to update a lot of other indicators as well.

Reply With Quote
The following 2 users say Thank You to Fat Tails 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 09:14 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-16 in 0.22 seconds with 20 queries on phoenix via your IP 54.83.122.227