TheYangGuizi

Matrix Mod

This is the Matrix oscillator made by glaz. So credit goes to him.

I made some minor modifications to it:
1. added a zeroline
2. added 3 options to color bars/candles depending on:
- if the oscillator is above/below 0
- if it's oversold/bought*
- if the matrix has a green bar or a red

That's all :)
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. You can favorite it to use it on a chart.

Quer usar esse script no gráfico?
study("Matrix Mod",shorttitle="MS",precision=1)
Smoother=input(5)
nn = Smoother
//--Sup/Res Detail
SupResPeriod = input(50)
SupResPercentage =input(100)
PricePeriod = input(16)
ob = input(200,title="Overbought")
os = input(-200,title="Oversold")
OBOS= input(type=bool,defval=false,title="Show OB/OS") 
dynamic=input(true,title="Dynamic zones")
ys1 = ( high + low + close * 2 ) / 4
rk3 = ema( ys1, nn )
rk4 = stdev(ys1, nn)
rk5 = (ys1 - rk3 ) * 200 / rk4
rk6 = ema( rk5, nn )
up = ema(rk6, nn )
down = ema( up, nn )
Oo = iff( up < down, up, down )
Hh = Oo
Ll = iff( up < down, down, up )
Cc = Ll
vcolor= Oo > Cc ? red : up > down? green:red 

// Body Calculations
bodyHigh = up>down ? up : down
bodyLow = Oo<down ? up : down
body0 = (up>0 and down>0) or (up>0 and down<0) ? bodyHigh : (up<0 and down<0) or (up<0 and down>0) ? bodyLow : 0
body1 = up<0 and down>0 ? bodyHigh : up>0 and down<0 ? bodyLow : 0
bodyCover = up>0 and down>0 ? bodyLow : up<0 and down<0 ? bodyHigh : 0
// Wick Calculations
wick0 = Hh>0 ? Hh : Ll
wick1 = Hh>0 and Ll<0 ? Ll : Hh
wickCover = Hh>0 and Ll>0 ? Ll : Hh<0 and Ll<0 ? Hh : 0
plot(Oo, linewidth=3, color=vcolor, style=histogram, title="Oc")
plot(Cc, linewidth=3, color=vcolor, style=histogram, title="Cc")
plot(bodyCover, linewidth=3, color=white, style=histogram)



//-------S/R Zones------
Lookback = SupResPeriod
PerCent = SupResPercentage
Pds = PricePeriod

C3 = cci(close,Pds )

Osc = C3
Value1 = Osc
Value2 = highest( Value1, Lookback )
Value3 = lowest( Value1, Lookback )
Value4 = Value2 - Value3
Value5 = Value4 * ( PerCent / 100 )
ResistanceLine = Value3 + Value5
SupportLine = Value2 - Value5
plot(dynamic?ResistanceLine:na,color=green)
plot(dynamic?SupportLine:na,color=red)

//--Overbought/Oversold/Warning Detail
UPshape = up > 200 and up>down ? highest(up,1) + 20:up > 200 and up<down?highest(down,1) + 20:na
DOWNshape = down < -200 and up>down ? lowest(down,1) - 20:down < -200 and up<down?lowest(up,1) - 20 :na
plot(UPshape,style=linebr,color=red,linewidth=2)
plot(DOWNshape,style=linebr,color=green,linewidth=2)
x1=OBOS?ob:false
x2=OBOS?os:false
hline(x1)
hline(x2)
hline(0)
//http://www.wisestocktrader.com/indicators/2739-flower-indicator

barcolor(Oo > 200 ? black : Cc < -200 ? white : na, title="OSOB")
barcolor(Oo > 0 ? green : Oo < 0 ? red : na, title="0-Cross")
barcolor(Oo > Cc ? red : up > down? green:red , title="ColorChange")