victorzhitkov

Scalping

73
working on
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.

Vuoi usare questo script sui tuoi grafici?
//@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')