NinjaTrader Support Forum  

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 07-06-2007, 04:04 PM   #16
Bluemaze
Junior Member
 
Join Date: Jul 2007
Posts: 8
Thanks: 0
Thanked 0 times in 0 posts
Default Rei

Thanx much also Gump, I looked at your code and found one improvement I could make to mine.
Bluemaze is offline  
Reply With Quote
Old 07-06-2007, 04:09 PM   #17
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

Quote:
Originally Posted by Bluemaze View Post
It worked,
Thanx much Ray, first day on NT here, I am as green as they get :-)

Welcome aboard!
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-08-2007, 07:15 AM   #18
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

I have also switched from Tradestation to Ninjatrader and I'm glad I did.
It also took me a while to get familiar with ninjascript (and I'm still working on it, C# is new for me too) but it is WAY more powerful than Tradestation EL.

I still feel that the very simple things are more quickly implemented in EL than in NTscript, however the more complicated stuff is easier in NTscript. One of the reasons is that you can structure your code much better in NTscript than in EL.

For the people who need more indicators, maybe a seperate section in this supportforum can be setup where NT users can share their indicators. Personally I prefer that the developers at Ninjatrader company focus on debugging and adding new features to NT instead of translating hundreds of indicators.
FireFly is offline  
Reply With Quote
Old 07-09-2007, 10:51 AM   #19
dwalls
Senior Member
 
Join Date: Jul 2007
Posts: 176
Thanks: 0
Thanked 0 times in 0 posts
Default T3 Moving Average Indicator

Hello, Would it be possible for NinjaTrader to create the Tim Tillson's T3 Moving Average Indicators...the T3, T5 and T8. They are fairly common indicators. I would like to be able to then create a crossover strategy using the T3's not unlike the "Sample moving average crossover" strategy provided in your strategies folder. Maybe you could make just the one indicator and be able to adjust the periods instead of making three seperate indicators. I just need to have them seperate to create the crossover strategy.

A version of the indicator is located at http://www.amibroker.com/library/detail.php?id=852.

Another sample is in Metastock code:This is the 3 period:
e1:=Mov(C,3,E);
e2:=Mov(e1,3,E);
e3:=Mov(e2,3,E);
e4:=Mov(e3,3,E);
e5:=Mov(e4,3,E);
e6:=Mov(e5,3,E);
c1:=-.7*.7*.7;
c2:=3*.7*.7+3*.7*.7*.7;
c3:=-6*.7*.7-3*.7-3*.7*.7*.7;
c4:=1+3*.7+.7*.7*.7+3*.7*.7;
c1*e6+c2*e5+c3*e4+c4*e3;

Thanks for your help.
dwalls is offline  
Reply With Quote
Old 07-09-2007, 11:27 AM   #20
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

Hi,

I will add this request to our list of features for future consideration. I can not guarantee if and when we could accomodate this request at this time.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-09-2007, 03:54 PM   #21
dwalls
Senior Member
 
Join Date: Jul 2007
Posts: 176
Thanks: 0
Thanked 0 times in 0 posts
Default

If anyone in this forum knows how to write of convert the code below for the T3's it would be greatly appreciated. I also have attached the code from eSignal. Maybe it can help.

// NOTE:
// This efs requires amStudies.efsLib in the FunctionLibrary folder.
// If you do not have this file you can download it at the link below.
// http://share.esignal.com/groupconten...ies&groupid=10
var fpArray = new Array();
function preMain() {
setPriceStudy(true);
setStudyTitle("T3 MA");
setCursorLabelName("T3",0);
setDefaultBarFgColor(Color.blue,0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
askForInput();

var x=0;
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(6);
}
fpArray[x] = new FunctionParameter("Factor", FunctionParameter.NUMBER);
with(fpArray[x++]){
setUpperLimit(1);
setLowerLimit(0);
setDefault(0.7);
}
fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("close");
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Offset", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(0);
}
fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Parameters");
setDefault(false);
}
}
var amLib = addLibrary("amStudies.efsLib");
var bInit = false;
var xT3 = null;
function main(Length,Factor,Source,Symbol,Interval,Offset,P arams) {
if(bInit == false){
with( amLib ) {
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
var vSymbol = Symbol+","+Interval;
xT3 = offsetSeries(amT3(Length,Factor,eval(Source)(sym(v Symbol))),Offset);
setShowTitleParameters(eval(Params));
bInit = true;
}
}
return getSeries(xT3);
}
dwalls is offline  
Reply With Quote
Old 07-10-2007, 02:24 AM   #22
Gumphrie
Senior Member
 
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
Default

Dwalls,

What sort of moving average do these indicators need? The original AmiBroker code you posted specifies "Mov", while the link on AmniBroker specifies "AMA" (is that the same as KAMA?).

Also on the T3 the code you posted uses "0.7" whereas the link specifies "5". So we need to make that value a parameter, but what is it?

