![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Senior Member
Join Date: Apr 2008
Posts: 164
Thanks: 2
Thanked 3 times in 3 posts
|
Hi guys,
I've got some code here that is called from BarsArray[0], calculating moving averages based on BarsArray[1] and BarsArray[2]. If I call it once, for only one of the timeframes, the code works fine. If I call it twice I get two messages, one the Ninja-has-to-quit crash message, and another saying the indicator cannot be serialised. OnBarUpdate calls a method which does this: Code:
switch (MAType)
{
case KashMTFMA_MAType1098.SMA:
result = (SMA(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.EMA:
result = (EMA(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.HMA:
result = (HMA(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.LinReg:
result = (LinReg(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.SMMA:
result = (SMMA(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.TEMA:
result = (TEMA(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.TMA:
result = (TMA(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.VMA:
result = (VMA(Closes[ma_number+1],MAPeriod, MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.VWMA:
result = (VWMA(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.WMA:
result = (WMA(Closes[ma_number+1],MAPeriod)[0]);
break;
case KashMTFMA_MAType1098.Off:
result = double.MinValue;
break;
}
If you can shed any light on why calling this twice would break Ninja, or can suggest another elegant 'correct' way to to achieve the same result of calculating multiple moving average types on multiple iDataSeries, please let me know. Thanks, saltminer
Last edited by saltminer; 02-15-2011 at 01:44 AM.
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
saltminer, can you perhaps send us the indicator to test including the trace you got to support at ninjatrader dot com? Currently I see no reason why it should behave like you experienced here...
Thanks,
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Apr 2008
Posts: 164
Thanks: 2
Thanked 3 times in 3 posts
|
I removed and reinstalled Ninja (including a brand new user folder) to use the developer beta version of CliSecure. I had also had a strange problem with the built in Woodies indicator causing a strategy not to compile.
Got that fixed, and now the indicator with the code below is working fine! Blame it on poltergeists. Thanks for the always prompt support. saltminer |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
You're welcome, thanks for reporting back - I'm glad to hear all is well now.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi Moving averages | deanldavis475 | Indicator Development | 1 | 12-09-2010 09:55 AM |
| Two moving averages indicator. | germano | Indicator Development | 2 | 01-04-2010 05:25 AM |
| Displaced moving averages | ggloor | Charting | 6 | 10-11-2009 02:11 AM |
| Three moving averages | germano | Indicator Development | 2 | 07-24-2009 12:39 PM |
| Displaced moving averages | T2020 | Charting | 2 | 01-20-2009 09:13 AM |