victorzhitkov

Scalping

73
working on
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. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?
//@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')