NinjaScript Coding - NinjaTrader Programming | futures io social day trading
futures io futures trading


NinjaScript Coding
Updated: Views / Replies:5,083 / 19
Created: by crazyhorse2393 Attachments:1

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
 1  
 
Thread Tools Search this Thread
 

NinjaScript Coding

  #11 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received


crazyhorse2393 View Post
Hi,

I'm new to this forum but would like to ask a question that maybe you all could help me with. I've been trading on but mostly off for the last 5 years. I recently got back into it and have been working on a semi-automated strategy with a programmer in Australia. I've been very satisfied with his work and his rates.

Here's the thing. I have no background or skill in programming so I would be starting from 0. Realistically speaking, what would be required in order for me to become a competent but not expert programmer. By that I mean writing code that accomplishes what I am intending. I have a feeling that my current situation makes the most sense when I look at it from a time investment/reward scenario. However, I'd like to know how a person would go from knowing nothing to becoming a comptent programmer. Having read through quite a few threads I get the sense that a few people here have Ph.D.'s in mathematics. What level of math skill is required for intermediate level programming.

Thanks,

Competence is relative. You can probably author enough in Ninja with becoming a .NET jock. That said, the thought processes you will learn by studying programing outside of Ninja will help you with Ninja or any other platform you end up with. I'm new to coding after a 20 year break and far from expert, but you might want to set your self up with a learning plan that addresses both your desire to be better at Ninja/Trading Code and at learning C#/.NET/OOP in general.

A learning plan might look like this for Step One:

Get a copy of this: Amazon.com: Head First C#, 2E: A Learner's Guide to Real-World Programming with Visual C# and .NET (Head First Guides) (9781449380342): Andrew Stellman, Jennifer Greene: Books
Download Visual Studio 2010 Express: Microsoft Express Downloads - Visual Studio Express and SQL Server Express
Check out what free training Microsoft offers here: Development for Beginners | Training, Videos, Tools, Resources, Learning | MSDN

While taking a look at Ninja strategies and indicators as you go along.

If you are still keen and moving foreward after that, consider this: Amazon.com: Head First Object-Oriented Analysis and Design (9780596008673): Brett D. McLaughlin, Gary Pollice, Dave West: Books

Which is for Java but if you got through the first book you should have no trouble reading the code and getting the concepts.

Step Three might be this: Amazon.com: Head First Design Patterns (9780596007126): Elisabeth Freeman, Eric Freeman, Bert Bates, Kathy Sierra: Books or if you are a complete geek this: Amazon.com: Design Patterns: Elements of Reusable Object-Oriented Software (0785342633610): Erich Gamma, Richard Helm, Ralph Johnson, John M. Vlissides: Books . The former is Java, the latter C (and a lot of UML), but again if you get past Step 1 and 2 you will get it.

Somewhere in that process you might consider an upgrade from the free Visual Studio Express version to Visual Studio Professional so you can take advantage of the power of VS to code in Ninja. Some complete hack started a thread on that here: https://futures.io/ninjatrader-programming/4781-ninjatrader-vs2010-dummies.html

This website is home to (nearly) two years of collective wisdom, discovery, trial, and error. There is some amazing code here, and some absolute crap (I have some absolute crap posted here still. Sorry guys!). But there are also a lot of people here willing to share and willing to help IF you yourself are willing to put in the time.

Give youself learning targets. If you can get through the excercises in that first book while also playing around with Ninja and learning the basics here by, say, 30 June 2011... you are making good progress.

Anyway, some random thoughts from a complete hack who believes in continuous education .

Reply With Quote
The following 8 users say Thank You to MXASJ for this post:
 
  #12 (permalink)
Trading Apprentice
Ontario
 
Futures Experience: Master
Platform: MT4
Favorite Futures: EUR/USD
 
Posts: 3 since Oct 2009
Thanks: 1 given, 0 received

I am newbie here and i thank you because you already answered my question..

Thanks again

Reply With Quote
 
  #13 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: ib
Favorite Futures: Electric Guitar
 
Mindset's Avatar
 
Posts: 355 since Sep 2009
Thanks: 88 given, 285 received

