Accokeek, USA
Experience: Intermediate
Platform: NT & TOS
Trading: ES RUT
Posts: 92 since Mar 2011
Thanks Given: 17
Thanks Received: 24
|
Hello all, I'm new to TS and have a number of indicators I'd like to convert from TOS to TS.
I tried, what I thought would be a simple conversion, using an existing TS code for an EMA. It's not working..lol
Can someone help me with the conversion? I'll include the whole script including the cloud. Your help is appreciated. - Ky
input price = close;
input length = 17;
input length2 = 34;
input displace = 0;
input showcloud = yes;
input showlabel = yes;
###### See Ky_Smooth55 ########
def EP = ExpAverage(price[-displace], length);
def EEP = ExpAverage(EP, length);
def DoubleEMA = EEP;
plot DSEMA = EEP;
DSEMA.SetDefaultColor(CreateColor(75, 149, 237));
DSEMA.SetPaintingStrategy(PaintingStrategy.LINE);
DSEMA.SetLineWeight(2);
DSEMA.HideBubble();
DSEMA.HideTitle();
DSEMA.DefineColor("Up", (CreateColor(0, 102, 204)));
DSEMA.DefineColor("Down", (CreateColor(204, 0, 0)));
DSEMA.AssignValueColor(if DSEMA > DSEMA[1] then DSEMA.Color("Up") else DSEMA.Color("Down"));
###### EXP #########
def AvgExp = ExpAverage(price[-displace], length2);
###### CLOUD #######
DefineGlobalColor("Bull", CreateColor(0, 51, 204));
DefineGlobalColor("Bear", Color.RED);
AddCloud(if showcloud then AvgExp else Double.NaN, DoubleEMA, GlobalColor("Bull"), GlobalColor("Bear"));
###ADX Trend, Chop, EndTrend-- DMPlus
input length3 = 20;
input averageType = AverageType.WILDERS;
def hiDiff = high - high[1];
def loDiff = low[1] - low;
def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
def ATR = MovingAverage(averageType, TrueRange(high, close, low), length3);
def "DI+" = 100 * MovingAverage(averageType, plusDM, length3) / ATR;
def "DI-" = 100 * MovingAverage(averageType, minusDM, length3) / ATR;
def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
def ADX = MovingAverage(averageType, DX, length3);
AddLabel (showlabel, if ADX > "DI+" and ADX > "DI-" then "END TREND" else if ADX < "DI+" and ADX < "DI-" then "CHOP" else "OOC", if ADX > "DI+" and ADX > "DI-" then Color.YELLOW else if ADX < "DI+" and ADX < "DI-" then Color.DARK_GRAY else Color.LIGHT_GREEN);
|