乖離率自訂指標

  •   225 
  • 最後發表   GD  2020 十二月 16
GD 發文於   2020/12/15

小幫手您好, 

有一組乖離率指標是trading view的語法 , 請問如何能XQ自訂指標的語法中實現呢?

CS, SM, ML 分別是3種不同的乖離率指標

 

study("Price divergence")

cs=(close-ema(close,20))/ema(close,20)*100

sm=(ema(close,20)-ema(close,60))/ema(close,60)*100

ml=(ema(close,60)-ema(close,120))/ema(close,120)*100

plot(ml,"ml",color.silver,linewidth=3,style=plot.style_histogram)

plot(sm,"sm",color.red)

plot(cs,"cs",color.black)

 

感謝!

XQ小幫手 發文於   2020/12/16

GD 您好

看起來是可以的,但是細節可能需要微調一下 

1. 指標的顏色,柱狀or 線條之類的

2.study("Price divergence") 這個我不了解該語法是什麼意思

以下為xs版本 提供給您參考

var:cs(0),sm(0),ml(0);

cs=(close-ema(close,20))/ema(close,20)*100;

sm=(ema(close,20)-ema(close,60))/ema(close,60)*100;

ml=(ema(close,60)-ema(close,120))/ema(close,120)*100;

plot1(ml,"ml");

plot2(sm,"sm");

plot3(cs,"cs");

發表回覆
Close