TradingView
RafaelZioni
3 de Ago de 2018 17:28

heiken-stoch 

Bitcoin / TetherUSBinance

Descrição

This model has two system
1. is the well known heiken (lime or red)
2. stoch cross up or down in relation to volume indicator (B or S)

alerts inside

have fun
Comentários
RafaelZioni
plotchar(crossUp, title="crossUp", char='B', location=location.bottom, color=green, transp=0, offset=0)
plotchar(crossDown, title="crossDown",char='S', offset=0, location=location.top, color=red, transp=0)



alertcondition(up, title='go long', message='go long')
alertcondition(down, title='go short', message='go short')
alertcondition(crossUp, title='crossUp', message='go long')
alertcondition(crossDown, title='crossDown', message='go short')


bgcolor(down < 0 ? red : na, transp=50)
bgcolor(up > 0 ? lime : na, transp=50)
Crypt0Code
Greetings! How can I see the code of this script please? Because the code from the comments contains errors, I can't run it, I would like to experiment with this code. Thanks a lot!
RafaelZioni
study(title="heiken-stoch", shorttitle="heiken-stoch",overlay=false)
src10 = input(close)
OverBought = input(50, minval=10)
OverSold = input(20, maxval=70)
smooth = input(5)

Length = input(21)
NormalizeRange = input(true)

normalize(series) =>
h = highest(series, Length)
l = lowest(series, Length)
res = (series - l)/(h - l)

len = input(5, minval=1)
ma2 = wma(src10*volume, len) / wma(volume, len)

result1 = NormalizeRange ? normalize(ma2) : (ma2 / sma(ma2, Length))

m1 = sma(result1, smooth)
m2 = sma(result1*100, smooth)
plot(m2, title='M', color = open < close ? green : red,linewidth=3, transp=0)

res = input(title="Heikin Ashi Candle Time Frame", type=resolution, defval="60")
hshift = input(1,title="Heikin Ashi Candle Time Frame Shift")
res1 = input(title="Heikin Ashi EMA Time Frame", type=resolution, defval="1440")
mhshift = input(0,title="Heikin Ashi EMA Time Frame Shift")
fama = input(1,"Heikin Ashi EMA Period")
test = input(1,"Heikin Ashi EMA Shift")
sloma = input(30,"Slow EMA Period")
slomas = input(1,"Slow EMA Shift")
macdf = input(false,title="With MACD filter")
res2 = input(title="MACD Time Frame", type=resolution, defval="15")
macds = input(1,title="MACD Shift")


//Heikin Ashi Open/Close Price
ha_t = heikinashi(tickerid)
ha_open = security(ha_t, res, open[hshift])
ha_close = security(ha_t, res, close[hshift])
mha_close = security(ha_t, res1, close[mhshift])

//macd
[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)
macdl = security(ha_t,res2,macdLine[macds])
macdsl= security(ha_t,res2,signalLine[macds])

//Moving Average
fma = ema(mha_close[test],fama)
sma = ema(ha_close[slomas],sloma)


// Wells Wilders MA
wwma(l,p) =>
wwma = (nz(wwma[1]) * (l - 1) + p) / l

// Inputs
DMIlength = input(10)
Stolength = input(3)

// DMI Osc Calc
hiDiff = high - high[1]
loDiff = low[1] - low
plusDM = (hiDiff > loDiff) and (hiDiff > 0) ? hiDiff : 0
minusDM = (loDiff > hiDiff) and (loDiff > 0) ? loDiff : 0
ATR = wwma(DMIlength, tr)
PlusDI = 100 * wwma(DMIlength,plusDM) / ATR
MinusDI = 100 * wwma(DMIlength,minusDM) / ATR
osc = PlusDI - MinusDI

// DMI Stochastic Calc
hi = highest(osc, Stolength)
lo = lowest(osc, Stolength)

Stoch = sum((osc-lo),Stolength) / sum((hi-lo),Stolength) *100


p0 = 0
p1 = 5
p2 = 80
p3 = 20

crossUp = m2<OverSold and Stoch[1] < 10 and Stoch >10 ? 1 : 0
crossDown = m2>OverBought and Stoch[1] > 90 and Stoch < 90 ? 1 : 0

//crossP3 = cross(Stoch,p3)

//circleYPosition = crossP3
//circleYPosition = p3
//circleYPosition_l = p2


plot(10,color=green)
plot(30,color=red)
plot(50,color=black)
plot(80,color=red)
//Alert

up = crossover(fma,sma) and (macdl > macdsl or macdf == false) ? 1:0
down = crossunder(fma,sma) and (macdl < macdsl or macdf == false ) ? -1:0
up1 = m2<20 and Stoch[1] < 10 and Stoch >10 ? 1 : 0
down1 = m2>50 and Stoch[1] > 90 and Stoch < 90 ? 1 : 0


plot(up,"Go Long",color=lime,linewidth=20,style=histogram)
plot(down,"Go Short",color=red,linewidth=20,style=histogram)

plotchar(crossUp, title="
ik82302_10
@RafaelZioni, Can I ask for the original? Thank you very much! :)
kkoepke
The repainting comes from the higher Heiken Ashi timeframe. right?
kkoepke
Are the lime/red bars repainting? At least seems like that as the bars and the alerts i had over night are not fitting together.
The B and S signals are working fine tough.

Any idea?
RafaelZioni
I think it a problem in this model I agree. it a problem that maybe in the design of this heikin so i need to think how to solve it?
Mais