NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-19-2007, 10:17 PM   #1
stevestrading
Junior Member
 
Join Date: Jun 2007
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default Need Help Programming Custom Indicator from TS to NT

Hello,

I'm a new NinjaTrader user and am trying to convert some indicators I wrote using EasyLanguage in Tradestation into NT. I've been successful at a few, but this one, I cannot figure out. I have no experience in C#, just read the help files on NT website. It seems to not be possible to reference previous bar values of the double type variable, which I was able to do in TS.

If anyone can help me with the ninjascript code for the following, I would greatly appreciate it.

========================================

Inputs: Price(Close), Length(14), Displace(0), ROCAve1(4), ROCAve2(6);

Value1 = LinearRegValueFC(Price, Length, 0);
Value2 = Value1[0] - Value1[1];
Value3 = XAverage(Value2, ROCAve1);
Value4 = Value3[0] - Value3[1];
Value5 = XAverage(Value2, ROCAve2);
Value6 = Value5[0] - Value5[1];

Plot1(Value2, "LinRegROC");
Plot2(Value3, "LRegROCAve1");
Plot3(Value5, "LRegROCAve2");
Plot4(0, "Zero");
stevestrading is offline  
Reply With Quote
Old 06-20-2007, 02:59 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

You would need to use a "DataSeries" variable. Please check out e.g. the ADX indicator implementation. It's using several of these variables ("dmPlus", "dmMinus" ...).
NinjaTrader_Dierk is offline  
Reply With Quote
Old 06-20-2007, 07:40 AM   #3
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Also: pls see here http://www.ninjatrader-support.com/H...taSeriesObject
NinjaTrader_Dierk is offline  
Reply With Quote
Old 06-20-2007, 04:01 PM   #4
stevestrading
Junior Member
 
Join Date: Jun 2007
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you very much. With the references you gave me, I was able to program this indicator using Ninjascript.
stevestrading is offline  
Reply With Quote
Old 06-20-2007, 04:31 PM   #5
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Excellent! Glad you were able to get through it.

Just as an FYI, in TS, they hide what you just went through underneath the user programming layer. Although this can be easier for new C# programmers, it does come at the expense of performance. Although we provide a lot of convenience methods and properties, we stay true to the language and provide the raw programming capability that C# and the .NET framework provide.
NinjaTrader_Ray is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing value from custom indicator from strategy funk101 Strategy Development 12 08-19-2008 08:41 AM
Easy way to rename a custom indicator? higler Indicator Development 2 05-19-2007 10:47 AM
Adding a second symbol to a custom indicator Folls Indicator Development 7 05-07-2007 02:06 AM
Using a custom indicator SuzyG Strategy Development 17 03-13-2007 10:59 AM
Can't access 1 bar ago in custom indicator AlohaBob Indicator Development 1 01-07-2007 02:42 AM


All times are GMT -6. The time now is 11:03 PM.