Big Mike's Trading Forum
 

Go Back   Big Mike's Trading Forum

> Trading Forums > Platforms and Indicators > NinjaTrader > NinjaTrader Programming


Notices
     

Strategy + indicator coding - samples / examples
Started:November 17th, 2009 (12:07 PM) by max-td Views / Replies:5,385 / 19
Last Reply:December 2nd, 2009 (04:31 AM) Attachments:1

Welcome to Big Mike's Trading Forum.

Welcome, Guest!

This forum was established to help traders by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

BMT is fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike
     

Reply
 1  
 
Thread Tools Search this Thread

Strategy + indicator coding - samples / examples

Old November 17th, 2009, 12:07 PM   #1 (permalink)
Elite Member
Frankfurt
 
Trading Experience: Intermediate
Platform: NinjaTrader
Favorite Instrument: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 883 received

Strategy + indicator coding - samples / examples

hi all,
here is a source with lots of examples how to get to several solutions in indicator + strategy-coding :

Reference Samples - NinjaTrader Support Forum

hope that helps!

max-td
Reply With Quote
     
The following user says Thank You to max-td for this post:
     

Old November 17th, 2009, 12:21 PM   #2 (permalink)
Elite Member
Frankfurt
 
Trading Experience: Intermediate
Platform: NinjaTrader
Favorite Instrument: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 883 received

here some snippets for

StopLoss
ProfitTarget
TrailStop

in strategys

 
Code
			
    protected override void Initialize()

        {
            
// Submit stop-loss and profit target orders


            
SetStopLoss(CalculationMode.Ticks5);

            
SetProfitTarget(CalculationMode.Ticks10);

           
SetTrailStop(CalculationMode.Ticks40);
            
            
CalculateOnBarClose true;
            

        } 

http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?SetProfitTarget

http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?SetTrailStop

http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?SetStopLoss


Attention :
The SetTrailStop() method can NOT be used concurrently with the SetStopLoss() method for the same position, if both methods are called for the same position (fromEntrySignal) the SetStopLoss() will always take precedence. You can however, use both methods in the same strategy if they reference different signal names.

max-td

Last edited by max-td; November 30th, 2009 at 08:13 AM.
Reply With Quote
     
The following 3 users say Thank You to max-td for this post:
     

Old November 17th, 2009, 12:59 PM   #3 (permalink)
Elite Member
Frankfurt
 
Trading Experience: Intermediate
Platform: NinjaTrader
Favorite Instrument: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 883 received


Also, especialy for beginners, i recommend the NinjaTrader- online-events
to do the first steps into creating strategys with the NT-wizard :

Automated Strategy Developement :

What:
Software Training Session
When: Usually once per week
Online Trading. NINJATRADER. Online events.
Duration: Approximately 60 mins
Cost: Free to everyone
Develop your strategy concept, construct it, historically test it, optimize it, simulation test it and then live deploy it through your live brokerage account with NinjaTrader’s strategy development tools. This session is designed to provide a high-level overview of the following areas:
  • Create a strategy in the Strategy Wizard
  • Create entry and exit conditions and invoke actions
  • Backtest using the Strategy Analyzer
  • Understand the backtest results
Plan to attend this session if you want to maximize your efficiency in utilizing NinjaTrader for automated strategy development. After completing the Automated Strategy Development Level I training session, you will:
  • Know the process for constructing a strategy using the Strategy Wizard
  • Know how to create entry and exit conditions
  • Know how to backtest a strategy
  • Know how to view the performance results of a backtested strategy
Participation is free so please attend if you are a first-time visitor, new user or an existing user. These sessions are always informative and keep you up-to-date on any enhancements and features we add to our strategy development features.


Online Trading. NINJATRADER. Online events.

and then start through

max-td
Reply With Quote
     
The following user says Thank You to max-td for this post:
     

Old November 17th, 2009, 04:36 PM   #4 (permalink)
Elite Member
Sydney, NS
 
Trading Experience: Intermediate
Platform: Ninja
Broker/Data: Zen-Fire
Favorite Instrument: TF,S,GC
 
cclsys's Avatar
 
Posts: 607 since Nov 2009
Thanks: 248 given, 348 received

Max, do you (or anyone else) have a sample strategy that doesn't use fixed tick trailing stops?

Also, how do you keep track of profit/loss within the strategy to perhaps change nr. of contracts, ratio of profit-to-loss etc.?

Also, does anyone have a good example of a multiple entry and exit strategy?

I must confess I have been stumped/frustrated by the brevity and simplicity of the examples provided and also the lack of shared strategies anywhere just to have a basic template with most of the above (and other) options to key off of. If you don't know C+ coding, the error messages are very hard to figure out so I have tended to stay away. But now I want to use strategies to test key ideas even if I don't particularly want to run them for generating income. Working only in indicators is too complicated at this point and really doesn't work for testing purposes.

Reply With Quote
     

Old November 18th, 2009, 03:40 AM   #5 (permalink)
Elite Member
Frankfurt
 
