senpai

Spyfrat Momentum Study

53
Spyfrat Momentum Study
--> using the following
1) RSI
2) Boellinger Band
3) PSAR Measurement Algorithm
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
//@version=2
study("Spyfrat Momentum Study",overlay=true)

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

//RSI CODE
src = close, 
up = rma(max(change(src), 0), 30)
down = rma(-min(change(src), 0), 30)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

//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]) 

//psar code 
start = input(0.02)
increment = input(0.02)
maximum = input(0.2)
psar = sar(start, increment, maximum)
diff = (close - psar)*10000
diff1 = (close [200] - psar)*10000
guage = diff - diff1




//Rule
//long = rsi>50.5 and rsi<55 and  bbi>0.15  and osc>0.00100 and conso>0
//short = rsi<49.5 and rsi>45 and  bbi<-0.15 and osc<-0.00100 and conso>0

long = rsi>50 and rsi<60 and  close>upper and guage>10  and bbi>0.10
short = rsi<50 and rsi>40 and close<lower and guage<-10 and bbi <-0.10
//
//long = long1[1] == 0 and long1 == 1
//short = short1[1] == 0 and short1 == 1
//longclose = long[5] == 1
//shortclose = short[5] == 1

//Alert

//plot(long,"long",color=green,linewidth=1)
//plot(short,"short",color=red,linewidth=1)
plotshape(long, color=green, style=shape.arrowup, text="Spyfrat Buy",location=location.belowbar,size=size.normal,textcolor=green) 
alertcondition(long, title='Spyfrat Buy', message='Spyfrat Momentum Buy!')
plotshape(short, color=red, style=shape.arrowdown, text="Spyfrat Sell",location=location.abovebar,size=size.normal,textcolor=red) 
alertcondition(short, title='Spyfrat Sell', message='Spyfrat Momentum Sell!')

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