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

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


Braulio View Post
I think I may have found something else...

This morning Ninja kept giving me the following error message :

09-09-2011 07:29:34 Default Connection to NinjaTrader historical market data server lost: The process cannot access the file 'C:\Users\BP\Documents\NinjaTrader 7\db\tick\6E 09-11\201109090800.Last.ntd' because it is being used by another process.

I logged on and off, restarted Ninja and it the error message kept popping up everytime I tried to connect but then I noticed something : all the windows (I have 13 chart windows open) were being updated with data (I can see the candles and all the indicators, etc) EXCEPT the charts that have VisualSMA's...they were blank. Because that got me a little suspicious, I decided to close all the charts that have VisualSMA's and restart Ninja. Now the error message is gone.
After a successful connection, I re-opened my charts with VisualSMA's and everything seems fine.

Might there be an issue with the VisualSMA's accessing tick data on these files?

The VisualSMA has a second bar series added, and that bar series will be generated from historical tick data, when the chart is opened. What possibly happened in your case is that you opened several charts - a workspace - at once, and that several of your charts tried to access the same historical data files in parallel.

This problem is linked to the internal design of NinjaTrader, in particular the synchronization of data loading for different bar series and charts. The indicator design has no impact on this. However, synchronization issues depend on the amount of data loaded. The more charts you have open, the larger the lookback periods that you have selected, the more likely it is that you will run into problems. Minute data is less likely to produce this behaviour.

NinjaTrader can do a lot of things, but it invites you to process huge amounts of data, and some of the processes can easily get stuck. The VisualSMA still has a weakness, which I need to address. If you have large holes in your historical tick or minute data (one of them, not both), then the interpolation algorithm may try to calculate over a period of weeks or months, which may kill your machine in terms of memory and CPU requirements. But this is a rare event, as it only occurs, when you try to load the indicator, without having checked your historical data.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
What is Markets Chat (markets.chat) real-time trading ro …
72 thanks
Spoo-nalysis ES e-mini futures S&P 500
55 thanks
Just another trading journal: PA, Wyckoff & Trends
28 thanks
Bigger Wins or Fewer Losses?
24 thanks
The Program
16 thanks
  #172 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,460 since Jun 2009
Thanks Given: 33,234
Thanks Received: 101,655


Braulio View Post
I think I may have found something else...

This morning Ninja kept giving me the following error message :

09-09-2011 07:29:34 Default Connection to NinjaTrader historical market data server lost: The process cannot access the file 'C:\Users\BP\Documents\NinjaTrader 7\db\tick\6E 09-11\201109090800.Last.ntd' because it is being used by another process.

No clue about VisualSMA.

But, I have seen similar problems with NinjaTrader with some anti-virus programs. I had problems with Trend Micro if I recall, and Kaspersky. In the end, I would recommend getting rid of all anti-virus programs and just use Microsoft Security Essentials, if you know better than to download viruses from the internet and emails

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #173 (permalink)
 ilikeread 
San Mateo, CA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 44 since Aug 2010
Thanks Given: 196
Thanks Received: 27


Hello,

Below was a PM between me and Fat Tails about installation error with VisualSMA. With Fat Tails' permission, I am posting here, for anyone might get the similar problem.

Key points:
1. NT7 utilities is the way to remove the assembly.
2. I was so dumb that I did not know that and only struggled with Windows to do the work.
Big thanks to Fat Tails. It works great for me.
Peter


====================================
Quoting ilikeread

Dear Fat Tails,

I would express my deep appreciation to you for your great efforts in writing countless indicator for the forum.

I have a question regarding the VisualSMA installation (the newest update version on Sep 6, and my previous version is the version of Aug 30 )

