victorzhitkov

Scalping

73
working on
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//@version=2
study("Scalping")
//Boilinger
basis = sma(close, 20)
dev = 2.0 * stdev(close, 20)
upper2 = basis + dev
lower2 = basis - dev

//стохастик
st=stoch(close,high,low,25)

//MACD
[macdLine, signalLine, histLine]=macd(close,12,26,9)

//RSI
rsi=rsi(close,14)

//RVI
ReVI(lenght) =>
    length = 10, src = close
    len = 14
    stddev = stdev(src, length)
    upper = ema(change(src) <= 0 ? 0 : stddev, len)
    lower = ema(change(src) > 0 ? 0 : stddev, len)
    rvi = upper / (upper + lower) * 100
RVI=ReVI(10)

//Сделать DMI
DeMI (len, lensig)=>
    up = change(high)
    down = -change(low)
    trur = rma(tr, len)
    plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / trur)
    minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / trur)
    sum = plus + minus 
    adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)
DMI=DeMI(14,14)
up = change(high)
down = -change(low)
trur = rma(tr, 14)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, 14) / trur)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, 14) / trur)
sum = plus + minus 
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), 14)
//перекупленность Стоха и РсИ
rsiUP = input(title="Высокий RSI", type=integer, defval=70,  minval=10, maxval=100)
stUP = input(title="Перекупленность стохастика", type=integer, defval=80,  minval=30, maxval=100)
rsiDown = input(title="Низкий RSI", type=integer, defval=30,  minval=10, maxval=100)
stDown = input(title="Перепроданность стохастика", type=integer, defval=20,  minval=0, maxval=100)
StochAndRSIup = rsi>rsiUP and st >stUP
StochAndRSIdown = rsi<rsiDown and st <stDown

//немного магии от какого-то Алексея из Интернета
smoothK = 1
smoothD = 3
lengthRSI = 14
lengthStoch = 8
src = close
rsi1 = rsi(src, lengthRSI)
k = sma(stoch(close, high, low, lengthRSI), smoothK)
d = sma(k, smoothD)

//формула 
up1 = (((plus[0]>plus[1] and minus[0]<minus[1] and plus[0]>minus[0]) and adx>20) and RVI>50 and RVI[0]>RVI[1] and k[0]>d[0] and k[0]<90 and d[0]<90 and volume>190 and close[0]-open[0]>0.015 and ((k[0]-d[0])>(k[1]-d[1])))
down1 = (((minus[0]>minus[1] and plus[0]<plus[1] and minus[0]>plus[0])and adx>20) and RVI[0]<RVI[1] and k[0]<d[0] and k[0]>10 and d[0]>10 and volume>190 and open[0]-close[0]>0.015 and ((k[0]-d[0])<(k[1]-d[1])))


barcolor( down1  ?  yellow : na)
barcolor(up1 ? lime : na )
alertcondition (up1 or down1, 'alert', 'mystrategy')