NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 05-22-2009, 01:16 PM   #1
donatella
Junior Member
 
Join Date: Apr 2009
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
Default How do I translate this TS code in NT language?

Hi. A fellow TTM member posted this code in the forum: it takes RSI values from 4 different time frames, and plots colored dots (4 rows of them) on the same chart. Can anybody please tell me how I could do this on Ninja? Any help is REALLY REALLY appreciated, thank you.


Inputs: UpperRSILevel(55), LowerRSILevel(45);

Variables: RSI1(0), RSI2(0), RSI3(0), RSI4(0);

RSI1 = RSI(Close of Data1, 14);
RSI2 = RSI(Close of Data2, 14);
RSI3 = RSI(Close of Data3, 14);
RSI4 = RSI(Close of Data4, 14);

Plot1(4, "RSI1", yellow);
Plot2(3, "RSI2", yellow);
Plot3(2, "RSI3", yellow);
Plot4(1, "RSI4", yellow);

If RSI1 > UpperRSILevel then Plot1(4, "RSI1", cyan);
If RSI1 < LowerRSILevel then Plot1(4, "RSI1", red);
If RSI2 > UpperRSILevel then Plot2(3, "RSI2", cyan);
If RSI2 < LowerRSILevel then Plot2(3, "RSI2", red);
If RSI3 > UpperRSILevel then Plot3(2, "RSI3", cyan);
If RSI3 < LowerRSILevel then Plot3(2, "RSI3", red);
If RSI4 > UpperRSILevel then Plot4(1, "RSI4", cyan);
If RSI4 < LowerRSILevel then Plot4(1, "RSI4", red);
donatella is offline  
Reply With Quote
Old 05-22-2009, 01:37 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

donatella,

I suggest you start with the tutorials on how to make your own custom indicator here: http://www.ninjatrader-support.com/H...tml?Overview23
NinjaTrader_Josh is offline  
Reply With Quote
Old 05-25-2009, 09:59 AM   #3
MicroAl
Senior Member
 
Join Date: Jan 2008
Posts: 183
Thanks: 0
Thanked 1 time in 1 post
Default Translating Code

Donatella

That's a nice bit of code from the Forum. It can be easy adjusted to look at other indicators as well. I cannot translate it for you into C# but if you look at the indicator file sharing section, there is an indicator there that gives you coloured dashes based on different time frames, which may give you a clue.

IMHO to use Ninja and to get the most out of it you have to learn at least some C#. However since Ninja is based on C# you can extend its features almost endlessly. If you are completely new to C# I would certaintly recommend you have a look at the MSDN beginner training videos.

For the moderators - It would be nice in an example such as this to be able to point the prospective customer/subscriber to a few hours of basic Ninja programming videos. I know you do excellent online seminars but there is really not much on Ninjascript programming.
MicroAl is offline  
Reply With Quote
Old 05-25-2009, 10:14 AM   #4
donatella
Junior Member
 
Join Date: Apr 2009
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
Default

thanks, microal, i was actually able to write a strategy based on that code. i need to adjust a few things, i'm trying to figure out how to tell it that i don't want to reverse my position, but only enter if i'm flat. i never got to the point of actually plotting the colored rows, but i'll take a look at your suggestion, thanks so much
donatella is offline  
Reply With Quote
Old 05-25-2009, 11:03 AM   #5
momentom
Member
 
Join Date: Apr 2007
Location: , ,
Posts: 89
Thanks: 0
Thanked 0 times in 0 posts
Default

donatella, that easylanguage code is looking at different datastreams of data - usually its different timeframes such as 1 minute and 3 minutes and 5 minutes. I didn't think multiple simultaneous timeframes are available in NT.
momentom is offline  
Reply With Quote
Old 05-25-2009, 11:04 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

donatella, you can work with Position.MarketPosition to check if you're flat - http://www.ninjatrader-support.com/H...tPosition.html

This kind of MultiTime code is supported in a MultiTime strategy - http://www.ninjatrader-support.com/H...struments.html

For indicators this will be possible with NinjaTrader 7 since it will add MultiSeries charting features.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 05-25-2009, 11:49 AM   #7
donatella
Junior Member
 
Join Date: Apr 2009
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
Default

that's it, bertrand, thank you, now it's making sense
donatella 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
Translate Amibroker Code to Ningatrader kjw4255 General Programming 1 05-14-2008 10:16 AM
Can somebody translate this Laguerre indicator to NT??? VagyokC4 Indicator Development 3 03-23-2008 11:20 AM
How does NT translate contract specifications? arbifox Automated Trading 4 12-16-2007 09:06 PM
Can someone please translate this TS indicator code to NT Razor_Trader Indicator Development 2 11-21-2007 06:48 PM
Using DLL Interface in TS Easy Language Strategy robninja Automated Trading 1 06-03-2007 11:22 AM


All times are GMT -6. The time now is 06:07 AM.