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,741 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

  #111 (permalink)
 
Fu510n's Avatar
 Fu510n 
Suffield, CT
 
Experience: Advanced
Platform: MC, TS, Python, Rust
Broker: IB, IQFeed, TS, Kraken
Trading: ES, NQ, RTY, YM, CL, RB, 6E
Frequency: Several times daily
Duration: Seconds
Posts: 144 since Oct 2009
Thanks Given: 902
Thanks Received: 143


Fat Tails View Post
The code is specifically adapted to the architecture of NinjaTrader and will possibly not run on MultiCharts. Some of the key points are the session management and the way NinjaTrader handles non-equidistant spacing. I think that the logic of this needs to modified for MultiCharts, so I cannot be of a great help.

No worries - it will give me (yet) another MC7 challenge .

Kudos for the NT versions though - nice piece of work!

Cheers

Follow me on Twitter Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #112 (permalink)
 
perryg's Avatar
 perryg 
Rechovot
 
Experience: Advanced
Platform: NinjaTrader
Broker: CQG
Trading: Index,Currency and Energy futures
Posts: 1,644 since Jan 2010
Thanks Given: 508
Thanks Received: 6,288

Hello @Fat Tails,

Have just updated the latest VisualSMAMTF which is now "anavisualsma". In the previous version I changed the "DATA" input series to TYPICAL. In this new version you have a seperate Price type for the Data Input for the indicator. If I put both of these input data to TYPICAL I get a different output line for the SMA as opposed to putting only one of them to typical. Which is the correct way of using this indicator now.

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



perryg View Post
Hello @ Fat Tails,

Have just updated the latest VisualSMAMTF which is now "anavisualsma". In the previous version I changed the "DATA" input series to TYPICAL. In this new version you have a seperate Price type for the Data Input for the indicator. If I put both of these input data to TYPICAL I get a different output line for the SMA as opposed to putting only one of them to typical. Which is the correct way of using this indicator now.

Changing the primary data input series to "Typical" does not have any impact on the outcome. The indicator values are calculated from a secondary bar series, so the settings for the primary bar series are simply ignored.

The new option effectively allows you to calculate the values from the typical price of the secondary bar series.

Started this thread Reply With Quote
  #114 (permalink)
 HighDesertTrader 
Albuquerque, New Mexico/USA
 
Experience: Intermediate
Platform: NinjaTrader-Continuum(Mirus)
Trading: emini Currency and Index Futures
Posts: 104 since Jan 2011
Thanks Given: 291
Thanks Received: 108

Hello @Fat Tails,
I have a question about the anaVisualSMA. Please refer to the two charts attached. On the first chart, I have an SMA of period 1 and an anaVisualSMA(8R, 1), which as I understand it, is an SMA of period 1 on an 8R chart, but transformed onto the 4R chart. I was thinking, perhaps erroneously, that if there is consistency in this transport, then if I substitute 4R for the 8R in the anaVisualSMA, then I should get an SMA of period 1 on the 4R chart that is identical with the SMA(1) that is already there. However, as you can see on Chart #2, it produces an SMA of period 1 that is shifted forward in time by one 4R bar. Am I suffering from flawed reasoning here and is my lack of complete understanding of this MTF/Higher Time Frame Transport process the problem? Thanks for your help.

Attached Thumbnails
Click image for larger version

Name:	6E 09-11 (4 Range)  8_22_2011 (2).jpg
Views:	270
Size:	119.2 KB
ID:	47846   Click image for larger version

Name:	6E 09-11 (4 Range)  8_22_2011.jpg
Views:	222
Size:	124.1 KB
ID:	47847  
Reply With Quote
Thanked by:
  #115 (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,103


gpquigley View Post
Hello @ Fat Tails,
I have a question about the anaVisualSMA. Please refer to the two charts attached. On the first chart, I have an SMA of period 1 and an anaVisualSMA(8R, 1), which as I understand it, is an SMA of period 1 on an 8R chart, but transformed onto the 4R chart. I was thinking, perhaps erroneously, that if there is consistency in this transport, then if I substitute 4R for the 8R in the anaVisualSMA, then I should get an SMA of period 1 on the 4R chart that is identical with the SMA(1) that is already there. However, as you can see on Chart #2, it produces an SMA of period 1 that is shifted forward in time by one 4R bar. Am I suffering from flawed reasoning here and is my lack of complete understanding of this MTF/Higher Time Frame Transport process the problem? Thanks for your help.

Your observation is correct.

The chart shows a lag of 1 bar, which is due to the fact that OnBarUpdate() calls the primary bar series, which is shown on the chart, first and the secondary bars only afterwards. This means that the values calculated from the secondary bars cannot be used for the current bar of the primary bar series, but only the following one.

This only creates a problem, if the primary and secondary bars have identical time stamps.

The only remedy to compensate this, is to repaint the previous indicator value, once the first tick of the next bar has been registered. I have already used the 1-tick repainting for fixed period bars in both VisualMode and FirstTickMode of the indicator, such that the indicator compensates for the one-bar delay. Maybe I should do this for range and tick bars as well.

Let me check it and come back later.

Started this thread Reply With Quote
Thanked by:
  #116 (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,103

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.

The updated indicators can be found here:



Started this thread Reply With Quote
Thanked by:
  #117 (permalink)
 HighDesertTrader 
Albuquerque, New Mexico/USA
 
Experience: Intermediate
Platform: NinjaTrader-Continuum(Mirus)
Trading: emini Currency and Index Futures
Posts: 104 since Jan 2011
Thanks Given: 291
Thanks Received: 108


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.

The updated indicators can be found here:



@Fat Tails:
Thanks for the update. I am not having any luck installing these into Ninja Trader (v. 64-bit 7.0.1000.7). I am getting the attached error message.

Attached Thumbnails
Click image for larger version

Name:	Snagit1.png
Views:	201
Size:	9.7 KB
ID:	47877  
Reply With Quote
Thanked by:
  #118 (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,103


gpquigley View Post
@ Fat Tails:
Thanks for the update. I am not having any luck installing these into Ninja Trader (v. 64-bit 7.0.1000.7). I am getting the attached error message.

Sorry, this is probably my fault. I had played around with the Traders Insight Indicator, which requires the Dundas gauge. Then I had forgotten to uninstall it. I also had another assembly installed, when I had exported the indicators and they could only be installed on your machine, if both other assemblies were installed as well.

My mistake.

I have exported the two indicators a second time and replaced the files in the download section. Please try again.

Started this thread Reply With Quote
Thanked by:
  #119 (permalink)
 HighDesertTrader 
Albuquerque, New Mexico/USA
 
Experience: Intermediate
Platform: NinjaTrader-Continuum(Mirus)
Trading: emini Currency and Index Futures
Posts: 104 since Jan 2011
Thanks Given: 291
Thanks Received: 108


Fat Tails View Post
Sorry, this is probably my fault. I had played around with the Traders Insight Indicator, which requires the Dundas gauge. Then I had forgotten to uninstall it. I also had another assembly installed, when I had exported the indicators and they could only be installed on your machine, if both other assemblies were installed as well.

My mistake.

I have exported the two indicators again and replaced the files in the download section. Please try again.


Hello @Fat Tails,
All is working fine. Thanks again for the update. I appreciate you taking your valuable time to get this out so fast.

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



gpquigley View Post
Hello @ Fat Tails,
All is working fine. Thanks again for the update. I appreciate you taking your valuable time to get this out so fast.

Thanks again for your qualified comment, which allowed me to improve the indicator.

Started this thread 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