thyago.weber

EMA 10 21 Crossover

9
Study created using this bicointalk.org tread:

bitcointalk.org/index.php?topic=6050...
Script de código abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un gráfico?
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 20/06/2014
// The Moving Average Crossover trading strategy is possibly the most popular
// trading strategy in the world of trading. First of them were written in the
// middle of XX century, when commodities trading strategies became popular.
// This strategy is a good example of so-called traditional strategies. 
// Traditional strategies are always long or short. That means they are never 
// out of the market. The concept of having a strategy that is always long or 
// short may be scary, particularly in today’s market where you don’t know what 
// is going to happen as far as risk on any one market. But a lot of traders 
// believe that the concept is still valid, especially for those of traders who 
// do their own research or their own discretionary trading. 
// This version uses crossover of moving average and its exponential moving average. 
////////////////////////////////////////////////////////////
study(title="EMA 10 21 Crossover", shorttitle="EMA 10 21 Crossover", overlay = true)
LengthEMA10 = input(10,minval=1)
LengthEMA21 = input(21,minval=1)

xEMA10 = ema(close, LengthEMA10)
xEMA21 = ema(xEMA10, LengthEMA21)

pos = iff(xEMA21 < xEMA10 , 1,
	    iff(xEMA21 > xEMA10, -1, nz(pos[1], 0))) 
barcolor(pos == -1 ? red: pos == 1 ? green : blue)
plot(xEMA10, color=red, title="xEMA10")
plot(xEMA21, color=blue, title="xEMA21")