• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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:
    http://ninjatrader.com/support/helpGuides/nt7/
    http://ninjatrader.com/support/helpGuides/nt8/en-us/
    Last edited by bltdavid; 11-06-2016, 10: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


        https://ninjatrader.com/support/help..._resources.htm


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


        https://www.youtube.com/watch?v=K8v_...56536A44DD7105


        You will find reference samples online as well as some tips and tricks for both indicators and strategies:
        http://www.ninjatrader.com/support/f...splay.php?f=30
        http://www.ninjatrader.com/support/f...ead.php?t=3229


        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:


        http://www.ninjatrader.com/support/f...splay.php?f=37


        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.
        http://ninjatrader.com/support/helpG..._reference.htm
        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 escobar63, Yesterday, 05:06 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by Brutus, Today, 06:00 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by phesi, Today, 03:36 AM
            2 responses
            5 views
            0 likes
            Last Post phesi
            by phesi
             
            Started by Guru73, Today, 01:35 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Marco  
            Started by Maxwell123, Today, 12:34 AM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_ChrisSch  
            Working...
            X