Translate TradingView “EMA Separation Coefficient” to Thinkorswim


Category:
0
0

I’d like to test out an EMA Separation Coefficient Study, but ThinkorSwim doesn’t seem to provide one.  Apparently, it’s available in TradingView.  Here’s a link: https://www.tradingview.com/script/EZlRef3m/.  There is some script for the study on the linked page:

/@version=4
study(“EMA Separation Coefficient”)
fast = input(title=”Fast moving average”,type=input.integer,defval=12)
slow = input(title=”Slow moving average”,type=input.integer,defval=26)
fastMA = ema(close, fast)
slowMA = ema(close, slow)
esc=fastMA-slowMA
emaCrossZeroDown = crossunder(esc, 0)
emaCrossZeroUp   = crossover(esc, 0)
hline(0, title=”Zero”, color=color.gray, linestyle=hline.style_dashed)
plot(esc, color=color.red)

Can anyone please help me to adapt this script to work in ThinkorSwim?

Marked as spam
Posted by (Questions: 2, Answers: 0)
Asked on September 13, 2024 1:49 pm
9 views
0
Private answer

Here is most basic translation of that indicator from TradingView to Thinkorswim:

declare lower;
input fastLength = 12;
input slowLength = 26;
plot diff = ExpAverage(close, fastLength) - ExpAverage(close, slowLength);
diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
diff.SetLineWeight(3);
plot zeroLine = if !IsNaN(close) then 0 else Double.NaN;

Marked as spam
Posted by (Questions: 37, Answers: 4108)
Answered on September 13, 2024 1:53 pm