Chapter 3. How I got started in Ninjatrader programming.


My engineer background gave me the opportunity to code in different areas. My very first time doing a code was working as 3D designer where there were lots of repetitive tasks. Looking for save me time, I found the word “macros” and started to code to do this task in a single click. This is the beginning of my career as a programmer that I will tell you about in this post.

NinjaScript Editor

Coming back to Ninjatrader, in that moment I was able to run the strategy in a simulated account, but it was a manual process and my engineer mind though again there was a different way to do it. A computer respects the trading rules better than me and faster. Simple research was enough to see the world of scripts in Ninjatrader. There is an environment inside that allow you to create your own indicators and strategies. You just have to go to New/NinjaScript Editor. Once you are inside, you can start writing your first lines of code and that was what I did. However, it was not a simple task du to there were hundred of functions that I haven’t see before such as EnterLong(). As I didn’t understand the majority of the code I went to the examples, compiled  the EMACrosses strategy and run it on my chart. I was excited because I was running my first automated strategy. After some seconds, the chart showed my the trades thatstrategy took, they were not very good but I was focus on thinking how to build my millionaire strategy.

HelpGuide as fellow traveler

To build my strategy I had to learn about all this functions that are used in NinjaScript so first thing I did was going to the HelpGuide of Ninjatrader and save this page as bookmark. All you need to code is in this web, it is not a tutorial, but you have examples for any function. Furthermore, there is a forum where you can ask any question and support team answer quickly. After learn main functions I went to my blank code and start coding my millionaire strategy. I don’t remember the exactly time it took me, maybe one or two weeks but after this time I was running my strategy and I was ready to do my first big backtesting. I went to Strategy Analyzer and loaded my strategy, selected 1 year and run. After some minutes, results were there. I didn’t understand all the results in the output but the strategy earnd some money after one year (including commissions, strategy is unprofitable). You can imagine I was very happy but as I was a beginner I had no the confidence so I decide to ask in the “Robin Hood” forum about my results and told the world I had coded the strategy.

First customers

After this post in the forum, lots of people asked my about the strategy and they wanted to pay me for the script. I was afraid to send the strategy to other people because they could sell my software so I decide to check if someone could pay me before send the strategy. I create a very simple website where I explained that this script was the millionaire strategy of our “Robin Hood” showed the results of one year (insufficient time) and a button to ask the price. Of course, I did a new post to share with the community but what was my surprise..after 30 minutes there was a post a accusing me to take me of wanting to benefit financially from a Robin Hood’s strategy. I understood how trading community is and deleted all my posts, I didn’t want to continue being part of this community. Moreover, lots of people said me that the backtest was not complete due to there were no time enough so I started to check it.

My last post

Indeed the community was right my backtest was not complete but I have discovered a way to create automated strategies and I my mind understood that maybe someone was intereseint gin develop his own script and I could help them that’s why I decided to write my last post where I offered myself to code scripts for free. Of course, in less than 2 minutes I had several proposal that I will tell you in the next post.

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat
I'm waiting to CHAT with YOU.