NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Market Analyzer

Market Analyzer Support for the NinjaTrader Market Analyzer.

Reply
 
Thread Tools Display Modes
Old 10-27-2011, 07:04 PM   #1
shanethoene
Junior Member
 
Join Date: Oct 2011
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default MACD crossover alert

Hello,
Has anyone programmed an alert for the MACD crossover? It is not availble through the market analyzer so it needs to be programmed. I haven't done any programming so looking for a little help.
Thanks!
shanethoene is offline  
Reply With Quote
Old 10-27-2011, 09:04 PM   #2
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,783
Thanks: 160
Thanked 566 times in 557 posts
Default

Hello,

If you are not familiar with programming, you might want to try using the Strategy Wizard to create a Cross Over strategy. This is a point and client interface that can help you get started.

Instead of buying/selling when these crossover, you can simply tell the strategy to 'Alert'.

Please see the Strategy Wizard Help Guide section on ' How to create a cross over condition':

http://www.ninjatrader.com/support/h...on_builder.htm
NinjaTrader_Matthew is offline  
Reply With Quote
Old 11-22-2011, 07:28 AM   #3
Leo123
Junior Member
 
Join Date: Nov 2011
Posts: 11
Thanks: 1
Thanked 0 times in 0 posts
Default

X2

Michael
Leo123 is offline  
Reply With Quote
Old 10-18-2012, 04:05 PM   #4
snakeoil
Junior Member
 
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default MACD crossover alert

I used the wizard to program the strategy for MACD, which initially worked for a couple of days, but then spont quit for the ensuing 2 mos. The support people simply say to simplify the commands into component pieces, then debug.
How much simpler can it be to say IF [condition] K crosses D, or vice versa, THEN [action] play selected alert. I followed Matthew's suggestion from below using the wizard, but still no joy.
O/w they say to hire one of their consultants. Contacted 4 of those consultants, but only one responded from UK, who offered to take over my computer to see what is wrong, @ about $60-70/hr.
I am quite surprised this has not been perfected by NT or someone and generally available.
Last edited by snakeoil; 10-18-2012 at 04:12 PM. Reason: add
snakeoil is offline  
Reply With Quote
Old 10-18-2012, 08:00 PM   #5
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,187
Thanks: 178
Thanked 301 times in 259 posts
Default

Quote:
Originally Posted by snakeoil View Post
I used the wizard to program the strategy for MACD, which initially worked for a couple of days, but then spont quit for the ensuing 2 mos. The support people simply say to simplify the commands into component pieces, then debug.
How much simpler can it be to say IF [condition] K crosses D, or vice versa, THEN [action] play selected alert. I followed Matthew's suggestion from below using the wizard, but still no joy.
O/w they say to hire one of their consultants. Contacted 4 of those consultants, but only one responded from UK, who offered to take over my computer to see what is wrong, @ about $60-70/hr.
I am quite surprised this has not been perfected by NT or someone and generally available.

Can you post your code? I and more than a few others could probably pin point the problem pretty easily.
sledge is offline  
Reply With Quote
Old 10-18-2012, 08:44 PM   #6
snakeoil
Junior Member
 
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default

I appreciate your offer of assistance, sledge
Having used the wizard, I don't have the code expressed. I do have the screenshot of the formative page, but don't see how to attach it into this thread. Also, I suppose I could unlock the code and copy/paste that whole thing into the thread, if that is allowed.
If I had an email address I could send the series of screen shots used in the wizard setup. My address is: coolholder@gmail.com
What might you suggest?
snakeoil is offline  
Reply With Quote
Old 10-18-2012, 08:47 PM   #7
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,187
Thanks: 178
Thanked 301 times in 259 posts
Default

Quote:
Originally Posted by snakeoil View Post
I appreciate your offer of assistance, sledge
Having used the wizard, I don't have the code expressed. I do have the screenshot of the formative page, but don't see how to attach it into this thread. Also, I suppose I could unlock the code and copy/paste that whole thing into the thread, if that is allowed.
If I had an email address I could send the series of screen shots used in the wizard setup. My address is: coolholder@gmail.com
What might you suggest?
On WinXP it would be located:

C:\Documents and Settings\YOURUSERNAME\My Documents\NinjaTrader 7\bin\Custom\Strategy

and attach the .CS file.

I assume it will be there, even it is unlocked.
sledge is offline  
Reply With Quote
Old 10-18-2012, 09:29 PM   #8
snakeoil
Junior Member
 
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default

Found it: macd.cs. Will paste here:
#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> /// Enter the description of your strategy here /// </summary> [Description("Enter the description of your strategy here")] public class macd : Strategy { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 // 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() { CalculateOnBarClose = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 if (CrossAbove(MACD(8, 13, 5), MACD(8, 13, 5), 1)) { PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert2.wav"); PrintWithTimeStamp(""); } // Condition set 2 if (CrossBelow(MACD(8, 13, 5), MACD(8, 13, 5), 1)) { PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav"); PrintWithTimeStamp(""); } }
snakeoil is offline  
Reply With Quote
Old 10-18-2012, 09:35 PM   #9
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,187
Thanks: 178
Thanked 301 times in 259 posts
Default

