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

  #241 (permalink)
 
PHXtrader's Avatar
 PHXtrader 
Boston
 
Experience: Intermediate
Platform: Jigsaw
Trading: NQ
Posts: 84 since Apr 2011
Thanks Given: 48
Thanks Received: 76

Thanks
Do I have to add the DLL file as well or just the cs file?

Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
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
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #242 (permalink)
 
madLyfe's Avatar
 madLyfe 
Des Moines, Iowa
 
Experience: None
Platform: Ninja, TOS
Broker: AMP/CQG, TOS
Trading: CL, TF, GC
Posts: 1,641 since Feb 2011
Thanks Given: 9,220
Thanks Received: 1,020


PHXtrader View Post
Thanks
Do I have to add the DLL file as well or just the cs file?

use the zip files.. uninstall the asseblies from utilities -> remove ninjascript assemblies, then restart ninja, then install the new indies zip files like you would any other new indicator..

dont believe anything you hear and only half of what you see

¯\_(ツ)_/¯

(╯°□°)╯︵ ┻━┻
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #243 (permalink)
 
PHXtrader's Avatar
 PHXtrader 
Boston
 
Experience: Intermediate
Platform: Jigsaw
Trading: NQ
Posts: 84 since Apr 2011
Thanks Given: 48
Thanks Received: 76


Thanks

I usually download these to my mac first to avoid contaminating my trading computer and then transfer to my trading computer but for some reason my mac was automatically extracting the zip file so I just downloaded it direct to my trading computer from futures.io (formerly BMT) and it worked like a charm.

Thanks Again.

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


PHXtrader View Post
Fat Tails thanks for the hard work. Trying to remove the old one and install the new one but running into some problems. Do I just use the Remove Ninja script in utiities to deleate the old one? And then to install then new one drag the cs file into the indicator folder and f5 to compile? when I downloaded it it didn't come through as a file that can be imported.

Thanks for the help.
(used to be proficient at adding new NJ scripts but haven't changed my setup in so long I think I forgot how)

@PHXtrader: Do not drag and drop any files into any folders!

Here is the correct way to do it:

(1) Remove old assembly via File -> Utilities -> Remove NinjaScript Assembly
(2) Shut NinjaTrader down and restart it.
(3) Install new file via File -> Utilities -> Import NinjaScript.

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

Here is a question from @trendisyourfriend, who has observed a specific behaviour of the VisualSMA and VisualEMA in strategy mode. Here is my answer


Strategy Mode : No lag and additional tick versus 1-bar lag and no transition tick


The indicators are designed to reduce lag on both historical and real-time data. Historical bars are "one-tick" bars, so the first tick always closes the bar. The strategy mode is optimized to be used on historical data - this includes backtesting -, so it will always close the bar with each historical tick. There is price to pay for being able to do so!

When transiting from historical to real-time data, NinjaTrader inserts an artificial last historical tick. This tick triggers the calculation of the indicator value, as the indicator does not know yet that this is last false historical tick. For that reaseon you will find one (false) additional value inserted during that (60-minute-) bar of the secondary bar series which covers the transition. This is what you observed.

After the transition, the strategy mode will collect information from the secondary (60-minute-) bar series and write it to the primary bar series, with a small lag of one tick. In the chart this translates to a lag of one bar. This is becuase the FirstTickOfBar event is needed to close the bar and to write the indicator value to the primary series.

By the way this way a design choice that I made for the strategy mode. It would have been possible to design the indicator in a way that it produces a 1 bar lag on historical data. In this case there would be no additional value inserted during the transition period.

So you either you get

-> no lag on historical data, but 1 transition bar
-> a one-bar lag on all historical data and no transition bar

The xcMovAvg for example lags 1 bar over the complete historical data. If used for backtesting this is not really the optimum.


Use One-Tick-Correction Mode


For your aplpication, you can use the 1-Tick-Repaint mode. It typically corrects that additional historical tick and weeds it out. Your chart should then display as you expect it.

Please see below tow charts, one in strategy mode with the inserted value and the 1-bar lag, and one in One-Tick-Repaint mode, which has all corrected. I have put the VisualEMA on the One-Tick-Repaint chart to show that it does not affect the collection of VisualSMAs.

Attached Thumbnails
Click image for larger version

Name:	6E 12-11 (1 Min)  10_11_2011 Strategy.jpg
Views:	304
Size:	107.9 KB
ID:	54558   Click image for larger version

Name:	6E 12-11 (1 Min)  10_11_2011 One-Tick-Correction.jpg
Views:	256
Size:	111.4 KB
ID:	54559  
Started this thread Reply With Quote
Thanked by:
  #246 (permalink)
 TradeWind 
Singapore
tw
 
Experience: Intermediate
Platform: NT7
Trading: EUR/USD CL TF
Posts: 73 since Sep 2011
Thanks Given: 80
Thanks Received: 13


Fat Tails View Post
After extensive and successful tests, I have now replaced the VisualSMA and VisualEMA in the download section with the new versions.

The indicators can be found here.




The new indicators should load a lot fast than the old ones and also use less resources in real-time. Under specific conditions the lag will be reduced as well.

There is also an added option to display the nodes, that is the first bars of the primary series after a bar of the secondary series has been completed. The nodes accomodate the indicator values calculated from the secondary bars. The distance between the nodes is interpolated.

The chart below shows an hourly EMA(20) and an hourly SMA(20) displayed on a 5-min chart.


@Fat Tails,
Just like to thank you and to inform you that my problems are shorted out.
Good Trading,
TW

Reply With Quote
Thanked by:
  #247 (permalink)
 
Rocketdog's Avatar
 Rocketdog 
Newcastle Australia
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: 6E
Posts: 60 since Jun 2011
Thanks Given: 98
Thanks Received: 62

Hi Fat Tails,

I'm using live data. Here is a screen shot.



Reply With Quote
Thanked by:
  #248 (permalink)
 
Rocketdog's Avatar
 Rocketdog 
Newcastle Australia
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: 6E
Posts: 60 since Jun 2011
Thanks Given: 98
Thanks Received: 62

Webinar Basic2 - Perry.xml

Reply With Quote
  #249 (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


Rocketdog View Post
Hi Fat Tails,

I'm using live data. Here is a screen shot.


Attachment 55106

This chart has all information eliminated.

Which of the lines is the VisualSMA, what are the settings, and what are the differences between the old and the new indicator?

Started this thread Reply With Quote
Thanked by:
  #250 (permalink)
 
Rocketdog's Avatar
 Rocketdog 
Newcastle Australia
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: 6E
Posts: 60 since Jun 2011
Thanks Given: 98
Thanks Received: 62



Fat Tails View Post
This chart has all information eliminated.

Which of the lines is the VisualSMA, what are the settings, and what are the differences between the old and the new indicator?

The Visual SMA's are in panel two, cyan and red dashed lines. The new Visual SMA MTF didn't plot as smoothly.





Reply With Quote
Thanked by:




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