senpai

Senpai_Strat_3

58
Binary Option --- Only for Range Trade (1 minute Frame)
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?
//@version=2
//Based on Senpai BO 3
strategy(title="Senpai_Strat_3", shorttitle="Senpai_Strat_3", overlay=false, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
src = close

//psar
start = input(0.02)
increment = input(0.02)
maximum = input(0.2)
psar = sar(start, increment, maximum)


//ADX Init
adxlen = input(30, title="ADX Smoothing")	
dilen = input(30, title="DI Length")	
dirmov(len) =>	
	up = change(high)
	down = -change(low)
	truerange = rma(tr, len)
	plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
	minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
	[plus, minus]
	
adx(dilen, adxlen) => 	
	[plus, minus] = dirmov(dilen)
	sum = plus + minus
	adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
	[adx, plus, minus]
	
[sig, up, down] = adx(dilen, adxlen)	


// BB Init
source = close
length = input(50, minval=1)
mult = input(0.5, title="Mult Factor", minval=0.001, maxval=50)
alertLevel=input(0.1)
impulseLevel=input(0.75)
showRange = input(false, type=bool)


//RSI CODE
up1 = rma(max(change(src), 0), 14)
down1 = rma(-min(change(src), 0), 14)
rsi = down1 == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up1 / down1))


//BB CODE
basis = sma(source, length)
dev = mult * stdev(source, length)
upper = basis + dev
lower = basis - dev
bbr = source>upper?(((source-upper)/(upper-lower))/10): source<lower?(((source-lower)/(upper-lower))/10) : 0.05
bbi = bbr - nz(bbr[1]) 

//////////////////// Algo

//if (rsi>50 and n1>n2)
   //strategy.exit("Close", "Short")
  // strategy.entry("Long", strategy.long)
//if (rsi<50 and n2>n1)
   //strategy.exit("Close", "Long")
//   strategy.entry("Short", strategy.short)

//col = ma30 > ma50 > ma200 and rsi <=53?lime: ma50 < ma200  and rsi >= 60?red : silver
//short1 =  sig<18.5 and high>=upper and rsi>=70 and psar<close = 100%
//long1 = sig<18.5 and low<=lower and rsi<=30 and psar>close = 100%
short1 =  sig<18.5 and high>=upper and rsi>=70 and psar<close
long1 = sig<18.5 and low<=lower and rsi<=30 and psar>close

//Entry

long = long1[1] == 0 and long1 == 1
short = short1[1] == 0 and short1 == 1
longclose = long[3] == 1
shortclose = short[3] == 1
strategy.entry("short", strategy.short,qty = 10,oca_type = strategy.oca.cancel, when=short)
strategy.entry("long", strategy.long,qty=10,oca_type = strategy.oca.cancel, when=long)
strategy.close("long",when=longclose)
strategy.close("short",when=shortclose)



/////////////////////
///PLOT

plot(long,"long",color=green,linewidth=1)
plot(short,"short",color=red,linewidth=1)
plot(longclose,"close",color=blue,linewidth=1)
plot(shortclose,"close",color=orange,linewidth=1)


//plot(short,"short",color=red,linewidth=1)
//

//strategy.exit(id="long",qty = 100000,when=longclose)
//strategy.exit(id="short",qty = 100000,when=shortclose)

//strategy.exit(id="Stop", profit = 20, loss = 100)