Quote:
Originally Posted by snakeoil View Post
Found it: macd.cs. Will paste here:
#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> /// Enter the description of your strategy here /// </summary> [Description("Enter the description of your strategy here")] public class macd : Strategy { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 // 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() { CalculateOnBarClose = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 if (CrossAbove(MACD(8, 13, 5), MACD(8, 13, 5), 1)) { PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert2.wav"); PrintWithTimeStamp(""); } // Condition set 2 if (CrossBelow(MACD(8, 13, 5), MACD(8, 13, 5), 1)) { PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav"); PrintWithTimeStamp(""); } }
Umm, can you reply and use "manage attachments" and upload it there?

the carriage returns got lost in your post
sledge is offline  
Reply With Quote
Old 10-18-2012, 09:44 PM   #10
snakeoil
Junior Member
 
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default

Being brand new to this, not seeing "manage attachments" anywhere
snakeoil is offline  
Reply With Quote
Old 10-18-2012, 09:48 PM   #11
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,187
Thanks: 178
Thanked 301 times in 259 posts
Default

Quote:
Originally Posted by snakeoil View Post
Being brand new to this, not seeing "manage attachments" anywhere
Use "QUOTE" to reply

OR

if you use "REPLY", then choose "GO ADVANCED".
Attached Images
File Type: jpg advanced.JPG (114.3 KB, 36 views)
sledge is offline  
Reply With Quote
Old 10-18-2012, 09:52 PM   #12
snakeoil
Junior Member
 
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by sledge View Post
Use "QUOTE" to reply

OR

if you use "REPLY", then choose "GO ADVANCED".
#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> /// Enter the description of your strategy here /// </summary> [Description("Enter the description of your strategy here")] public class macd : Strategy { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 // 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() { CalculateOnBarClose = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 if (CrossAbove(MACD(8, 13, 5), MACD(8, 13, 5), 1)) { PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert2.wav"); PrintWithTimeStamp(""); } // Condition set 2 if (CrossBelow(MACD(8, 13, 5), MACD(8, 13, 5), 1)) { PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav"); PrintWithTimeStamp(""); } }
snakeoil is offline  
Reply With Quote
Old 10-19-2012, 12:22 AM   #13
Gino Magic
Junior Member
 
Join Date: Dec 2010
Location: Los Angeles, California
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Gino Magic
Default Is there an accuracy problem when using the plot "Diff" for Macd Crossover

I'm sure you guys all well pass this but I was just wondering.
I just started trying to use the plat "Diff" in the MACD in the Market Analyzer.
but I alread see some number accuracy problems that Support has not been able to help me rectify.
Now I'm wondering about the accuracy of all indicators, # of look back bars, etc.
I'll be checkin' back and try to catch up with your advance methods of MACD crossover using script and strategy builder.

Gino
Gino Magic is offline  
Reply With Quote
Old 10-19-2012, 07:12 AM   #14
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,783
Thanks: 160
Thanked 566 times in 557 posts
Default

snakeoil,

I see you have used PrintWithTimeStamp, however there is no text being written.

You should edit your strategy to print a message when the condition is true. After you have done this, open the output window under Tools--> Output window and when you enable your strategy, check this window to see if it has found any conditions on historical data.

If the output window remains empty, this would mean your condition is never true. If you do see these messages printed, the condition should be valid.
NinjaTrader_Matthew is offline  
Reply With Quote
Old 10-19-2012, 07:13 AM   #15
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,783
Thanks: 160
Thanked 566 times in 557 posts
Default

Quote:
Originally Posted by Gino Magic View Post
I'm sure you guys all well pass this but I was just wondering.
I just started trying to use the plat "Diff" in the MACD in the Market Analyzer.
but I alread see some number accuracy problems that Support has not been able to help me rectify.
Now I'm wondering about the accuracy of all indicators, # of look back bars, etc.
I'll be checkin' back and try to catch up with your advance methods of MACD crossover using script and strategy builder.

Gino
You need to ensure that your chart and the market analyzer are looking at the same exact data set to calculate these values. This would be the # of bars to look back, the session template as well as the input series. Since you're using the same formulas, you should be able to get these values to match as long as the data set is the same.
NinjaTrader_Matthew 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
MACD Crossover scartree Automated Trading 18 12-20-2010 08:50 AM
MACD Crossover nybangali General Programming 25 10-29-2010 02:11 PM
MACD crossover in panel1 kumaresh11 Charting 1 02-23-2010 07:20 AM
Macd crossover it's Avg Dope63 Strategy Development 1 01-31-2010 12:45 AM
MACD Crossover question rmyrick Strategy Analyzer 7 03-21-2008 01:03 PM


All times are GMT -6. The time now is 01:55 PM.