HPotter

EMA & MA Crossover

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.

Skrip open-source

Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Inggin menggunakan skrip ini pada chart?
////////////////////////////////////////////////////////////
//  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 & MA Crossover", shorttitle="EMA & MA Crossover", overlay = true)
LengthMA = input(10, minval=1)
LengthEMA = input(10,minval=1)
xMA = sma(close, LengthMA)
xEMA = ema(xMA, LengthEMA)
pos = iff(xEMA < xMA , 1,
	    iff(xEMA > xMA, -1, nz(pos[1], 0))) 
barcolor(pos == -1 ? red: pos == 1 ? green : blue)
plot(xMA, color=red, title="MA")
plot(xEMA, color=blue, title="EMA")