![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2008
Location: Ann Arbor, MI
Posts: 323
Thanks: 4
Thanked 0 times in 0 posts
|
Hello-
I'm new to NinjaTrader, but not new to programming in C# (I'm working here to port some indicators I wrote in NeoTicker to NinjaTrader). My question involves Ninja Trader's protocol when writing an indicator on an indicator. In this case, the example would be creating a Moving Average on Momentum, which itself is based on a calculated data series. I'm not sure if NinjaTrader allows nested indicators, but here's what I've been doing: Code:
double myValue = Math.Log(System.Convert.ToDouble(Close[0]));
logSeries.Set(myValue);
momentumSeries.Set(Momentum(logSeries, 1)[0] * 100);
M_EMA_1.Set(EMA(momentumSeries, 10)[0]);
Where am I screwing up, and is this even possible? |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Dec 2008
Location: Ann Arbor, MI
Posts: 323
Thanks: 4
Thanked 0 times in 0 posts
|
I tried the following:
Code:
logSeries.Set(Math.Log(System.Convert.ToDouble(Close[0])));
momentumSeries.Set(Momentum(logSeries, 1)[0] * 100);
M_EMA_1.Set(EMA(momentumSeries, LT_ROC_EMA_Period)[0]);
As an aside, how can I debug (set break points) in the NinjaScript editor, or do I load up the .CS project in Visual Studio and wait for Ninja to call it? |
|
|
|
|
|
#3 |
|
NinjaTrader Customer Service
Join Date: Nov 2009
Location: Denver, CO
Posts: 1,424
Thanks: 0
Thanked 3 times in 3 posts
|
Hi cgeorgan,
Welcome to NinjaTrader and to the forum. Nesting the dataseries within an indicator should be no problem. First, please take a look at this page from our help guide for the necessary steps to properly create a data series. Page at - http://www.ninjatrader-support.com/H...culationLogic2 Sample at - http://www.ninjatrader.com/support/f...ead.php?t=7299 Also, check your Log tab in the Control Center while running the indicator, for any errors. As for debugging, you could certainly open the script in VS, or you can use Print() statements or Try/Catch blocks within NinjaTrader. Print()'s - http://www.ninjatrader.com/support/f...ead.php?t=3418 Try/Catch - http://www.ninjatrader.com/support/f...ead.php?t=9825
Tim
NinjaTrader Customer Service |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Dec 2008
Location: Ann Arbor, MI
Posts: 323
Thanks: 4
Thanked 0 times in 0 posts
|
Thanks guys, taking a little time but getting up to speed.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem: basic indicator starts only on 21st bar of a daily chart | CycleArt | Charting | 2 | 06-01-2010 02:05 PM |
| Basic indicator scaling question | jtrade | Charting | 2 | 02-01-2010 06:29 AM |
| Please help me with this basic indicator | suprsnipes | NinjaScript File Sharing Discussion | 1 | 11-06-2009 05:40 AM |
| Can anyone help add a .wav file for alerts to this basic indicator | bigmama | General Programming | 9 | 10-31-2009 12:33 AM |
| Basic Question. | Drakmyre | Strategy Analyzer | 2 | 08-31-2008 11:03 PM |