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 forrestang 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 GraDman with 1 thanks per post
    4. looks_4 trendisyourfriend with 0.5 thanks per post
    1. trending_up 10,752 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

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

Hello fellow FIO'ers,

I have been wanting to give back to the FIO community for a while and decided to start making some videos on how to get up and running creating, and more importantly, debugging indicators & strategies from within Visual Studio. This is what I hope will be the beginning of several videos showing how to not only get Visual Studio hooked up to NinjaTrader 8, but also how to create custom indicators and strategies also from within VS. I have pushed all the code used in the video to a GitLab repository which is free for anyone to use.

I welcome any feedback and questions. My target audience was someone somewhat familiar with writing/hacking through an indicator in NinjaTrader's NinjaScript Editor but looking to take their indicators and strategies to the next level by taking full advantage of the power and features of Visual Studio.

I have a lot of ideas and I'd like to see where people could use the most help so I can tailor future how to videos. I had help from a few power users early on and feel it's my time to give back some knowledge I've learned the hard way.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
Increase in trading performance by 75%
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #2 (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 meant to include the link to the code repository. All code is freely available and located on my GitLab repository.

I think next, I want to do something a little simpler (and much shorter). @GraDman started a Ninjascript help Please thread which seems perfect for covering a quick topic on NinjaTrader's SessionIterator. Thanks for the idea @GraDman and great avatar on YouTube, ha

Started this thread Reply With Quote
Thanked by:
  #3 (permalink)
GraDman
Tennessee
 
Posts: 6 since Aug 2020
Thanks Given: 9
Thanks Received: 4


Not sure if got my PM but yes please go ahead with posting SessionIterator in my thread.

Thanks
Gra

Reply With Quote
Thanked by:
  #4 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,527 since Oct 2009
Thanks Given: 4,175
Thanks Received: 6,020


Jasonnator View Post
...
I think next, I want to do something a little simpler (and much shorter). @GraDman started a Ninjascript help Please thread which seems perfect for covering a quick topic on NinjaTrader's SessionIterator. Thanks for the idea @GraDman and great avatar on YouTube, ha

Hi @Jasonnator

Thanks for the video. I am wondering about this code you posted in GraDman's thread, why do you use the "base." and "this." prefix in the OnBarUpdate? And why calling the base.OnBarUpdate(); within the OnBarUpdate()?

 
Code
private SessionIterator sessionIterator;
private DateTime sessionBegin;
private DateTime sessionEnd;

protected override void OnBarUpdate()
{
    base.OnBarUpdate();

    if (base.CurrentBars[0] < base.BarsRequiredToPlot)
    {
        return;
    }

    if (this.sessionIterator != null)
    {
        if (base.IsFirstTickOfBar && base.Bars.IsFirstBarOfSession)
        {
            if (this.sessionIterator.GetNextSession(base.Time[0], false))
            {
                this.sessionBegin = this.sessionIterator.ActualSessionBegin;
                this.sessionEnd = this.sessionIterator.ActualSessionEnd;
            }
        }
    }
}

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


trendisyourfriend View Post
Hi @Jasonnator

Thanks for the video. I am wondering about this code you posted in GraDman's thread, why do you use the "base." and "this." prefix in the OnBarUpdate? And why calling the base.OnBarUpdate(); within the OnBarUpdate()?

@trendisyourfriend,

I use those prefixes to help me learn and remember where objects are located in the hierarchy. For example, anything with "this." prefix means that it was referring to something created in that specific/actual class. I use "base." when I am referencing objects in the Indicator base class(es). This is a pure syntax organization of mine and I think anywhere I've used a "base.", you could use a "this.".

I will caveat the above with those are not static objects. Whenever I refer to a static object, I try to use the actual class that it is in. For me, this helps readability when I come back to this code months later. I know if I see something like "IndicatorExtensions.IsInSession(some time parameter)", that "IsInSession" is a static method contained in the IndicatorExtensions class.

A long version of me saying it's purely for readability. Is it knit-picky, absolutely but any C# developer will be able to actually read my code and understand how things are structured and where to find stuff easily with F12'ing all over the place.

I just finished recording a quick "feature demo" video on NT's SessionIterator that I will start editing and post later this week. You'll be able to see more examples of my explanation in that video.

edit: forgot to answer this

trendisyourfriend View Post
Hi @Jasonnator
And why calling the base.OnBarUpdate(); within the OnBarUpdate()?

This is done because of the polymorphism principle in object oriented programming. Any time you override a method or class, you should call its base "version". Constructors are like this as well as methods (and other things as well).


Jason

Started this thread Reply With Quote
  #6 (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

Actually going back and looking at the code snippet I posted, those prefixes seem super tedious. I should've mentioned how handy it becomes when you have a class that is 1500+ lines of code (easy to do in a strategy). It becomes so much more useful in that scenario to know where objects reside so you aren't constantly bouncing around (which just slows down workflow).

Jason

Started this thread Reply With Quote
Thanked by:
  #7 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,527 since Oct 2009
Thanks Given: 4,175
Thanks Received: 6,020


Jasonnator View Post
Actually going back and looking at the code snippet I posted, those prefixes seem super tedious. I should've mentioned how handy it becomes when you have a class that is 1500+ lines of code (easy to do in a strategy). It becomes so much more useful in that scenario to know where objects reside so you aren't constantly bouncing around (which just slows down workflow).

Jason

@Jasonnator

The only thing which i don't understand is the call to Base.OnBarUpdate within the OnBarUdate. At first sight, i thought it would create a recursive loop that never end. As you can see, Ninjascripting is a new pursuit of mine so i might have basic questions at times. Thanks for your time.

Reply With Quote
  #8 (permalink)
 addchild 
Bay Area California
 
Experience: None
Platform: TT T4
Broker: Phillip Capital
Trading: Futures
Posts: 809 since Nov 2011
Thanks Given: 926
Thanks Received: 898


trendisyourfriend View Post
@Jasonnator

The only thing which i don't understand is the call to Base.OnBarUpdate within the OnBarUdate. At first sight, i thought it would create a recursive loop that never end. As you can see, Ninjascripting is a new pursuit of mine so i might have basic questions at times. Thanks for your time.

It's been a long time since I looked at ninjascript but base.Method() just calls the abstract or virtual method implemented in the abstract class that you are inheriting, which is mostly likely empty, and probably even gets complied away. No worries about a stack overflow there.

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


trendisyourfriend View Post
@Jasonnator

The only thing which i don't understand is the call to Base.OnBarUpdate within the OnBarUdate. At first sight, i thought it would create a recursive loop that never end. As you can see, Ninjascripting is a new pursuit of mine so i might have basic questions at times. Thanks for your time.

Ask away! These videos are stirring up some of the exact questions I was hoping to be able to help the FIO community with.

Sent using the NexusFi mobile app

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
Thanked by:
  #10 (permalink)
 
cutzpr's Avatar
 cutzpr 
United States
 
Experience: None
Platform: TWS,Ninja Trader
Trading: Forex, Futures, Stocks
Posts: 35 since Apr 2012
Thanks Given: 10
Thanks Received: 10


Could you make some videos on how to find memory leaks inside Ninja script and profiling code.

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