Dan_Cruise

【PineScript教程】如何利用脚本定制自己的指标----定制EMA均线流

Éducation
Dan_Cruise Mis à jour   
BITSTAMP:LTCUSD   Litecoin
对于TradingView的普通用户来讲,平台限制了用户同时使用的指标数量。
这个时候,我们自己可以利用Pinescript来定制自己的指标,从而来到达自己的要求。

这里分享了EMAs均线流的指标代码,大家可以直接复制,修改其中的参数和颜色即可。
Commentaire:

//@version=4
study(title="Exponential Moving Averages", shorttitle="Ivan_EMAs_Flow", overlay=true)

//定义均线流的各个参数参数

len1 = input(2, minval=1)
len2 = input(3, minval=1)
len3 = input(5, minval=1)

len4 = input(10, minval=1)
len5 = input(20, minval=1)
len6 = input(50, minval=1)

len7 = input(90, minval=1)
len8 = input(120, minval=1)
// len9 = input(120, minval=1)
// len10 = input(150, minval=1)
// len11 = input(180, minval=1)
// len12 = input(200, minval=1)
// len13 = input(300, minval=1)


src = input(close, title="Source")

e1 = ema(src, len1)
e2 = ema(src, len2)
e3 = ema(src, len3)
e4 = ema(src, len4)
e5 = ema(src, len5)
e6 = ema(src, len6)
e7 = ema(src, len7)
e8 = ema(src, len8)
// e9 = ema(src, len9)
// e10 = ema(src, len10)
// e11 = ema(src, len11)
// e12 = ema(src, len12)
// e13 = ema(src, len13)


//绘制均线流
//plot(close, color=color.white)
plot(e1, color=color.red, title="EMA2", linewidth=2)
plot(e2, color=color.orange, title="EMA3", linewidth=2)
plot(e3, color=color.yellow, title="EMA5", linewidth=2)
plot(e4, color=color.green, title="EMA10", linewidth=2)
plot(e5, color=color.blue, title="EMA20", linewidth=2)
plot(e6, color=color.aqua, title="EMA50", linewidth=2)
plot(e7, color=color.purple, title="EMA90", linewidth=2)
plot(e8, color=color.silver, title="EMA120", linewidth=2)

Commentaire:
代码版本移动到以上链接。

唯有机器才能真正做到知行合一
人好,多磨难; 修性,远小人;
Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.