cBoer

GRaB Candles w/Notifications

Just added "notifications" to the previous script I found from mattlacoco.
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.

Vuoi usare questo script sui tuoi grafici?
study(title='Buy Blue Sell Red - Notification', shorttitle='BBSR-N', overlay=true)
// vars
emaPeriod = input(title="EMA Period", type=integer, defval=34)
showWave = input(title="Show Wave", type=bool, defval=false)

// build wave
emaHigh = ema(high,emaPeriod)
emaLow = ema(low,emaPeriod)
emaClose = ema(close,emaPeriod)

waveHigh = showWave == true ? emaHigh : na
waveLow = showWave == true ? emaLow : na
waveClose = showWave == true ? emaClose : na

prevCandleColor = close[1] < emaLow[1] ? close[1] > open[1] ? -2 : -1 : close[1] > emaHigh[1] ? close[1] > open[1] ? 2 : 1 : close[1] > open[1] ? 0 : 0
currCandleColor = close < emaLow ? close > open ? -2 : -1 : close > emaHigh ? close > open ? 2 : 1 : close > open ? 0 : 0
candleChange = prevCandleColor <= 0 and currCandleColor > 0 ? 1 : 
                prevCandleColor >= 0 and currCandleColor < 0 ? -1 : 0

plotchar(candleChange == 1 ? 1 : na, char="*", title="Changed to Bull", transp=100, color=blue)
plotchar(candleChange == -1 ? 1 : na, char="*", title="Changed to Bear", transp=100, color=red)

plot(waveHigh, title="EMA High",color=red )
plot(waveLow, title="EMA Low", color=blue)
plot(waveClose, title="EMA Close", color=silver)

// paint candles according to close position relative to wave
barcolor(close < emaLow ? close > open ? red : maroon : close > emaHigh ? close > open ? blue : navy : close > open ? silver : gray)