Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Indicators
Collapse
X
-
Indicator Migration
This is Tradestation code for a double stochastic
[LegacyColorValue = true];
{_DStoc: Double Stochastic}
Inputs: DStLen(NumericSimple);
Vars: Num(0),Denom(0),Ratio(0),PctK(0),DNum(0),DDenom(0) ,
DRatio(0),DPctK(0);
{Stoc}
Num=C-_Lst(L,DStLen);
Denom=_Hst(H,DStLen)-_Lst(L,DStLen);
Ratio=IFF(Denom>0,(Num/Denom)*100,Ratio[1]);
PctK=IFF(CurrentBar=1,Ratio,PctK[1]+(.5*(Ratio-PctK[1])));
{DStoc}
DNum=PctK-_Lst(PctK,DStLen);
DDenom=_Hst(PctK,DStLen)-_Lst(PctK,DStLen);
DRatio=IFF(DDenom>0,(DNum/DDenom)*100,DRatio[1]);
DPctK=IFF(CurrentBar=1,DRatio,DPctK[1]+(.5*(DRatio-DPctK[1])));
_DStoc=DPctK;
Comment
-
Indicator Migration
That works well.
Could you apply this zero lag algoirithim to it...? This code is a TS function called "Zero lag"
[LegacyColorValue = true];
Inputs: Price(NumericSeries), Length(NumericSimple);
Vars: aa(0), bb(0), CA(0), CB(0), CC(0), CD(0), Pricea(0) ;
aa = expvalue(-1.414*3.14159 / Length);
bb = 2*aa*Cosine(1.414*180 / Length);
CB = bb;
CC = -aa*aa;
CA = 1 - CB - CC;
CD = CA*Price + CB*CD[1] + CC*CD[2];
ZeroLag = CD;
If Length < 3 then ZeroLag = Price;
Here is the actual TS Doub STO code with the zero lag applied..._DSTOC is the Doub Sto function I emailed prior...
[LegacyColorValue = true];
Inputs:OverBot(90),overSold(10),DSTlen(10),Priceac tionfilter(5);
Vars: DoubleStoch(0),dir(0);
DoubleStoch =zerolag( _Dstoc(DSTLen),priceactionfilter);
Plot1(DoubleStoch,"DblStoc");
Plot2(OverBot,"Over Bot");
Plot3(OverSold,"Over Sold");
If Plot1>Plot1[1] Then Dir=1;
If Plot1<Plot1[1] Then Dir=-1;
If Dir>0 Then SetPlotcolor(1,cyan);
If Dir<0 Then Setplotcolor(1,magenta);
If Dir[1] <0 and Dir > 0 Then alert("DS Rising");
If Dir[1] >0 and Dir < 0 Then alert("DS Falling");
Comment
-
Here you are :
I didn't know whether you overlay it with DoubleStochastics, but you can certainly do that manually by adding both to the same pane.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by r68cervera, Today, 05:29 AM
|
0 responses
3 views
0 likes
|
Last Post
by r68cervera
Today, 05:29 AM
|
||
Started by geddyisodin, Today, 05:20 AM
|
0 responses
4 views
0 likes
|
Last Post
by geddyisodin
Today, 05:20 AM
|
||
Started by JonesJoker, 04-22-2024, 12:23 PM
|
6 responses
35 views
0 likes
|
Last Post
by JonesJoker
Today, 05:14 AM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
12 responses
3,239 views
0 likes
|
Last Post
by Leafcutter
Today, 05:08 AM
|
||
Hi
by AveryFlynn
Started by AveryFlynn, Today, 04:57 AM
|
0 responses
7 views
0 likes
|
Last Post
by AveryFlynn
Today, 04:57 AM
|
Comment