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 05-09-2009, 11:34 AM   #1
SNIP07
Junior Member
 
Join Date: May 2009
Posts: 20
Thanks: 0
Thanked 0 times in 0 posts
Default Strategy Wizard question candle between EMA's

I am a new user of the NT. It is really an amazing software. I am trying to make some sample backtesting, I've spent hours trying to get the Strategy Wizard's functions do what I want Please help me out with this:

I want to enter long when these conditions are present:

20EMA above 50EMA and open&close of the candle (full body) is in within the range of 20EMA and 50EMA, enter long one tick above the high.


Obviously my logic is not what of the Strategy Wizard, this is what I put what seems as logic to me:

Conditions:

EMA(20)[1]>EMA(50)[1]
Close[1]>=EMA(50)[1]
Open[1]>=EMA(50)[1]
Close[1]<=EMA(20)[1]
Open[1]<=EMA(20)[1]

I also tried to use separate Sets for each, nothing seems to work

Do following:

Enter long position

In words the idea is the fast ema must be above slow ema, price then must come to the range between fast and slow ema's whole candle must form within this range. Enter long next bar one tick above.

I'll appreciate any help.
Thank you.
Last edited by SNIP07; 05-09-2009 at 11:47 AM.
SNIP07 is offline  
Reply With Quote
Old 05-09-2009, 12:14 PM   #2
roonius
Certified NinjaScript Consultant
 
Join Date: Oct 2008
Location: Chicago, IL
Posts: 523
Thanks: 0
Thanked 3 times in 3 posts
Send a message via Skype™ to roonius
Default

Quote:
Originally Posted by SNIP07 View Post
I am a new user of the NT. It is really an amazing software. I am trying to make some sample backtesting, I've spent hours trying to get the Strategy Wizard's functions do what I want Please help me out with this:

I want to enter long when these conditions are present:

20EMA above 50EMA and open&close of the candle (full body) is in within the range of 20EMA and 50EMA, enter long one tick above the high.


Obviously my logic is not what of the Strategy Wizard, this is what I put what seems as logic to me:

Conditions:

EMA(20)[1]>EMA(50)[1]
Close[1]>=EMA(50)[1]
Open[1]>=EMA(50)[1]
Close[1]<=EMA(20)[1]
Open[1]<=EMA(20)[1]

I also tried to use separate Sets for each, nothing seems to work

Do following:

Enter long position

In words the idea is the fast ema must be above slow ema, price then must come to the range between fast and slow ema's whole candle must form within this range. Enter long next bar one tick above.

I'll appreciate any help.
Thank you.
Can you post your entire code?
roonius is offline  
Reply With Quote
Old 05-09-2009, 12:35 PM   #3
SNIP07
Junior Member
 
Join Date: May 2009
Posts: 20
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by roonius View Post
Can you post your entire code?
Roonius, Im not using program coding, I use Wizard. This condition is all I need, all other parts of the method I used I could figure out myself.
SNIP07 is offline  
Reply With Quote
Old 05-09-2009, 12:51 PM   #4
roonius
Certified NinjaScript Consultant
 
Join Date: Oct 2008
Location: Chicago, IL
Posts: 523
Thanks: 0
Thanked 3 times in 3 posts
Send a message via Skype™ to roonius
Default

Quote:
Originally Posted by SNIP07 View Post
Roonius, Im not using program coding, I use Wizard. This condition is all I need, all other parts of the method I used I could figure out myself.
try changing all [1] to [0]
roonius is offline  
Reply With Quote
Old 05-09-2009, 12:56 PM   #5
SNIP07
Junior Member
 
Join Date: May 2009
Posts: 20
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by roonius View Post
try changing all [1] to [0]
Roonius, I did try that too. Didnt work. Am I doing it correct putting all these under one Set 1? This seems to be a simple function, dont know why my NT doesnt understand it.
SNIP07 is offline  
Reply With Quote
Old 05-09-2009, 02:27 PM   #6
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Debugging is always the frustrating part of any type of logic development. Here are some tips -

- Strip down your strategy a single condition 20 MA > 50 MA
- For your action, just color the bar or draw some sort of chart marker on the bar when this condition evaluates to true
- Throw this strategy on a chart (backtest), inspect the chart, are the markers where you expect them
- Add the next line, Close < 50 MA etc...
- Repeat this process until it no longer delivers against your expectations, then you know where your logic issue is
NinjaTrader_Ray 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
Strategy Wizard Question 123r34 Strategy Development 3 02-23-2010 05:33 AM
Strategy Wizard Question PraiseOne Strategy Development 12 03-25-2009 06:42 AM
Strategy Wizard Question PraiseOne NinjaScript File Sharing Discussion 0 03-23-2009 05:33 PM
Strategy Wizard Question 123r34 Strategy Development 4 02-24-2009 05:00 PM
Strategy Wizard Question RSTLNE Strategy Development 4 09-03-2008 08:12 AM


All times are GMT -6. The time now is 12:51 PM.