MATTool Script
MATTool Script
//@version=4
study(title="Trend Bull V2", shorttitle="TBull", overlay=true)
Long = close > ema(close,21) and close > ema(close,9) and rsi(close,14) > 55 and
close > vwap and dir == -1 and volume > sma(volume,300) and close > open
Short = close < ema(close,21) and close < ema(close,9) and rsi(close,14) < 45 and
close < vwap and dir == 1 and volume > sma(volume,300) and close < open
// ALERTS
//VWAP
cvwap1 = vwap(hlc3)
plotvwap = plot(showVWAP ? cvwap1 : na,title="VWAP",color=color.black,
transp=0, linewidth=2)
// Moving Averages
M1=ema(close, len1)
M2=ema(close, len2)
M3=ema(close, len3)
M4=ema(close, len4)
// Pivots Points
plot(SPSR and DPP ? DPP : na , title= "Daily Pivot", color = #0000ff, style =
plot.style_stepline, linewidth =2)
plot(SPSR and DR1 ? DR1 : na , title= "Daily R1", color = #ff0000, style =
plot.style_stepline, linewidth =2)
plot(SPSR and DR2 ? DR2 : na , title= "Daily R2", color = #ff0000, style =
plot.style_stepline, linewidth =2)
plot(SPSR and DR3 ? DR3 : na , title= "Daily R3", color = #ff0000, style =
plot.style_stepline, linewidth =2)
plot(SPSR and DS1 ? DS1 : na , title= "Daily S1", color = #4caf50, style =
plot.style_stepline, linewidth =2)
plot(SPSR and DS2 ? DS2 : na , title= "Daily S2", color = #4caf50, style =
plot.style_stepline, linewidth =2)
plot(SPSR and DS3 ? DS3 : na , title= "Daily S3", color = #4caf50, style =
plot.style_stepline, linewidth =2)
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////
/////////////////////////////////////////////////// PREVIOUS
DAY /////////////////////////////////////////////////
//Continues Supertrend
calcx()=>
bufferDn= high + Multiplier * wma(tr,ATR)
bufferUp= low - Multiplier * wma(tr,ATR)
if (thisCCI >= 0 and lastCCI < 0)
bufferUp := bufferDn[1]
if (thisCCI <= 0 and lastCCI > 0)
bufferDn := bufferUp[1]
if (thisCCI >= 0)
if (bufferUp < bufferUp[1])
bufferUp := bufferUp[1]
else
if (thisCCI <= 0)
if (bufferDn > bufferDn[1])
bufferDn := bufferDn[1]
x = 0.0
x := thisCCI >= 0 ?bufferUp:thisCCI <= 0 ?bufferDn:x[1]
x
tempx = calcx()
calcswap() =>
swap = 0.0
swap := tempx>tempx[1]?1:tempx<tempx[1]?-1:swap[1]
swap
tempswap = calcswap()
swap2=tempswap==1?color.green:color.red
swap3=thisCCI >=0 ?color.green :color.red
swap4=original?swap3:swap2
//display Trend
plot( SST and tempx ? tempx : na , title = "ATR Line" ,color=swap4 == color.green ?
color.green : swap4,transp=0,linewidth=2)