NexusFi: Find Your Edge


Home Menu

 





HOW TO NT8, Visual Studio, Automated Deployment


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Jasonnator with 15 posts (38 thanks)
    2. looks_two sidlercom with 5 posts (0 thanks)
    3. looks_3 benJephunneh with 5 posts (0 thanks)
    4. looks_4 trendisyourfriend with 2 posts (1 thanks)
      Best Posters
    1. looks_one Jasonnator with 2.5 thanks per post
    2. looks_two addchild with 2 thanks per post
    3. looks_3 forrestang with 0.5 thanks per post
    4. looks_4 trendisyourfriend with 0.5 thanks per post
    1. trending_up 10,868 views
    2. thumb_up 43 thanks given
    3. group 21 followers
    1. forum 33 posts
    2. attach_file 5 attachments




 
Search this Thread

HOW TO NT8, Visual Studio, Automated Deployment

  #21 (permalink)
benJephunneh
Huntsville, AL
 
Posts: 13 since Feb 2022
Thanks Given: 9
Thanks Received: 5

Update:
The problem is apparently in the constructor methods of my indicators. I was copying the framework of the built-in indicator constructors (see attached for example), and doing so somehow blocks access in the VS workspace to built-in indicator methods. So if I comment out my constructor methods and save, I can literally watch the squiggly lines disappear, and the built-in indicators are immediately instantiable.

I'd really like to create invokable indicators. I don't know how to create constructor methods that NT recognizes that don't follow the built-in way of doing it. I suppose one way around this is to simply duplicate the code I want to instantiate, every time I need it in another indicator. Le ugh.

Attached Thumbnails
Click image for larger version

Name:	image_864.png
Views:	73
Size:	44.5 KB
ID:	321995  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
What broker to use for trading palladium futures
Commodities
Quantum physics & Trading dynamics
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #22 (permalink)
 
Jasonnator's Avatar
 Jasonnator 
Denver, Colorado United States
 
Experience: Intermediate
Platform: NT8 + Custom
Broker: NT Brokerage, Kinetick, IQFeed, Interactive Brokers
Trading: ES
Posts: 159 since Dec 2014
Thanks Given: 40
Thanks Received: 166

@benJephunneh,

Just reading your posts now. I agree that you are most likely having a dll reference issue. If you look at the way I did it (your problem is exactly why I did it this way), I have a "Libs" folder where I put all of the necessary NT8 dll files. Those files are then reference in the .csproj so that I can have access to all of the built in NT8 functionality including indicators, gui stuff, etc. If you don't reference these dll files, you just won't have access to the features you're wanting.

As far as the constructor issues you're having. I went at it for weeks trying to get constructors to work. I mean, C# is a high level object oriented language so constructors are where everything start, right??? Not quite so much when you're developing to NT8. There are some significant things that happen under the hood of NT8 that we can't see which is why they have exposed certain methods to use. If you're in a strategy, I believe there is an AddChartIndicator (doing this from memory so might be slightly different). There is another way which isn't documented well, or possibly not at all, which I'll link to here.

This locking on NinjaScripts object then adding your indicator to THAT collection is essentially using a constructor. Once you have your indicator in that collection, the underlying events like OnBarUpdate, OnMarketDepth, etc will fire as expected. I've tried to document this in my examples but didn't get into it on my videos since it's a fairly in depth topic.

I hope this helps.

How I develop my trading tools: How to videos
Latest: Trading hours and Mid price

Free code: GitLab repository
Started this thread Reply With Quote
  #23 (permalink)
benJephunneh
Huntsville, AL
 
Posts: 13 since Feb 2022
Thanks Given: 9
Thanks Received: 5


Thanks @Jasonnator,

I actually wanted to ask you about the copying of the NT8 system files to the Libs folder. I followed your method, but I was wondering what the difference would be in just referencing the system files where they are, natively (e.g. in c:\progra...\...rader 8\bin64, etc.). I've tried both ways, seemingly without issue. I could write a script for finding the references and adding them to the csproj file, if you want to include it in your project, if that's even a good idea.

But as far as the NT8 system files references within VS, where I have the libraries in a Libs folder, those definitely are being recognized. IntelliSense does a great job of filling in all the stuff that comes out of those libraries. My indicators build, successfully, and then load within NT8.

I'll check out AddChartIndicator and your strat you linked to (I have that in your solution folder, already, actually).

Reply With Quote
  #24 (permalink)
 
Jasonnator's Avatar
 Jasonnator 
Denver, Colorado United States
 
Experience: Intermediate
Platform: NT8 + Custom
Broker: NT Brokerage, Kinetick, IQFeed, Interactive Brokers
Trading: ES
Posts: 159 since Dec 2014
Thanks Given: 40
Thanks Received: 166

