![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
|
please. could you help to write indicator correctly
formula of indicator: moving average ( abs( Close - Open), any period) i wrote SMA(Math.Abs(Close - Open)), Period) [0] and get error NT0019
Last edited by stasbz; 06-05-2010 at 01:40 PM.
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Thank you for your first forum post! Can you please let me know what error you received and also post the section of the code that the error message indicates has an error. I look forward to assisting you further.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Certified NinjaScript Consultant
Join Date: Sep 2006
Location: New York, USA
Posts: 774
Thanks: 1
Thanked 7 times in 5 posts
|
stasbz,
You are passing in a value. You need to pass in a dataseries. Create a dataseries like this. Code:
private DataSeries sAbs;
protected override void Initialize()
{
sAbs = new DataSeries(this);
}
protected override void OnBarUpdate()
{
sAbs.Set(Open[0] - Close[0]);
double smaValue = SMA(sAbs, Period)[0];
}
"You look closely enough, you can find everything has a ... weak spot where it can break, sooner or later"
PureLogikTrading |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Thanks for the assist Mr. Logik. Let me know if I can be of further assistance.
Brett
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SMA efficiency | dave1992 | Indicator Development | 1 | 05-29-2010 08:25 AM |
| How to write simple indicator? | jim c | Indicator Development | 1 | 03-31-2010 12:47 PM |
| Trying to write a 'divergence' indicator | DancesWithBears | Indicator Development | 2 | 07-29-2009 08:47 PM |
| Looking for someone to write a simple indicator for me | pclark | Indicator Development | 2 | 09-06-2008 11:05 PM |
| How to write new indicator? | jcrecruit | Indicator Development | 4 | 10-19-2007 03:36 AM |