Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Learning C#

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Learning C#

    Hi I'm learning C#.. Also I'm new to strategies in ninjatrader. I was trying to trace or debug my strategy by printing out some outputs. But under a function using "Protected Override Void" it would not allow a simple insertion of the command Console.WriteLine("Test"); etc.. I changed the function to "private void" It allowed the change but would not bring up the command window when it was run. Also I've noticed in the strategies I've looked at they use the "if ... else" notation. Can one use "for, while and do" etc in strategies? Are strategies in ninjatrader fully functional in C# or have they been downgraded? Thanks for your help.

    #2
    Originally posted by DuggyLou View Post
    Hi I'm learning C#.. Also I'm new to strategies in ninjatrader. I was trying to trace or debug my strategy by printing out some outputs. But under a function using "Protected Override Void" it would not allow a simple insertion of the command Console.WriteLine("Test"); etc.. I changed the function to "private void" It allowed the change but would not bring up the command window when it was run. Also I've noticed in the strategies I've looked at they use the "if ... else" notation. Can one use "for, while and do" etc in strategies? Are strategies in ninjatrader fully functional in C# or have they been downgraded? Thanks for your help.
    A few thoughts,

    1. Case is extremely important in C#. To type or specify "Protected Override Void", in this forum or anywhere else C# is spoken, is a newbie mistake and just wrong. Each of these words must be lowercase.

    2. NinjaTrader strategies do not run as console programs, so using Console.WriteLine() does not work. This is on purpose. Think of indicators and strategies as plugins, not programs. These plugins are written in C# and are executed by the Windows program (not console program) called NinjaTrader.exe. Think of NinjaScript as a class library helping you write these plugins.

    3. Everywhere you want to use Console.WriteLine() use Print() instead. Print() is a method supplied by the NinjaScript framework.

    4. To see the output of Print() open an output window using Tools -> OutputWindow from the Control Center.

    5. All NinjaTrader indicators and strategies can use the full power of the .NET C# language. This includes anything in the core C# language, such as for loops, while loops, etc. NinjaTrader has not neutered or downgraded C# in any way.

    6. Keep these URLs bookmarked for ease of reference:

    Last edited by bltdavid; 11-06-2016, 11:20 AM.

    Comment


      #3
      Thanks for clearing those things up.

      Comment


        #4
        Hello DuggyLou, and welcome to the forums and to NinjaScript!

        If you would like to take on learning NinjaScript, we have a fully documented help guide which will help you get started. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.
        a link to our help guide can be found below





        If, like me, you learn well from video, this video introducing the NinjaScript editor is an excellent resource,


        Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.NinjaTrader 7 is an award winning end to end online ...



        You will find reference samples online as well as some tips and tricks for both indicators and strategies:




        These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.


        There is a also a growing library of user submitted custom indicators (100+) and strategies that can be downloaded from our support form. Please look in the NinjaScript file sharing section of our support forum as you may find what you are looking for there:





        Finally, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          All those references are very helpful. Study time! Thanks Jessica.

          Comment


            #6
            Learning C#

            C# is easy to learn by going through little interactive texts and exam. Learning about various topics like arrays, method, functions and OOPs concepts.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by xiinteractive, 04-09-2024, 08:08 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by Johnny Santiago, 10-11-2019, 09:21 AM
            95 responses
            6,193 views
            0 likes
            Last Post xiinteractive  
            Started by Irukandji, Today, 09:34 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by RubenCazorla, Today, 09:07 AM
            1 response
            6 views
            0 likes
            Last Post RubenCazorla  
            Started by TraderBCL, Today, 04:38 AM
            3 responses
            26 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X