How To Build A Ninja Indicator - coding / programming - NinjaTrader Programming | futures io social day trading
futures io futures trading


How To Build A Ninja Indicator - coding / programming
Updated: Views / Replies:6,839 / 3
Created: by hondo69 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

How To Build A Ninja Indicator - coding / programming

  #1 (permalink)
Elite Member
Austin, TX
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Currencies
 
hondo69's Avatar
 
Posts: 165 since Jun 2009
Thanks: 57 given, 240 received

How To Build A Ninja Indicator - coding / programming

Afraid of coding? - me too. Don't know what you're doing? - me neither. Don't let that stop you, it's not as hard as you think to develop a useful indicator. And its fun as well. Just follow this quick start guide.

Step 1 - Poke Around
Go to: Tools -> Edit Ninja Script -> Indicator

Find an indicator you've already downloaded and are familiar with. Open it up and look around. You'll quickly get a feel for the different "sections" of code. Then simply close that window and open another indicator and look at its sections of code. If you happen to open one with lots of code just close it and find one with only a little code. It will be easier to start with a simple code that you can borrow from later.

Step 2 - Roll Your Own
Once you've located a really simple indicator prepare to tweak it to see what happens. Start by opening the code and immediately right clicking within the code and select "save as". This is where you'll give your indicator it's own name (no spaces). Once saved you can edit or even delete this new indicator without worries of damaging some existing code.

Step 3 - Tweak Time
Tweak the existing code ever so slightly. Then you'll need to take 2 steps before you can see it live. Start by (a) saving the code by clicking the save button, then (b) click the compile button to build the final code. Now you can open the indicator in a chart to see how your changes behave. Then just rinse and repeat until you're happy.

Step 4 - Steal Code
The Ninja help file has some good code examples but falls short on explanations. They assume you already have a working knowledge of coding and often create more questions than answers. But the Ninja platform comes with some good example indicators that you can open and they have both good code and explanations of each section.

You can also borrow code from indicators posted on the Ninja forum and Big Mike's forum. Just be careful not to use code someone wants to keep private.

Another method is to go into the strategy analyzer and click on some things you'd like to see. Then click the "view code" button. It will open up the code itself without hurting the base file. Once you see the code you can copy and paste to see what happens.

NOTES
Start with an indicator that is close to what you want to accomplish. The changes you'll need to make should be minor. But more importantly, all the "extras" you'll need are already in place.

These extras include thing like variables, data series, etc. that are a little tricky to set up for a first timer. By editing an indicator that is pretty close to what you want already you won't have to worry about the extras for now.

If the indicator performs several tasks at once like drawing dots and drawing a moving average don't worry if you only want the drawing dots part. It's OK to have extra code. You can "hide" the moving average part of it or even delete it if you feel brave. Just save the indicator as different versions along the way so you can always go back to a previous version when you make a mistake. And you'll make plenty. So get in the practice of adding a "version" to your file naming process.

Save the file as JoeV1 before any editing. Do a little editing then save as JoeV2. Keep saving as a new file as you edit and you'll be glad you did later since you'll surely box yourself into a corner sooner or later. Don't make the mistake of making a change then hitting the save button until you're sure. You can't "undo" after you've saved the file.

After you've made a few "easy" indicators you'll want to step up the complexity a bit. This gets a bit more heavy duty and I won't go into details here. The point is to dive in and poke around. You'll be surprised how easy it is to create something worthwhile.

Reply With Quote
The following 18 users say Thank You to hondo69 for this post:
 
  #2 (permalink)
Elite Member
Arcata, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: index futures, oil
 
Saroj's Avatar
 
Posts: 482 since Jun 2009
Thanks: 223 given, 389 received

Thanks, hondo... nice write-up... I added to the sticky post on coding tips and tricks

Reply With Quote
 
  #3 (permalink)
Elite Member
Newark, New Jersey, USA
 
Futures Experience: Beginner
Platform: NinjaTrader, ToS
Favorite Futures: 6E, ES
 
Posts: 6 since Sep 2010
Thanks: 21 given, 0 received


This is good stuff for a ninjascript beginner like me. I appreciate it.

Reply With Quote
 
  #4 (permalink)
Elite Member
Chicago, IL/USA
 
Futures Experience: Intermediate
Platform: Ninja Trader
Broker/Data: AMP Trading - CQG/ThinkorSwim
Favorite Futures: Futures
 
gretzkyless's Avatar
 
Posts: 29 since Jan 2013
Thanks: 11 given, 14 received

Saroj:

Not sure if you have included this in one of your links, but Mike did a great job showing how to create a strategy from scratch. I have included the link below.

https://futures.io/ninjatrader/2512-video-tutorial-how-create-advanced-ninjatrader-strategy.html

I have watched this many times to get a refresher on points when creating a strategy. Any help like this is great. Thanks.

Plan your trade and trade your plan.
Reply With Quote
The following 2 users say Thank You to gretzkyless for this post:

Reply



futures io > > > > > How To Build A Ninja Indicator - coding / programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Programming (programming without coding) LukeGeniol Platforms and Indicators 11 September 16th, 2016 01:49 PM
Ninja Programming - Useful Links Saroj NinjaTrader Programming 5 August 18th, 2011 05:09 PM
Ninja script - learning code + programming alias NinjaTrader Programming 20 May 11th, 2011 06:01 AM
Programming errors while importing Ninja script emini_Holy_Grail NinjaTrader Programming 8 May 20th, 2010 04:09 AM
Start programming / coding iwannatoscript NinjaTrader Programming 13 September 15th, 2009 12:42 PM


All times are GMT -4. The time now is 10:52 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-11 in 0.11 seconds with 19 queries on phoenix via your IP 54.145.16.43