如需详细帮助请在Teams社群内搜索关键词“TOS”
1.去 Chart 点选 Edit Studies
2.点 Create,输入指标名字和代码即可
MA Deduction 抵扣价+双均线 - 输入以下ThinkScript
input price = close;
input ss = 20;
input mm = 60;
input ll = 120;
def displace = 0;
input paintbars = yes;
plot SMAss = Average(price[-displace], ss);
plot EMAss = ExpAverage(price[-displace], ss);
plot SMAmm = Average(price[-displace], mm);
plot EMAmm = ExpAverage(price[-displace], mm);
plot SMAll = Average(price[-displace], ll);
plot EMAll = ExpAverage(price[-displace], ll);
SMAss.SetStyle(Curve.SHORT_DASH);
SMAss.SetDefaultColor(Color.gray);
EMAss.SetDefaultColor(Color.gray);
SMAmm.SetStyle(Curve.SHORT_DASH);
SMAmm.SetDefaultColor(Color.red);
EMAmm.SetDefaultColor(Color.red);
SMAll.SetStyle(Curve.SHORT_DASH);
SMAll.SetDefaultColor(Color.blue);
EMAll.SetDefaultColor(Color.blue);
plot deductions = (( !IsNaN(close[-ss ]) and IsNaN(close[-ss - 1]))) or (( !IsNaN(close[-mm]) and IsNaN(close[-mm - 1]))) or (( !IsNaN(close[-ll]) and IsNaN(close[-ll - 1])));deductions.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
deductions.SetLineWeight(5);
deductions.SetDefaultColor(Color.yellow);
==============================================
Price Divergence 乖离率 - 输入以下ThinkScript
declare lower;
input ss=20;
input mm=60;
input ll=120;
plot cs;
plot sm;
plot ml;
plot baseline=0;
cs= (close-ExpAverage(close, ss))/ExpAverage(close, ss)*100;
sm=(ExpAverage(close,ss)-ExpAverage(close,mm))/ExpAverage(close, mm)*100;
ml=(ExpAverage(close,mm)-ExpAverage(close,ll))/ExpAverage(close, ll)*100;
baseline.SetDefaultColor(Color.black);
ml.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
cs.SetDefaultColor(Color.white);
sm.SetDefaultColor(Color.green);
ml.SetDefaultColor(Color.gray);
==============================================
Rel 1D - 输入以下ThinkScript
plot r1d=(close/close[1]-close("VTI")/close("VTI")[1])* 100/(close("VTI")/close("VTI")[1]);
AssignBackgroundColor(if r1d >= 2 then createcolor(10, 94, 0) else if r1d > 0 and r1d <2 then createcolor(38, 135, 26) else if r1d < 0 and r1d >-2then createcolor(181, 38, 38) else if r1d <= -2 then createcolor(135, 0, 0) else Color.BLACK);
==============================================
Rel 5D - 输入以下ThinkScript
plot r5d=(close/close[5]-close("VTI")/close("VTI")[5])* 100/(close("VTI")/close("VTI")[5]);
AssignBackgroundColor(if r5d >= 2 then createcolor(10, 94, 0) else if r5d > 0 and r5d <2 then createcolor(38, 135, 26) else if r5d < 0 and r5d >-2then createcolor(181, 38, 38) else if r5d <= -2 then createcolor(135, 0, 0) else Color.BLACK);
==============================================
Rel 1M - 输入以下ThinkScript
plot r1m=(close/close[20]-close("VTI")/close("VTI")[20])* 100/(close("VTI")/close("VTI")[20]);
AssignBackgroundColor(if r1m >= 2 then createcolor(10, 94, 0) else if r1m > 0 and r1m <2 then createcolor(38, 135, 26) else if r1m < 0 and r1m >-2then createcolor(181, 38, 38) else if r1m <= -2 then createcolor(135, 0, 0) else Color.BLACK);
==============================================
C/S - 输入以下ThinkScript
plot cs=(close-ExpAverage(close,20))/ExpAverage(close,20)*100;
AssignBackgroundColor(if cs >= 5 then createcolor(10, 94, 0) else if cs > 0 and cs <5 then createcolor(38, 135, 26) else if cs < 0 and cs >-5then createcolor(181, 38, 38) else if cs <= -5 then createcolor(135, 0, 0) else Color.BLACK);
==============================================
S/M - 输入以下ThinkScript
plot sm=(ExpAverage(close,20)-ExpAverage(close,60))/ExpAverage(close,60)*100;
AssignBackgroundColor(if sm >= 5 then createcolor(10, 94, 0) else if sm > 0 and sm <5 then createcolor(38, 135, 26) else if sm < 0 and sm >-5then createcolor(181, 38, 38) else if sm <= -5 then createcolor(135, 0, 0) else Color.BLACK);
==============================================
M/L - 输入以下ThinkScript
plot ml=(ExpAverage(close,60)-ExpAverage(close,120))/ExpAverage(close,120)*100;
AssignBackgroundColor(if ml >= 5 then createcolor(10, 94, 0) else if ml > 0 and ml <5 then createcolor(38, 135, 26) else if ml < 0 and ml >-5then createcolor(181, 38, 38) else if ml <= -5 then createcolor(135, 0, 0) else Color.BLACK);
JavaScript