Answer these questions and perhaps a screenshot and it should be pretty simple to knock up.
Gumphrie is offline  
Reply With Quote
Old 07-10-2007, 11:18 AM   #23
whitmark
Certified NinjaScript Consultant
 
Join Date: Nov 2005
Location: Virginia, USA
Posts: 441
Thanks: 0
Thanked 12 times in 7 posts
Send a message via Skype™ to whitmark
Default

Fwiw, most traders that I know that use to work with the T3 or some derivation, including myself, have since switched to using the Hull Moving Average or HMA which is already available as a standard indicator. At the time that I switched (using another platform) I recall convincing myself that the HMA was smoother yet exhibited less lag than the T3 indicator for my applications. Your mileage may vary.

Regards,

Whitmark
whitmark is offline  
Reply With Quote
Old 07-10-2007, 01:45 PM   #24
dwalls
Senior Member
 
Join Date: Jul 2007
Posts: 176
Thanks: 0
Thanked 0 times in 0 posts
Default

Gumphrie,
Here is another similar formula I found:

Description:

Trading system based on cubing of function (1+a)-ax^2 where a is the amplification ( 0 < a < 1.0, I use 0.7) and en is the exponentially smoothed average of the closing price.

Formula:

/* T3 trading system */
a = 0.7;
n = 2;

alpha = 2/(n + 1);
e1 = ema(close, n);
e2 = ema (e1, n);
e3 = ema (e2, n);
e4 = ema (e3, n);
e5 = ema (e4, n);
e6 = ema (e5, n);

T3 = -a^3 * e6 + (3 * a^2 +3 * a^3) * e5 + (-6 * a^2 - 3 * a - 3 * a^3) * e4 + (1 + 3 * a + a^3 + 3 * a^2) * e3;

graph0 = close;
graph1 = T3;

SELL = cross ( Close, T3 );
BUY = cross (T3, Close );
SHORT = cross ( Close, T3);
COVER = cross (T3, Close );

Maybe this will help you.Thanks for your help.
dwalls is offline  
Reply With Quote
Old 07-11-2007, 06:36 PM   #25
Gumphrie
Senior Member
 
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
Default

Dwalls,

Is this correct? (find attached).
Don't forget to compile it in the Ninjascript Indicator ediror after placing it in "My Documents\NinjaTrader 6\bin\Custom\Indicator"

- attachment removed -
Last edited by Gumphrie; 07-12-2007 at 02:04 AM.
Gumphrie is offline  
Reply With Quote
Old 07-11-2007, 06:48 PM   #26
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

Thanks for contributing Gumphrie!

Did you know that you can export a script via File > Utilities > Export NinjaScript ? This creates a zip file that people can then import which automatically compiles.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-11-2007, 08:24 PM   #27
dwalls
Senior Member
 
Join Date: Jul 2007
Posts: 176
Thanks: 0
Thanked 0 times in 0 posts
Default

Gumphrie,

Thanks for your help.
It is suppose to be an overlay of price just like any other moving average.
I attached a screen shot of the indicator on eSignal. The yellow line is the 3 period and the white line is the 5 period. I cant seem to get a picture of the eSignal Study Properties so I will type them out:

Parameter Value Default
Lenght1 5 5
Lenght2 3 3
Factor 0.7 0.7
Source close close
Symbol n/a n/a
Interval n/a n/a
Offset 0 0
Show Parameters false false
Linecolor1 white white
Linecolor2 yellow yellow

I hope this helps.
Thanks again.
Attached Images
File Type: png snapshot-16.png (60.6 KB, 328 views)
dwalls is offline  
Reply With Quote
Old 07-11-2007, 08:51 PM   #28
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

You can add the line within the Initialize() method:

Overlay = true;

and then recompile or;

When adding the indicator to the chart, just change the panel property to a value of 1.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-11-2007, 09:19 PM   #29
dwalls
Senior Member
 
Join Date: Jul 2007
Posts: 176
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks NinjaTrader Ray,

When I did as you suggested, the chart flatlines. I can see the red indicator line well below price, its way down there and flatlined.
I also added the also:

PriceTypeSupported = true;

and that didnt help either.

Thanks for your help.
dwalls is offline  
Reply With Quote
Old 07-12-2007, 02:03 AM   #30
Gumphrie
Senior Member
 
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
Default

Thought that would happen (which is why a screenshot helps).
Try the attached version. The zip file is a NinjaScript export file.
Attached Files
File Type: cs T3.cs (5.9 KB, 80 views)
File Type: zip T3.zip (3.3 KB, 143 views)
Last edited by Gumphrie; 07-12-2007 at 02:20 AM.
Gumphrie 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
Ratcheting Indicators sknudsen Strategy Analyzer 1 05-21-2007 08:08 PM
Indicators nelson Charting 1 05-21-2007 11:00 AM
Indicators value on the current bar Paolo333 Charting 8 05-08-2007 09:14 AM
KwikPop Indicators BradB Automated Trading 1 04-03-2007 03:26 AM
TTM Indicators Freddie Indicator Development 1 03-11-2007 06:28 AM


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