Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

NinjaScript Programmer's Launch Pad V8
NinjaScript Programmer's Launch Pad V8
NinjaScript Programmer's Launch Pad V8
Ebook295 pages2 hours

NinjaScript Programmer's Launch Pad V8

Rating: 2.5 out of 5 stars

2.5/5

()

Read preview

About this ebook

The NinjaScript Programmer's Launch Pad V8 is a tutorial designed for C#.NET programmers new to NinjaTrader 8's NinjaScript programming environment. It begins by providing the new NinjaScript programmer with a clear understanding of the underlying structure, data, key classes, and efficient programming techniques for writing NinjaScript indicators. This same foundation of knowledge is necessary for creating automation strategies in NinjaScript, although automated strategies are beyond the scope of this book. This is a major expansion of the earlier edition, which addressed NinjaTrader 7. The V8 edition adds a full-blown Trade Setup Entry Indicator that you can use to combined the analyses of multiple indicators to provide suggested trade entries in real time. The Launch Pad can shave days off the learning curve, and is an excellent supplement to NinjaTrader's own excellent documentation.

Since NinjaTrader's documentation and support forum is so good, why use a tutorial? Simply because many of us benefit from a "yellow brick road" approach to learning—something that starts at the beginning and has a clear path to guide you along the way. Once you have established a strong foundation of knowledge, building on it becomes very easy. The Launch Pad is designed to help you build that foundation quickly. Let the Launch Pad be your guiding hand.

LanguageEnglish
PublisherScott Daggett
Release dateApr 23, 2017
ISBN9781370012770
NinjaScript Programmer's Launch Pad V8
Author

Scott Daggett

Scott Daggett is a long-time software developer and IT manager with a keen interest in technical analysis of the financial markets. In addition to writing software on more platforms and in more languages than he can remember, he has studied trading for years and enjoys writing indicators for trading platforms.

Related to NinjaScript Programmer's Launch Pad V8

Related ebooks

Programming For You

View More

Related articles

Reviews for NinjaScript Programmer's Launch Pad V8

Rating: 2.5 out of 5 stars
2.5/5

