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 06-30-2012, 12:30 AM   #1
Wi!s0n
Member
 
Join Date: Mar 2008
Posts: 33
Thanks: 2
Thanked 2 times in 2 posts
Default sma crossover strategy

I have created a simple moving average crossover strategy in the strategy wizard, but now I want to add a condition to it based on a 3rd slower sma? For example if the crossover is below the 3rd slower sma, I want to wait to enter until price closes beyond this 3rd ma and add a marker there. Thanks.
Wi!s0n is offline  
Reply With Quote
Old 06-30-2012, 12:47 PM   #2
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

Wilson,

When a crossover occurs, this would mean that both series are equal at one point. I would suggest just adding a condition for "if one of the sma's are below your third sma".
NinjaTrader_AdamP is offline  
Reply With Quote
Old 06-30-2012, 12:56 PM   #3
Wi!s0n
Member
 
Join Date: Mar 2008
Posts: 33
Thanks: 2
Thanked 2 times in 2 posts
Default

I did this in the wizard as I don't know programming. At what screen/point can I do this in the wizard? Thanks Adam.
Attached Files
File Type: zip MyCustomCrossover.zip (6.2 KB, 7 views)
Wi!s0n is offline  
Reply With Quote
Old 06-30-2012, 02:50 PM   #4
AXELGREASER
Junior Member
 
Join Date: May 2012
Posts: 16
Thanks: 2
Thanked 2 times in 2 posts
Default

You can do it from the conditions and actions step.

Assuming you're using SMAs....

# Set 1
# Add
# Indicators
# SMA
# Set the period or use the variable you defined earlier for the Fast MA
# in the middle column set CrossesAbove
# in the right column set SMA
# Set the period or use the variable you defined earlier for the Slow MA
# OK

Now you have your fast MA crossing over the Slow MA. To make sure that the crossover is above the Confirmation MA:

# Add
# Indicators
# SMA
# Set the period for Fast MA
# in the middle column set Greater Than
# in the right column set SMA
# Set the period or use the variable you defined earlier for the confirmation MA
# OK

And do the same thing for the Slow MA to make sure that it is also above the Confirmation MA.
Last edited by AXELGREASER; 06-30-2012 at 08:41 PM.
AXELGREASER is offline  
Reply With Quote
The following user says thank you to AXELGREASER 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
Help with basic SMA Crossover strategy kemosabe Automated Trading 9 04-26-2012 12:48 PM
SMA Crossover ktinn Strategy Development 3 03-26-2012 05:07 AM
SMA CrossOver tacticaltrader General Programming 2 09-21-2011 05:25 PM
SMA crossover kaywai Strategy Development 13 12-21-2009 09:37 AM
making a sma crossover strategy quicker to enter and exit GONZO Strategy Analyzer 3 12-10-2009 03:41 PM


All times are GMT -6. The time now is 11:57 AM.