My problem in installation is similar to the post from pedrobraz in Perry’s thread ( (post #346). I followed your instruction to remove the SMA Assembly.

My understanding of the Assembly is the following four files in the Documents\NinjaTrader7\bin\Custom folder:
VisualSMAMTF.X64(DLL File)
VisualSMAMTF.X86( DLL File)
VisualSMAMTF (DLL File)
VisualSMAMTF (CS File)

With the Assembly in the folder, I did the import. Then NT7 shows: “Import failed. The NinjaScript Archive File may contain duplicate method names that already exist on your PC or there is a required file missing on either your PC or in the import archive”

Once I remove the Assembly in the folder, I did the import. Then NT7 shows. “ You have custom NinjaScript files on your PC that have programming errors. These errors must be resolved before you can import a NinjaScript Archive File.”

I also tried to do a compilation once I removed the Assembly, an error message shows: “Documents\NinjaTrader7\bin\Custom\VisualSMAMTF.DLL could not be found.” After I put the Assembly (the four files) back and did the compilation, the error message is gone.

It thus seems I have no way to correctly remove the assembly and import the new VisualSMA file.

May I get your kind help with this issue? Thank you very much! By the way, if this is useful for other forum users, I can post it as a public message. Please let me know and I can do as you suggested.


Best wishes

Peter (ilikeread)

===========================================
Quoting Fat Tails

I do not mind, if you post publicly. Some recommendations:

(1) First remove old assembly via File -> Utilities -> Remove NinjaScript Assembly

(2) Then install new assembly via File -> Utilities -> Import NinjaScript Assembly

(3) If you get the the message "You have custom NinjaScript files on your PC that have programming errors. These errors must be resolved before you can import a NinjaScript Archive File.” , this is not necessarily linked to the VisualSMA file. Could you please have a look at your logs (Control Center) or your log file (My Documents -> NinjaTrader 7 -> log -> file with today's date)

Harry

Reply With Quote
Thanked by:
  #174 (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,
Is there a chance that you can throw together a MTF for the ADX as per the attached chart. I used JeffsADX using color change when up and down.

Attached Thumbnails
Click image for larger version

Name:	ADX MultiFrame.png
Views:	307
Size:	250.6 KB
ID:	50037  
Reply With Quote
  #175 (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,
Is there a chance that you can throw together a MTF for the ADX as per the attached chart. I used JeffsADX using color change when up and down.

I have something, which is work in progress, but not yet ready for publishing. You can test it, but I do not want to distribute it now to the public.

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


Fat Tails View Post
I have something, which is work in progress, but not yet ready for publishing, You can test it, but I do not want to distribute it now to the public.

Can you send it to me via a PM and I will test it. Of course only you can publish for distribution.

Reply With Quote
  #177 (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
Can you send it to me via a PM and I will test it. Of course only you can publish for distribution.

Yes, will do so in a few days, as I still have to make a few changes. Please remind me via PM, if I forget about it.

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

I have been further digging into the NinjaTrader architecture, and the result is a simpler version of the VisualSMA and the VisualEMA. The new versions were entirely recoded from scratch and the code is about 80 lines shorter than the code of the previous versions.

Simplicity always means performance gain and robustness, so here are some of the main improvements:

-> loading time of the indicator on historical data reduced by a factor 10
-> lag of the indicators reduced
-> indicators can be safely called from other indicator or strategy

The chart below shows the 20-period EMA and 20-period SMA, both calculated from a 5 minute chart, but displayed on a 50 tick chart of the FDAX 12-11.

The new indicators are attached below. After installation you will find them as NewVisualSMA or NewVisualEMA in the dropdown menu of the indicator dialogue box. These are not the final versions, but pre-versions for testing.

Attached Thumbnails
Click image for larger version

Name:	FDAX 12-11 (50 Tick)  21_10_2011.jpg
Views:	357
Size:	81.0 KB
ID:	52796  
Attached Files
Elite Membership required to download: VisualIndicatorsTest.zip
Started this thread Reply With Quote
  #179 (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


Fat Tails View Post
I have been further digging into the NinjaTrader architecture, and the result is a simpler version of the VisualSMA and the VisualEMA. The new versions were entirely recoded from scratch and the code is about 80 lines shorter than the code of the previous versions.

Simplicity always means performance gain and robustness, so here are some of the main improvements:

-> loading time of the indicator on historical data reduced by a factor 10
-> lag of the indicators reduced
-> indicators can be safely called from other indicator or strategy

The chart below shows the 20-period EMA and 20-period SMA, both calculated from a 5 minute chart, but displayed on a 50 tick chart of the FDAX 12-11.

The new indicators are attached below. After installation you will find them as NewVisualSMA or NewVisualEMA in the dropdown menu of the indicator dialogue box. These are not the final versions, but pre-versions for testing.

will playing with these have any effect on currently installed visualSMA/EMA indies?

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

¯\_(ツ)_/¯

(╯°□°)╯︵ ┻━┻
Visit my NexusFi Trade Journal Reply With Quote
  #180 (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


In strategy mode the new version has the lag reduced by one bar - this applies to cases where the bar close of the secondary bar series matches the bar close of the primary bar series.

Chart 1 shows the new Visual SMA compared to the prior version. Chart 2 shows the new Visual SMA compared to the xcMovAvg2. The reduction of the lag was obatined without repainting, which means that the VisualSMA and the VisualEMA can be used for backtesting in strategy mode.

Attached Thumbnails
Click image for larger version

Name:	FDAX 12-11 (10 Min)  21_10_2011 Chart 1.jpg
Views:	272
Size:	96.2 KB
ID:	52798   Click image for larger version

Name:	FDAX 12-11 (10 Min)  21_10_2011 Chart 2.jpg
Views:	223
Size:	94.5 KB
ID:	52799  
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