NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 10-22-2008, 01:50 PM   #1
pclark
Junior Member
 
Join Date: Sep 2008
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default Help w/Strategy Wizard Please

I was hoping someone could help me. I have tried to build a simple MACD strategy using the Strategy Wizard to no avail. It is as follows:

If fast MACD Line crosses slow line above 0 then go long. If fast MACD line crosses slow line below 0 go short.

I also would like to go long if both lines move through the 0 line from below it or short if both lines move through the 0 line from above it. In this case they could have crossed earlier I am just looking for both lines to move through.

Can this be done in the wizard and if so would someone be willing to get me started in the right direction? If not does anyone know if this strategy has been written before or something like it?

Thanks in advance.

Thanks...
pclark is offline  
Reply With Quote
Old 10-22-2008, 01:56 PM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

Yes, you can do this in the Strategy Wizard. Please review this link:
http://www.ninjatrader-support.com/H...verview41.html

Then try to set it up yourself again. If you get stuck please provide me with screen shots of your actions and conditions window and tell me what is not working. I will assist you with some suggestions.
NinjaTrader_Ben is offline  
Reply With Quote
Old 10-22-2008, 03:13 PM   #3
pclark
Junior Member
 
Join Date: Sep 2008
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default Thanks and quick question.

How do I represent the 0 line using the MACD indicator? This is one of the problems I am having . If I look in the Strategy Wizard and add the MACD I don't see the 0 line as a parameter.
pclark is offline  
Reply With Quote
Old 10-22-2008, 03:47 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Hi pclark,

MACD does not have a zero line plot, but if you wanted to run checks against a zero line you can use the "Misc" section and select "Numeric value".
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-22-2008, 07:01 PM   #5
pclark
Junior Member
 
Join Date: Sep 2008
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default

In the directions that Ben told me to look at there is an example of an EMA indicator on indicator and I understand how to specify one EMA over the other EMA in the example because I would change the values but how do I pick one MACD and tell it what to do on another MACD because the values are the same. Does this make sense?

For example if I were using EMA I would make one value 9 and the other 12 and just specify when 9 crosses 12 but w/the MACD my values will not change from the default. How would I write this?

If you guys could point me to some strategies that were written in the wizard that would be a big help. The one that came w/the software does not have anything I can build upon. If I can disect something I work better. It does not have to be what I am looking for it just needs to be something similar.

Thanks for your help.
pclark is offline  
Reply With Quote
Old 10-23-2008, 06:52 AM   #6
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

When you say:
"w/the MACD my values will not change from the default. How would I write this?"

It is not clear what your signal is. Perhaps this will help:
- if you are using the default MACD, the default MACD has parameters. They are 12/26/9.

- are you trying to compare the MACD value of one bar to another bar for the same MACD indicator? If so, use the bars ago field to determine which bar you are referring to. For example if you unchecked calculate on bar close at the beginning of the Wizard, "0" bars ago means the current building bar, and "1" bars ago means the bar just to the left of that (which is closed), "2" bars ago means the bar to the left of the "1" bar.
If you have calculate on bar close checked, then "0" refers to the first closed bar (the bar to the left of the currently building bar), "1" refers to the bar to the left of that, etc.

If you provide details on exactly what your MACD signal is, I can help you better.

The only samples we have are the sample strategies you see in Strategies and the tutorial I linked you to before.
NinjaTrader_Ben is offline  
Reply With Quote
Old 10-23-2008, 10:25 AM   #7
pclark
Junior Member
 
Join Date: Sep 2008
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Ben and Josh. I got it working. I may have more questions but the info you provided helped me. I am just trying to learn the possibilities of the Strategy Wizard and it takes some working with to get the thought process going for me.

Paul
pclark is offline  
Reply With Quote
Old 11-10-2009, 06:45 PM   #8
BrianL
Member
 
Join Date: Jul 2009
Location: Orlando, FL
Posts: 54
Thanks: 0
Thanked 1 time in 1 post
Default Strategy Wizard Problems

Hello, I'm having major issues with the Strategy Wizard. I tried putting in a simple moving avgerage cross and I"m getting like 20 errors in the code even though I did everything through the strategy wizard. It shouldn't be this hard but I'm having trouble with this thing even doing something so very simple. I get an "error on generating strategy" message and I did everything through the Wizard. HELP!

Here is what the wizard spat out which does not work:

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Brian 004 trying to do this from scratch
/// </summary>
[Description("Brian v004 trying to do this from scratch")]
public class v004 : Strategy
{
#region Variables
// Wizard generated variables
private int vEMA8 = 8; // Default setting for VEMA8
private int vVWMA20 = 20; // Default setting for VVWMA20
private int vSMA50 = 50; // Default setting for VSMA50
private int vSMA200 = 200; // Default setting for VSMA200
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
Add(VWMA(Close, 20));
Add(SMA(Close, 50));
SetProfitTarget("20maX50maUP", CalculationMode.Ticks, 40);
SetStopLoss("20maX50maUP", CalculationMode.Ticks, 12, false);

CalculateOnBarClose = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(VWMA(Close, 20), SMA(Close, 50), 1))
{
DrawArrowUp("20vwmaX50smaUP" + CurrentBar, false, 0, 0, Color.Lime);
EnterLongLimit(5, 0, "20maX50maUP");
}
}

#region Properties
[Description("8EMA")]
[Category("Parameters")]
public int VEMA8
{
get { return vEMA8; }
set { vEMA8 = Math.Max(1, value); }
}

[Description("20VWMA")]
[Category("Parameters")]
public int VVWMA20
{
get { return vVWMA20; }
set { vVWMA20 = Math.Max(1, value); }
}

[Description("50SMA")]
[Category("Parameters")]
public int VSMA50
{
get { return vSMA50; }
set { vSMA50 = Math.Max(1, value); }
}

[Description("200SMA")]
[Category("Parameters")]
public int VSMA200
{
get { return vSMA200; }
set { vSMA200 = Math.Max(1, value); }
}
#endregion
}
}
BrianL is offline  
Reply With Quote
Old 11-11-2009, 04:32 AM   #9
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Brian, as NinjaTrader does always compile all present NinjaScript files (not only the one you're currently working on) you could see errors being reported even if you're current work is flawless, to resolve this please check into this link -

http://www.ninjatrader-support2.com/...ead.php?t=4678
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 11-11-2009, 01:22 PM   #10
BrianL
Member
 
Join Date: Jul 2009
Location: Orlando, FL
Posts: 54
Thanks: 0
Thanked 1 time in 1 post
Default Thanks

NinjaTrader_Bertrand,

Thanks, that's exactly what it was. I had a few scripts that i had started transferring from eSignal onto NT and they weren't complied correctly and that was causing the errors with script that was actually perfect. I created another directory in my NT folder under My Documents and just moved the stille needed to be edited scripts in to that folder and everything then worked as it should.

Thanks for the link to the error message post, THAT was a big help.
BrianL is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Strategy Wizard rgibson Strategy Analyzer 1 07-21-2008 10:41 AM
Strategy Wizard John833 Strategy Development 4 07-13-2008 08:42 AM
Strategy Wizard Raradek Strategy Analyzer 2 05-26-2008 01:08 AM
Strategy Wizard latkinso Automated Trading 3 06-22-2007 11:25 AM
Strategy Wizard Brody Strategy Development 3 02-06-2007 08:53 AM


All times are GMT -6. The time now is 12:16 AM.