Rewrite the macd(trading view) code on mt5

MQL5 Göstergeler Komut dosyaları

İş Gereklilikleri

rewrite the macd(trading view) code on mt5

//@version=5
indicator(title="Moving Average Convergence Divergence", shorttitle="MACD", timeframe="", timeframe_gaps=true)
// Getting inputs
fast_length = input(title = "Fast Length", defval = 12)
slow_length = input(title = "Slow Length", defval = 26)
src = input(title = "Source", defval = close)
signal_length = input.int(title = "Signal Smoothing",  minval = 1, maxval = 50, defval = 9, display = display.data_window)
sma_source = input.string(title = "Oscillator MA Type",  defval = "EMA", options = ["SMA", "EMA"], display = display.data_window)
sma_signal = input.string(title = "Signal Line MA Type", defval = "EMA", options = ["SMA", "EMA"], display = display.data_window)
// Calculating
fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length)
slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
hist = macd - signal

alertcondition(hist[1] >= 0 and hist < 0, title = 'Rising to falling', message = 'The MACD histogram switched from a rising to falling state')
alertcondition(hist[1] <= 0 and hist > 0, title = 'Falling to rising', message = 'The MACD histogram switched from a falling to rising state')

hline(0, "Zero Line", color = color.new(#787B86, 50))
plot(hist, title = "Histogram", style = plot.style_columns, color = (hist >= 0 ? (hist[1] < hist ? #26A69A : #B2DFDB) : (hist[1] < hist ? #FFCDD2 : #FF5252)))
plot(macd,   title = "MACD",   color = #2962FF)
plot(signal, title = "Signal", color = #FF6D00)


Yanıtlandı

1
Geliştirici 1
Derecelendirme
(431)
Projeler
488
33%
Arabuluculuk
25
40% / 48%
Süresi dolmuş
7
1%
Çalışıyor
2
Geliştirici 2
Derecelendirme
(561)
Projeler
928
48%
Arabuluculuk
301
59% / 25%
Süresi dolmuş
123
13%
Yüklendi
3
Geliştirici 3
Derecelendirme
(252)
Projeler
570
36%
Arabuluculuk
64
20% / 58%
Süresi dolmuş
147
26%
Ücretsiz
4
Geliştirici 4
Derecelendirme
(236)
Projeler
440
26%
Arabuluculuk
125
21% / 56%
Süresi dolmuş
96
22%
Çalışıyor
5
Geliştirici 5
Derecelendirme
(6)
Projeler
12
25%
Arabuluculuk
0
Süresi dolmuş
0
Ücretsiz
6
Geliştirici 6
Derecelendirme
(52)
Projeler
96
24%
Arabuluculuk
9
22% / 22%
Süresi dolmuş
12
13%
Çalışıyor
7
Geliştirici 7
Derecelendirme
(251)
Projeler
402
38%
Arabuluculuk
82
41% / 20%
Süresi dolmuş
70
17%
Çalışıyor
8
Geliştirici 8
Derecelendirme
(5)
Projeler
6
17%
Arabuluculuk
0
Süresi dolmuş
1
17%
Çalışıyor

Proje bilgisi

Bütçe
30+ USD

Müşteri

Verilmiş siparişler1
Arabuluculuk sayısı0