cBoer

GRaB Candles w/Notifications

Just added "notifications" to the previous script I found from mattlacoco.
סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יכולים להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?
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)