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
(539)
Projeler
618
33%
Arabuluculuk
35
37% / 49%
Süresi dolmuş
10
2%
Meşgul
2
Geliştirici 2
Derecelendirme
(574)
Projeler
945
47%
Arabuluculuk
309
58% / 27%
Süresi dolmuş
125
13%
Serbest
3
Geliştirici 3
Derecelendirme
(264)
Projeler
593
35%
Arabuluculuk
64
20% / 58%
Süresi dolmuş
147
25%
Serbest
Yayınlandı: 1 makale, 22 kod
4
Geliştirici 4
Derecelendirme
(250)
Projeler
460
26%
Arabuluculuk
140
20% / 59%
Süresi dolmuş
100
22%
Çalışıyor
5
Geliştirici 5
Derecelendirme
(22)
Projeler
32
44%
Arabuluculuk
1
0% / 0%
Süresi dolmuş
0
Serbest
6
Geliştirici 6
Derecelendirme
(54)
Projeler
102
23%
Arabuluculuk
12
25% / 17%
Süresi dolmuş
13
13%
Serbest
7
Geliştirici 7
Derecelendirme
(294)
Projeler
469
39%
Arabuluculuk
101
41% / 24%
Süresi dolmuş
77
16%
Yüklendi
Yayınlandı: 2 kod
8
Geliştirici 8
Derecelendirme
(6)
Projeler
8
13%
Arabuluculuk
0
Süresi dolmuş
1
13%
Serbest
Yayınlandı: 1 kod

Proje bilgisi

Bütçe
30+ USD