![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Question:
Quote:
The CrossAbove() and CrossBelow() methods have a signature such as: CrossAbove(series1, series2, lookBackPeriod) Where "lookBackPeriod" sets the number of bars where the cross must have occured within for the method to return a true value. Therefore, if you want to check if the Cross of two MA's occured within the last three bars, you would write: if (CrossAbove(SMA(10), SMA(20), 3)) // Do something
Ray
NinjaTrader Customer Service |
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2007
Posts: 176
Thanks: 0
Thanked 0 times in 0 posts
|
Hello Ray,
I what to use the CrossAbove of two MA's. One SMA using a 5 period close and the other SMA using a 5 period open. How would I do that based on your example below? if (CrossAbove(SMA(10), SMA(20), 3)) // Do something Would it be something like this?: if (CrossAbove(SMA(5 close), SMA(5 open), 1)) // Do something Thanks |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2005
Location: , Ontario, Canada
Posts: 400
Thanks: 0
Thanked 0 times in 0 posts
|
if (CrossAbove(SMA(Close,5), SMA(Open,5), 1))
// Do something Should do it. Take a look at the strategy tutorial .. http://www.ninjatrader-support.com/H...helpguide.html In particular .. step 3. See the box in the diagram called InputSeries - 'Default Input' ? YOu can click that, and then refer to any price/indicator you want.. For example, Close, Open, Typical .. or even another indicator. Very powerful. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Line "names" in Indicator Box change to "Line" after modification | higler | Charting | 3 | 05-02-2007 06:05 AM |
| Multiple Simultaneous Trades at "Exit on Close" With Setting "1 Entry Per Direction&q | KBJ | Strategy Analyzer | 1 | 04-27-2007 05:34 AM |
| Problem with opening application and trying to preserve prior "workspace" | Greg1 | Miscellaneous Support | 8 | 04-14-2007 01:49 PM |
| Control center "strategies" tab, "Positions tab, and "Market Analyzer" not | funk101 | Strategy Development | 6 | 04-10-2007 03:44 AM |
| Entry: "CIT" and "Chase" | wagross | Miscellaneous Support | 1 | 12-15-2004 03:43 AM |