![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Dec 2009
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
|
How to set up a strategy using MACD (12,26,9)?
|
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
jp2890,
You can use the MACD in the Condition Builder of the Strategy Wizard. Suggest you take a look at this tutorial: http://www.ninjatrader-support.com/H...tml?Overview34
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Dec 2009
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
|
Success!
Some questions: 1. What is look back period? 2. Can I use "second" instead of "minute" as time interval? 3. Is Zero lag MACD available? Any code available? Thank you Josh. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
jp2890,
1. Depends under what context you are talking about. If you are talking about CrossAbove/Below, it determines the two data points to check. It looks at the values at two points in time, the first point in time is the most recent bar, the second being whatever the lookback period is set to. 2. Time intervals are determined by what kind of chart you ultimately run on. If you run on a 1min chart, it uses 1min. If you run on a 30 second chart, it will use that. 3. You can try going through the file sharing second for Zero lag indicators to see if you find what you want.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Dec 2009
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
|
I would like to use the Strategy Analyser to optimize the MACD parameters.
What should I enter in the optimize box: parameters, myinput0, min, max value? What is Myinput0? Thanks! |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
jp, MyInput0 is the first variable that gets generated when creating a strategy. Unless you've included MyInput0 in your calculations, you can ignore it.
The other values you ask about are just like they seem, the low is the lowest value the optimizer will try up to high, the highest value. The other parameter is the "skip" value, which is the increment the optimizer will go from low to high by. So if the low is 9 and the high is 25 and the increment is 5 (9,25,5), the iterations tested will be 9, 14, 19, 24.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Dec 2009
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Austin,
Since MACD has three value, say (12,26,9), in fact which value it is optimizing each time? Where to set which value it is optimizing? Can I optimizing three values at the same time? Merry Christmas! |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
JP, it optimizes the value you tell it to. You can select these values from the optimize window, after maximizing the parameters section. Yes, it is also possible to optimize all three at the same time.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Member
Join Date: Dec 2009
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Austin,
I understand the case of SMA crossover i.e. fast and slow value. For a MACD optimzation, where to specify which particular value to optimize, i.e. the MACD value, Ave and Diff. Thanks. |
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
JP, the optimize process is exactly the same for any strategy. If you've created the MACD strategy to be optimized, it is possible the inputs haven't been "exposed", thus they can't be optimized. In your code, the inputs for the MACD must be variables in order for the strategy analyzer to be able to optimize it. Please see the attached screenshots to see where to put what.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Member
Join Date: Dec 2009
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Austin,
Not too understand what steps follow screenshot 3. Is there any help menu related to this? |
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
JP, indeed there is a help guide article for this. Optimizing a strategy.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Member
Join Date: Dec 2009
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Austin,
The critical step is to "expose" the inputs. Understand. Merry Christmas! |
|
|
|
|
|
#14 |
|
Member
Join Date: Dec 2009
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
|
I would like to set a strategy with MACD cross over as entry. Can I use certain points (say 10 points profit) as exit?
If yes, how to write the exit setting? Thanks! |
|
|
|
|
|
#15 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
You enter the stops and targets in the wizard's dedicated section to this -
http://www.ninjatrader-support.com/H...egyWizard5.png For 10 pts on the ES for example just enter 40 ticks.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What about MACD X Over | evensteven | Suggestions And Feedback | 2 | 02-27-2011 10:47 AM |
| Help with MACD strategy | tomonly23 | Automated Trading | 8 | 02-10-2010 02:05 AM |
| MACD with up down arrows on MACD signal line crosses | moonriver | Indicator Development | 1 | 12-03-2008 10:34 AM |
| Simple MACD Strategy Problem | diamondpearl | Strategy Development | 13 | 12-02-2008 10:35 AM |
| Using MACD.avg vs. MACD | Jim-Boulder | Strategy Development | 1 | 05-23-2007 07:41 AM |