2 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    NinjaScript Programmer's Launch Pad V8 - Scott Daggett

    ***~~~***

    NinjaScript Programmer’s Launch Pad V8

    The NinjaScript Tutorial for Programmers New to NinjaTrader 8

    by Scott Daggett

    Published by Scott Daggett at Smashwords

    Copyright Scott Daggett 2017, 2018

    http://ninjalaunchpad.com

    Third Edition (3.03)

    Smashwords Edition, License Notes

    This eBook is licensed for your personal enjoyment only. This eBook may not be re-sold or given away to other people. If you would like to share this book with another person, please purchase an additional copy for each recipient. If you’re reading this book and did not purchase it, or it was not purchased for your use only, then please return to Smashwords.com and purchase your own copy. Thank you for respecting the hard work of this author.

    eBook ISBN: 9781370012770

    NinjaTrader is a Registered Trademark of NinjaTrader, LLC.

    ***~~~***

    Table of Contents

    Preface

    1. First Things First

    2. Key Concept—Where’s the Data?

    3. Creating Indicators

    4. Making Properties Available in the Indicators Dialog Box

    5. Making Sure Data is There Before You Use It

    6. Input Series and the Input Keyword

    7. Value Series and the Value and Values Keywords

    8. Drawing Text and Shapes on a Chart

    9. A Meaningful Example

    10. Creating Custom Methods and External Assemblies

    11. Using Multiple Instruments and Timeframes

    12. A Trade Setup Entry Indicator

    13. Where to Go from Here

    Appendix A: References

    Appendix B: Estimating Up and Down Volume

    About Scott Daggett

    Connect with the Author

    ***~~~***

    Preface for the Third Edition

    This book is an update of NinjaScript Programmer’s Launch Pad. It addresses the same material as the old version of the book, except the instructions apply to NinjaTrader version 8 instead of version 7. There are two new chapters added to address multiple instruments and timeframes and an example trade entry decision Indicator framework. As NinjaTrader’s own documentation will tell you, there are several code-breaking changes in version 8. Sometimes, software vendors need to break backward compatibility so they can make significant improvements in a product, especially one like NinjaTrader. If you don’t, then you are hindered when making improvements. Kudos to the NinjaTrader folks for making some tough decisions in favor of a brighter future. Let me take this moment to express my gratitude to the NinjaTrader family for making NinjaTrader available for no charge to developers and learners alike. Thank you NinjaTrader!

    Given the code-breaking changes, the instructions in the old version of this book will not work out-of-the-box in NinjaTrader 8. Therefore, it seemed necessary to create an updated version of the book to provide new NinjaScript programmers the jump-start they need to begin developing indicators for the new NinjaTrader platform. The new sections were added to enhance the value of the book to those who want to go beyond the very basics.

    Another reason for this book is to provide the author with some hands-on experience with NT8. By re-creating the book using NinjaTrader 8 coding conventions, it keeps him up-to-speed with the latest and greatest NinjaTrader trading platform. Hopefully, it will help you come up to speed quickly as well.

    Let me clarify the goal of this book. One reader of an earlier edition was disappointed because it didn’t provide guidance on writing automated NinjaTrader Strategies. That’s true, it doesn’t, and it was never intended to imply that it would. However, please understand that if you want to write automated strategies for NinjaTrader, you must be able to write indicators. Chances are extremely high that the strategies you write will rely on custom indicators that you write. In fact, the strategies you write will no doubt pull together information from multiple indicators to make trade decisions. (And that’s why the trade entry decision Indicator is added to the book.)

    A typical strategy will perform the following tasks:

    • Analyze market data

    • Make trade entry decisions

    • Place buy or sell orders

    • Monitor and manage open orders

    • Monitor and manage open positions

    • Close trades via buy or sell orders such as stop-loss and profit target orders

    The first task, analyze market data, will no doubt rely on information provided by one or more indicators—probably many indicators across multiple timeframes and possibly across multiple instruments. Additionally, you may need some indicators to help your strategy determine logical entry and exit price points based on support, resistance, time, and other factors. Determining trade size is another consideration that may, in part, rely on indicator-provided information. In a sense, indicators are the building blocks of strategies.

    Writing NinjaTrader Strategies is complex. Let me rephrase that: writing automated trading strategies for ANY platform is complex. For example, you must first decide some basics like what timeframe are your strategies going to operate? Intraday? Swing? Long-term? High-Frequency? Then, what instruments? Stocks or ETFs? Futures? Foreign Exchange? Options? What are your risk management constraints? For what market conditions do you want to stay out of the market? Certain news events? Certain levels of volatility? Certain times of the day? Non-trending? The list of considerations goes on. The code you write for an intraday, or day trading, strategy will differ in some ways from a swing trading strategy. So, writing a book about how to write automated trading strategies is a much larger endeavor, and one of great responsibility. I hope one day to take on the challenge if I get the right opportunity.

    This is a book designed for C# developers who are new to the NinjaTrader 8 scripting environment. It is designed to speed up the process of learning how to write indicators. If you’re new to C#, that’s fine, too, but this is not a book about how to write C# code in general. The book assumes that you already know how to trade; that you understand market terms and securities trading principles. In fact, the book offers absolutely no trading or investment advice. It is a book about writing software.

    The indicators you write may be intended to display information on a price chart so that a human can better interpret the behavior of the market and thus make better trading decisions. You may also be interested in writing indicators to support automated trading strategies. This book will give you the knowledge for the indicators, but you will need to leverage the wealth of materials and outstanding support provided by NinjaTrader online to develop the skills for writing the types of strategies you want to rely on. Whether you are writing just indicators or both indicators and strategies, make good use of NinjaTrader’s support forum and its wonderful community!

    Preface for the First and Second Edition

    This book exists because of my desire to come up to speed quickly on how to write NinjaScript indicators for NinjaTrader. I've always been the type of person who learns best in a well-structured, guided environment. As a long-time software developer, though, I have often found myself digging into brand-new, bleeding-edge software tools, discovering how to make use of them, and then documenting them so others could gain the same knowledge without as much effort. I've been doing this for years, and it has become a bit of a habit with me.

    I have been writing computer programs since the late 1970’s. (Yes, I have mostly gray hair, and I actually used punch cards.) I am fairly proficient at writing TradeStation Easy Language indicators, and I wanted to convert some of my indicators to the NinjaTrader platform (I really like the platform!). This seemed like it would be easy because NinjaScript is based on C#.NET, and I was already quite experienced with that.

    I found the instructional materials available from NinjaTrader to be very good, and the support from their support forum is downright awesome. Without all that, I would not have been able to learn how to program in NinjaScript. Even still, there was room for a book like this. There was room for a book that takes the yellow brick road approach to learning—an approach that starts at the beginning, has a clear path and has a clear destination (the place where the wizard lives).

    This book is an attempt to pave that road. It is not a book that will teach you how to program, and it won’t even teach you C#. There are ample high-quality resources for that already. For example, there is a free C# tutorial at http://csharp-station.com/Tutorial/CSharp/Lesson01. [Here’s another one from Microsoft: https://msdn.microsoft.com/en-us/library/aa288436(v=vs.71).aspx] This book is for people who already understand object oriented programming, especially in C#. It assumes you can make your way around a code editor and that you have some troubleshooting skills. This is not a kitchen sink guide. It is intended to quickly give the experienced programmer a fundamental understanding of NinjaScript indicators, their structure, key classes and interfaces, and workable approaches to putting indicators together. When you finish studying this book, you will still have much to learn, but you’ll have a good foundation to build on. You won’t have to spend much time getting to that important starting point. This is simply your launch pad.

    Note: The format of this book is designed to support eBook readers, so you won’t see a lot of hyperlinks littered throughout the content. However, at the end of each chapter, you will find a link that takes you back to the table of contents and one that takes you to the references area in the appendix where the hyperlinks you may need are listed. They are listed in the order they appear in the book.

    >table of contents<

    >references<

    ***~~~***

    1. First Things First

    Note: Having purchased this eBook, you are entitled to the previous edition at no charge. You can use coupon code NQ73F (not case-sensitive) at Smashwords for the older version of the eBook. The author would appreciate it if you do not share this coupone code with others.

    This book assumes that you have already established your NinjaTrader trading platform and that you have taken things to the point where you can begin writing indicators. The following list should be accomplished before you continue with this tutorial.

    1. Install NinjaTrader 8.0.5.2 or later build of version 8. It’s a free platform for simulated trading, so you don’t have to spend any money to learn how to program indicators. The NinjaTrader support web site has some good instructions for installation and general use of the platform.

    2. Establish a data feed connection. If you aren’t trading yet, NinjaTrader 8 offers up to two trials of live Futures or Forex market data through Continuum/CQG. You can arrange for this initially when you first download NinjaTrader 8. You can also open a brokerage account to get ongoing live market data that can be used with your brokerage trading account and your demo account. If you don’t want a live brokerage account and your trials run out, you can always rely on the free end-of-day (EOD) Kinetick connection. It’s built in. Look at Configuration > Connecting in the NinjaTrader Help Guide (press the F1 function key for this guide). You can also use the built-in Simulated Data Feed connection for development purposes. The Help Guide explains it. You may also want to investigate the Playback Connection features, which may provide more realistic market behavior than the Simulated Data Feed. For intra-day trade simulation for indicator development, you should be able to use the Simulated Data Feed or the Playback connections. If all this is too confusing for the moment, just go with Kinetick EOD for now, and rely on historical data. You’ll be fine, but you’ll need to test with live or simulated live data eventually.

    3. Become familiar with the NinjaTrader topics in the following bulleted list. All of this is explained very plainly in the NinjaTrader help guide, which is available from the

    Enjoying the preview?
    Page 1 of 1