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!
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
NinjaTrader
Learning C#
Collapse
X
-
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.Tags: None
-
Originally posted by DuggyLou View PostHi 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.
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.
-
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
-
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 frankthearm, Today, 09:08 AM
|
1 response
2 views
0 likes
|
Last Post Today, 09:23 AM | ||
Started by yertle, Today, 08:38 AM
|
2 responses
7 views
0 likes
|
Last Post
by yertle
Today, 09:19 AM
|
||
Started by dappa, Today, 09:18 AM
|
0 responses
2 views
0 likes
|
Last Post
by dappa
Today, 09:18 AM
|
||
Started by bill2023, Yesterday, 08:51 AM
|
4 responses
22 views
0 likes
|
Last Post
by bltdavid
Today, 09:17 AM
|
||
Started by trilliantrader, Today, 08:16 AM
|
3 responses
9 views
0 likes
|
Last Post Today, 09:17 AM |
Comment