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 > NinjaScript Development Support > Strategy Development

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

Reply
 
Thread Tools Display Modes
Old 07-17-2007, 07:53 PM   #1
Jenny
Member
 
Join Date: Jun 2007
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
Default How to write second cross above of MACD?

How to write second cross above of MACD? And the second cross over is higher than the first one?
Thanks a lot
Last edited by Jenny; 07-17-2007 at 08:03 PM.
Jenny is offline  
Reply With Quote
Old 07-17-2007, 10:30 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

This is not exactly ninjascript code, but it gives you a general outline of how to write the code.

Code:
double macdvalue
int firstcross

if macd crossabove signal line <--or whatever condition you were trying for
{
     if firstcross == 1 && current macd's value > macdvalue
     {
            blah blah do something
            macdvalue = 0
            firstcross = 0
     }
     else
     {
            macdvalue = macd's crossover value
            firstcross = 1
     }
}
NinjaTrader_Josh is offline  
Reply With Quote
Old 07-18-2007, 06:23 AM   #3
Jenny
Member
 
Join Date: Jun 2007
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you!
Jenny 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
Hull MA of Macd Historigram Learning1 Indicator Development 11 07-07-2007 01:25 PM
How to write a time period in wizard? Jenny Strategy Development 19 06-18-2007 07:04 AM
Alert on cross over/under scjohn Market Analyzer 5 05-25-2007 07:21 AM
Using MACD.avg vs. MACD Jim-Boulder Strategy Development 1 05-23-2007 07:41 AM
RSI MACD trade system zelli Strategy Development 3 11-28-2006 05:03 AM


All times are GMT -6. The time now is 09:00 PM.