Take a look at the Copy Files project I have on my solution. This not only moves the files to the correct spots, but it also checks for versions. I think this is the most robust way to do it because NinjaTrader does update stuff from time to time and this ensures you always have to most you to date. It can also let you know whether your system is behind your referenced files. This, for me, was important because I do dev on my laptop as well when in on the road. So if you've updated your NT8 installation on your main trading machine bit not your laptop, it won't overwrite files that are the wrong version. As well as if you update from your laptop, it will let you know you need to update your main machine's NT8 installation.

That is the purpose of the unit tests I wrote. You simply run those suite of tests and in less than a second you know whether you need to update your C# soliton or your NT8 installation. The way I update the files is with that Copy Files console application. It's super simple but does all the checks I mentioned.

How I develop my trading tools: How to videos
Latest: Trading hours and Mid price

Free code: GitLab repository
Started this thread Reply With Quote
  #25 (permalink)
 
sidlercom's Avatar
 sidlercom   is a Vendor
 
Posts: 62 since Nov 2016
Thanks Given: 19
Thanks Received: 17

Hi Jasonnator, first many thanks for your great work! I'm trying to expand the folder structure, unfortunately I haven't had any success with it. Maybe you can give me a hint what I have to change or pay attention to? As an example, the indicators are stored and displayed in the default directory \Indicators. I would like to have a folder structure like for example \Indicators\Testfolder\Testfolder1. When I now create the folder, I can't find it in the namespace and in NT8 the indicators are still displayed in the default directory.

Reply With Quote
  #26 (permalink)
 
Jasonnator's Avatar
 Jasonnator 
Denver, Colorado United States
 
Experience: Intermediate
Platform: NT8 + Custom
Broker: NT Brokerage, Kinetick, IQFeed, Interactive Brokers
Trading: ES
Posts: 159 since Dec 2014
Thanks Given: 40
Thanks Received: 166

I've never had a need to nest indicators inside another folder so I've never researched it. I'm sure it can be done but for simplicity, I would recommend a naming convention which groups them together.

How I develop my trading tools: How to videos
Latest: Trading hours and Mid price

Free code: GitLab repository
Started this thread Reply With Quote
  #27 (permalink)
 
sidlercom's Avatar
 sidlercom   is a Vendor
 
Posts: 62 since Nov 2016
Thanks Given: 19
Thanks Received: 17


Jasonnator View Post
I've never had a need to nest indicators inside another folder so I've never researched it. I'm sure it can be done but for simplicity, I would recommend a naming convention which groups them together.

Unfortunately that doesn't help me at all, thanks anyway.

Sent using the NexusFi mobile app

If you have any questions about our services at Sidi Trading indicators and more, please send me a private message.
Reply With Quote
  #28 (permalink)
benJephunneh
Huntsville, AL
 
Posts: 13 since Feb 2022
Thanks Given: 9
Thanks Received: 5


sidlercom View Post
Hi Jasonnator, first many thanks for your great work! I'm trying to expand the folder structure, unfortunately I haven't had any success with it. Maybe you can give me a hint what I have to change or pay attention to? As an example, the indicators are stored and displayed in the default directory \Indicators. I would like to have a folder structure like for example \Indicators\Testfolder\Testfolder1. When I now create the folder, I can't find it in the namespace and in NT8 the indicators are still displayed in the default directory.

Is "Include in Project" not what you're looking for? You'll have to enable "Show All Files" in VS to be able to see a folder you created outside of VS, and maybe hit Refresh. Alternatively, you can right-click Indicators in the Solution Explorer and add a New Folder, which will create it for you in the directory and automatically add it to the project. Once you throw something compilable in there, it should show up in the NinjaScript Editor.

Additionally, you can name the files "Test1.BarGap.cs," "Test2.BarGap.cs," and I believe the NS Editor will present them to you in the Explorer as if they're in separate folders, Test1 and Test2.

Attached Thumbnails
Click image for larger version

Name:	image_427.png
Views:	64
Size:	59.4 KB
ID:	322143  
Reply With Quote
  #29 (permalink)
 
Jasonnator's Avatar
 Jasonnator 
Denver, Colorado United States
 
Experience: Intermediate
Platform: NT8 + Custom
Broker: NT Brokerage, Kinetick, IQFeed, Interactive Brokers
Trading: ES
Posts: 159 since Dec 2014
Thanks Given: 40
Thanks Received: 166

If I had to guess, I think NT8 would look at the actual namespaces and populate folders accordingly. I would try adding your desired folder name to the end of the built in namespace.

How I develop my trading tools: How to videos
Latest: Trading hours and Mid price

Free code: GitLab repository
Started this thread Reply With Quote
  #30 (permalink)
 
sidlercom's Avatar
 sidlercom   is a Vendor
 
Posts: 62 since Nov 2016
Thanks Given: 19
Thanks Received: 17


As it looks, it works. No Intellisense is applied, and the directory must be written by hand, besides, it is not displayed in NinjaTrader Editor, but the file in the directory can be loaded and displayed on the chart.

Reply With Quote




Last Updated on February 15, 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