I started from zero


And now I can cut,paste and amend code to do most of what I want to do.
Download all the indicators you like and then play with the code to understand what does what and how.

I did read a book on C# but really I don't get inheritance and polymorphism, etc. So occasionally it will take me a month to work out why my indicator works but the log gives me an error of an object reference not set to an instance of an object, blah blah.

You have to be analytical and a little anal - A is not the same as a.

The very BEST thing I did - was get a Consultant to code up something that I had always wanted right at the very start which involved all of the core things that I knew I would want eg mouse capture, toolbar buttons, drawing on the chart, etc.

It was expensive but I have never stopped since then and I have been able to amend my prime indicator until it's unrecognisable from it's beginnings. Now I sell the odd indicator myself and provide a no to this forum for free.

So in summary

1. You just have to be reasonably intelligent to learn C#/NS.
2. Use other people's/NT code to learn from.
3. Use msdn reference site for C#.
4. Understand it will take many many hours to get proficient.
5. Enjoy the frustrations - they are part of the learning curve.
6. Ask communities such as this for help when you are bleeding from banging your head against the wall.

Reply With Quote
The following 2 users say Thank You to Mindset for this post:
 
  #14 (permalink)
Elite Member
Boston Ma USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 5 since Dec 2010
Thanks: 1 given, 1 received

Thank-you all for the well thought out replies. I'm going to give it a shot so we'll see how it goes.

Reply With Quote
 
  #15 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


Mindset View Post
And now

5. Enjoy the frustrations - they are part of the learning curve.
...

6. Ask communities such as this for help when you are bleeding from banging your head against the wall.

Dah ... I enjoy the '''aaahhh''' when the frustration ends .,.. NOT the frustration itself

Bleeding is good ... increases circulation to the brain

Jon

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Reply With Quote
 
  #16 (permalink)
Elite Member
Dartmouth NS
 
Futures Experience: Intermediate
Platform: MC, MC.Net, NT, TWS
Broker/Data: IB / IQFeed / Kids
Favorite Futures: Forex, stocks
 
bnichols's Avatar
 
Posts: 638 since Feb 2010
Thanks: 64 given, 459 received

To expand upon what MXASJ said about NT scripting, for traders who have never programmed (and programmers like me who have never been able to get through a book on programming or sit through a programming course) I found NT's indicator & strategy wizards great for learning trade scripting (Tools > New NinjaScript > [Indicator | Strategy]).

The script editor is a relatively uncomplicated environment for learning C# basics compared, say, to MS Visual Studio, but still implements useful features of a development environment (e.g., Intellisense, auto-error checking, outlining, some auto-formatting) (Tools > Edit NinjaScript > [Indicator | Strategy]). Even the Help function is pretty good.

Once you have some idea how wizards work you can create simple programs that do something useful, allowing you to study indicators and strategies and test your own ideas without worrying too much about the details. Viewing the code generated by the wizard (either from the wizard or the editor) helps you learn about the C# language by example, which as others have pointed out is how some of us learn quickest.

Best of all the application to trading is obvious & immediate, as opposed to wasting time IMO puzzling over esoterica; e.g., learning how to write binary sorts and prime number calculators or similar, worst case in some pseudo programming language.

Once you have some idea about how trading scripts work, and how C# works, you can unlock non-system scripts (make them editable) and have your way with them.

One caveat is that if you create a script in the NT environment, by default it is placed in the [NTPath]/Custom/bin directory along with all active indicators / strategies. When you invoke Compile in the editor all existing scripts are (re)compiled at the same time and you can't move on (i.e., create a new script) until all scripts created to date compile without errors. On the other hand, as others have said, recovering from a snafu is an effective way to learn something about system internals even if dealing with internals can make you prematurely grey

The bottom line is, while NT wizards have their own learning curve it's extremely short compared to becoming a full-blown programmer, and you start writing trade-appropriate programs from the get-go.

Reply With Quote
The following user says Thank You to bnichols for this post:
 
  #17 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


bnichols View Post
To expand upon

..about system internals even if dealing with internals can make you prematurely grey .

