munsifk

strategy MACD and RSI alert fixed

530
I notice that my previous request for help has gathered alot of attention. This is the fixed alert for anyone who wants it, sorry it has been so long since the initial video but I have been super busy with exam work.
Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?
////////////////////////////////////////////////////////////
study(title="Strategy MACD and RSI alert", shorttitle="Strategy MACD and RSI alert", overlay = false )
fastLength = input(8, minval=1)
slowLength = input(16,minval=1)
signalLength=input(11,minval=1)
hline(0, color=purple, linestyle=dashed)
fastMA = ema(close, fastLength)
slowMA = ema(close, slowLength)
macd = fastMA - slowMA
signal = sma(macd, signalLength)

Length = input(10, minval=1)
Oversold = input(49, minval=1)
Overbought = input(51, minval=1)
xRSI = rsi(close, Length)



pos = iff(xRSI > Overbought and signal < macd, 1,
        iff(xRSI < Oversold and signal > macd, -1, nz(pos[1], 0))) 
        
poschange = (pos[1] == -1 and pos == 1) or (pos[1] == 1 and pos == -1 ) ? 1 : 0  
barcolor(pos == -1 ? red: pos == 1 ? green : blue)

//plot(pos, title="pos", style=line, linewidth=1, color=red )
plot(poschange, title="change of colour alert", style=line, linewidth=1, color=yellow )