Trading Experience: Intermediate
Platform: NinjaTrader
Favorite Instrument: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 883 received

Current BMT User Poll

Should sim traders that pretend to trade cash be allowed on BMT?

 
sorry cclsys, i dont have such stuff.
but if there are other folks out there - feel welcome to post + collect advanced strategy-snippets here also !

max-td
Reply With Quote
     

Old November 24th, 2009, 06:55 AM   #6 (permalink)
Elite Member
Frankfurt
 
Trading Experience: Intermediate
Platform: NinjaTrader
Favorite Instrument: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 883 received

Here are some videos showing how to start to learn programming / programming a strategy in NT for beginners / learners :

Created by Camtasia Studio 3

Created by Camtasia Studio 3

max-td
Reply With Quote
     
The following user says Thank You to max-td for this post:
     

Old November 24th, 2009, 07:31 AM   #7 (permalink)
Elite Member
Concord, NH USA
 
Trading Experience: Intermediate
Platform: Ninja trader
Broker/Data: AMP/CQG
Favorite Instrument: EC/CL/TF
 
jdella's Avatar
 
Posts: 181 since Jun 2009
Thanks: 132 given, 99 received

Thanks Max, those videos made it look easy . Can the same be done to create indicators?

Reply With Quote
     

Old November 24th, 2009, 07:59 AM   #8 (permalink)
Elite Member
Frankfurt
 
Trading Experience: Intermediate
Platform: NinjaTrader
Favorite Instrument: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 883 received

with this condition-stuff that is not possible in the indicator-wizard.
the indi-wizard is more about plotting lines + such things - the visualizations.

max-td
Reply With Quote
     

Old November 24th, 2009, 05:52 PM   #9 (permalink)
Elite Member
Sydney, NS
 
Trading Experience: Intermediate
Platform: Ninja
Broker/Data: Zen-Fire
Favorite Instrument: TF,S,GC
 
cclsys's Avatar
 
Posts: 607 since Nov 2009
Thanks: 248 given, 348 received


max-td View Post
Here are some videos showing how to start to learn programming / programming a strategy in NT for beginners / learners :

Created by Camtasia Studio 3

Created by Camtasia Studio 3

Yup, can't wait for high speed. Right now, videos are out of my league!

Reply With Quote
     

Old November 30th, 2009, 05:13 AM   #10 (permalink)
Elite Member
Dublin, Ireland.
 
Trading Experience: Advanced
Platform: NinjaTrader, TOS.
 
mrticks's Avatar
 
Posts: 63 since Jun 2009
Thanks: 13 given, 7 received



max-td View Post
here some snippets for

StopLoss
ProfitTarget
TrailStop

in strategys

 
Code
			
    protected override void Initialize()

        {
            
// Submit stop-loss and profit target orders


            
SetStopLoss(CalculationMode.Ticks5);

            
SetProfitTarget(CalculationMode.Ticks10);

           
SetTrailStop(CalculationMode.Ticks40);
            
            
CalculateOnBarClose true;
            

        } 
http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?SetProfitTarget

http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?SetTrailStop

http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?SetStopLoss

Hi max-td,

Is it possible to use all three in the same strategy? I have put stopLoss, trailStop and profitTarget in some strategies but when I backtest the trail stop doesn't take effect. When I check the entries and exits on the chart it looks like the stop loss is taking effect but the profit target and trail stop are ignored. Does that make sense to you? I'll post my code later on if you'd like to take a look?

Reply With Quote
     

Reply



Tags
account, amp, backtest, backtesting, basic, brokerage, change, chart, code, coding, color, condition, contracts, create, day, development, entry, error, es, exit, free, function, greater than, high, how to, indicator, indicators, learn, level, line, list, live, maximize, method, ml, mode, modify, multiple, names, ninja, ninjatrader, nt, optimization, options, override, performance, plan, plot, positions, price_action, profit, profit target, profit_target, programming, sample, setstoploss, simulation, slippage, software, speed, start, stop loss, stoploss, stops, stop_loss, strategies, strategy, strategy development, support, td, template, terms, testing, tick, ticks, trade, trading, trailing, trailing stops, training, type
     

Big Mike's Trading Forum > Trading Forums > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Strategy + indicator coding - samples / examples

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some coding help adding PnL display to strategy grego The Elite Circle 5 March 23rd, 2012 01:12 PM
Strategy Coding Challenge MWinfrey NinjaTrader Programming 4 January 25th, 2011 05:12 PM
Strategy coding - Would Anyone please take a quick look at........ mdsvtr NinjaTrader Programming 4 November 5th, 2010 05:54 AM
Strategy Wizard Coding Question njaisson NinjaTrader Programming 8 October 6th, 2010 07:34 AM
Help Coding Trailing stoploss in Strategy Darshiit NinjaTrader Programming 3 June 25th, 2010 09:45 AM


All times are GMT -4. The time now is 11:15 PM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2014 by Big Mike Trading. 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 2014-04-23 in 0.15 seconds with 20 queries on atlantis via your IP 107.21.67.191