Or habitually have a bloody head from smacking on the wall ... lol

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Reply With Quote
 
  #18 (permalink)
Market Wizard
Houston, TX
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Optimus Futures
Favorite Futures: 6E
 
TheWizard's Avatar
 
Posts: 1,711 since Jun 2009
Thanks: 509 given, 4,072 received

Need help with an automated strategy

I need help with some coding.. It's done for the most part, but I'm trying to do something I don't know how to code.

When the signal is given for a long, I want to enter at the HIGH of the bar prior to the signal bar.
Or (option #2) Enter at the High + 1 tick of the bar prior to the signal bar.

When the signal is given for a short, I want to enter at the LOW of the bar prior to the signal bar.
Or (option #2) Enter at the Low -1 tick of the bar prior to the signal bar.

I don't know how to code that and the Strategy creation wizard isn't much help. Can anyone help? Something like this:

ex: If long condition met:
EnterLong High[1]; (enter long at the high of the previous bar)

or EnterLong High[1]+1 tick; (or enter long at the high + 1 tick, of the previous bar)

ex: If short condition met:
EnterShort Low[1]; (enter short at the low of the previous bar)
EnterShort Low[1] -1 tick: (or enter short at the low -1 tick, of the previous bar)

Thank you for your consideration and time.

I'll be happy to share the strategy, once I get it working!

After all, it's what you learn AFTER you know it all, that counts!
Attached Thumbnails
NinjaScript Coding-automated-example.jpg  

Last edited by TheWizard; August 2nd, 2014 at 10:14 PM.
Reply With Quote
 
  #19 (permalink)
Elite Member
Dallas, TX
 
Futures Experience: Beginner
Platform: Ninjatrader
Broker/Data: Zen-Fire
Favorite Futures: ZN, 6E
 
gulabv's Avatar
 
Posts: 284 since May 2010
Thanks: 159 given, 155 received

@TheWizard,

I do not know how those HybridRenko bars work but assuming the high and low are correct representation of the bar the following code should work for long signal:

EnterLongStop(High[1], "Long Entry")

Code for short signal:

EnterShortStop(Low[1], "Short Entry")


The code above will submit orders for the quantity value setup in your strategy property window.
The first argument in the code above is the price to enter at.
The second argument in the code above is the signal name (change it to whatever you like) to identify the order.

Let me know if that works for you!

Reply With Quote
The following user says Thank You to gulabv for this post:
 
  #20 (permalink)
Market Wizard
Houston, TX
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Optimus Futures
Favorite Futures: 6E
 
TheWizard's Avatar
 
Posts: 1,711 since Jun 2009
Thanks: 509 given, 4,072 received



gulabv View Post
@TheWizard,

I do not know how those HybridRenko bars work but assuming the high and low are correct representation of the bar the following code should work for long signal:

EnterLongStop(High[1], "Long Entry")

Code for short signal:

EnterShortStop(Low[1], "Short Entry")


The code above will submit orders for the quantity value setup in your strategy property window.
The first argument in the code above is the price to enter at.
The second argument in the code above is the signal name (change it to whatever you like) to identify the order.

Let me know if that works for you!

Thank you. I'll give it a try.

After all, it's what you learn AFTER you know it all, that counts!
Reply With Quote

Reply



futures io > > > > > NinjaScript Coding

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
Ninjascript errors incometrade NinjaTrader Programming 10 November 6th, 2015 03:29 PM
Tricky NinjaScript coding {questions} . . . jmejedi NinjaTrader Programming 10 August 2nd, 2014 10:09 PM
Webinar: Basic NinjaScript coding, May 25th @ 4:30PM Eastern, 22:30 Berlin/Paris sam028 The Elite Circle 33 August 11th, 2011 11:37 AM
I'm a Ninjascript Newbie and need some help suprsnipes NinjaTrader Programming 5 February 17th, 2010 01:05 AM
Ninjascript How TO spinnybobo NinjaTrader Programming 2 October 29th, 2009 11:34 AM


All times are GMT -4. The time now is 09:39 AM.

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.16 seconds with 20 queries on phoenix via your IP 54.226.227.175