![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Oct 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
Anyone know why these expressions would evaluate differently?
CrossAbove(Close[0], EMA(m_FastPeriod), 1): False CrossAbove(Close, EMA(m_FastPeriod), 1): True 6/4/2009 6:39:01 PM
Last edited by un$ane; 06-04-2009 at 08:47 PM.
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
Welcome to our forums, please check this link and try reversing the order when you compare a double and a dataseries in the CrossAbove / CrossBelow - http://www.ninjatrader-support.com/H...rossAbove.html
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
Does that mean this method is invalid?
public bool CrossAbove(double value, IDataSeries series2, int lookBackPeriod); I can't seem to get either one of these to evaluate to True: CrossAbove(EMA(m_FastPeriod), Close[0], 1); CrossAbove(Close[0], EMA(m_FastPeriod), 1); In my strategy I'm using: CalculateOnBarClose = true; if (BarsInProgress == 0 && FirstTickOfBar) Thanks for the reply.
Last edited by un$ane; 06-05-2009 at 09:22 AM.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
Please try using then and see if this evaluates to 'true' -
Code:
CrossAbove(Close, EMA(m_FastPeriod), 1);
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Oct 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
It does...But I'm curious why the others don't. I'm now questioning my understanding of the concept and/or whether there's a bug.
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
If you submit a double, it has no history of values to compare so it would never cross.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Oct 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
oh...That makes sense!
Kinda weird why those methods exist, but at least I can sleep better tonight ![]() Thxs Bertrand. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calculate On Bar Close - Unexpected Results | r2kTrader | Strategy Development | 13 | 02-22-2011 11:03 AM |
| Sounds & position close w/strategy on | nicknamed | Suggestions And Feedback | 2 | 05-20-2009 06:03 AM |
| Enter at Close, Exit next day Close | tjendra | Strategy Development | 3 | 04-08-2009 11:33 AM |
| Why is Market Analyzer not even close to realized results? | bluelou | Market Analyzer | 2 | 03-24-2009 08:09 AM |
| Charting high/low/close and open/close widths | gluebunny | Charting | 11 | 09-29-2008 10:47 AM |