NexusFi: Find Your Edge


Home Menu

 





EMA of an EMA in EasyLanguage


Discussion in TradeStation

Updated
    1. trending_up 1,094 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 KySt 
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);


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Czechia Live at 52.5% as England Rides 4-2 Wave to Co-Fa …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
Ninjatrader users - good CONNECTIONs post and article fr …
NinjaTrader
$12M Ceasefire Contract Goes Disputed as Bandar Abbas St …
Prediction Markets & Event Contracts
GDP Day: The First Economic Reckoning -- Pahlavi at 6.55 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
artisanpro
montreal, qc, canada
 
Posts: 28 since May 2021
Thanks Given: 28
Thanks Received: 18

Your TOS code is almost identical to TS. You seem to have EMA's and DMI/ADX calcs in your code. But can you provide a sample graph of the result?

If it is only the ema part that you are asking then in TS
vEMA = Xaverage(price,length);
vEEMA = Xaverage(vEMA,length);

and this is very similar to your current code.


Reply With Quote




Last Updated on May 14, 2023


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts