NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 02-17-2012, 09:36 AM   #1
RColtelli
Junior Member
 
Join Date: Dec 2011
Posts: 6
Thanks: 2
Thanked 0 times in 0 posts
Default MACD Cross

I am trying to find a way to code or even use the Strategy Wizard to code if possible just a simple Fast line Crossing above and below the Slow line on the MACD. ALso is there a way to program in if the slow crosses above the slow line at a 45 degree angle buy? The standard default setting are fine for this.
Thank You
RColtelli is offline  
Reply With Quote
Old 02-17-2012, 09:54 AM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

Thanks for the forum post.

Yes this is possible in the strategy wizard.

I would recommend watching the following youtube video and replacing the input conditions for the MACD plots that you want to check against.

Let me know if you have any questions after watching the below video.

http://www.youtube.com/watch?v=fVFqw...ure=plpp_video

-Brett
NinjaTrader_Brett is offline  
Reply With Quote
Old 02-17-2012, 10:05 AM   #3
RColtelli
Junior Member
 
Join Date: Dec 2011
Posts: 6
Thanks: 2
Thanked 0 times in 0 posts
Default

I understand how to set a Fast and Slow Moving Average Cross which only has 2 parameters. When using the MACD the Fast (being 12) and the Slow (being 26) i see where they can be input but what i dont understand is how would you use the 3rd portion of the MACD being the smooth period?
Ryan
RColtelli is offline  
Reply With Quote
Old 02-17-2012, 11:04 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Ryan,
MACD is the difference between the 2 EMAs. The Average is essentially an EMA of the MACD. The Smooth is the EMA period value.

Please refer to the MACD indicator (in Control Center menu bar goto Tools>Edit NinjaScript>Indicaors…, in the Indicator dialog select MACD and click on Ok button) that comes with NinjaTrader to get an idea on how exactly MACD is calculated.

To create a Macd crossover strategy please see the section “How to compare plot value of multi-Plot indicators” from here http://www.ninjatrader.com/support/h...on_builder.htm

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 02-20-2012, 01:45 PM   #5
smatthew
Junior Member
 
Join Date: Jan 2011
Posts: 10
Thanks: 2
Thanked 2 times in 2 posts
Thumbs up Solution

Try:

CrossAbove(MACD(12, 26, 9).Diff, 0, 1)

(or CrossBelow for shorts)
smatthew is offline  
Reply With Quote
The following user says thank you to smatthew for this post:
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
Code to detect cross above of Stochastics.K/Stochastics.D, MACD.Value/MACD.Avg? qfweiwei General Programming 5 07-20-2011 10:42 PM
MACD cross tanou_us Strategy Development 6 07-26-2010 08:04 AM
Macd smooth cross indicator ericgood Indicator Development 0 04-21-2010 08:32 PM
MACD Cross suitguy1 ATM Strategies (Discretionary Trading) 1 08-04-2008 07:38 AM
How to write second cross over of MACD? Jenny Strategy Development 2 07-18-2007 06:23 AM


All times are GMT -6. The time now is 06:37 AM.