Bộ công cụ script cho tradingview – (Free)

Bộ công cụ script cho tradingview – (Free)
5 (100%) 1 vote

Chào Anh/Chị,

Hôm nay Mẫn chia sẻ lại bộ công cụ giành cho tradingview bao gồm AutoTrendLind + Hỗ trợ/Kháng cự cho mọi người tham khảo và dùng nếu cần ạ.

Đây là bộ free và open source vì vậy mọi người có thể lấy về và cải thiện thêm tùy thích ạ. Sau khi thêm vào đủ 3 cái này sẽ có kết quả như hình ạ.

1- AutoTrendlines

 

//@version=4
//this study simply draws a trend line base on pivot strength configuration,
// and also provide configuration by using the close price and show historical trend lines

study( title=”AutoTrendlines”, shorttitle=”AutoTrendlines”, overlay=true)
useclose=input(false)

h=useclose?close:high
l=useclose?close:low

strength=input(10,title=”left Strength”, minval=5, maxval=200)

draw_trend(High, Low, leftlen,rightlen,n)=>

//upper trend line
var int startx=0
var float starty=0.0
var int startx2=0
var float starty2=0.0

var int endx=0
var float endy=0.0
var float endy0=0.0
var float slope=0.0
var bool ispivothigh =false

ispivothigh:=High[rightlen] == pivothigh(High,leftlen,rightlen)

starty2:=valuewhen(ispivothigh,High[rightlen],n+2)
startx2 := valuewhen(ispivothigh,bar_index,n+2)

starty:=valuewhen(ispivothigh,High[rightlen],n+1)
startx := valuewhen(ispivothigh,bar_index,n+1)

endy:=valuewhen(ispivothigh,High[rightlen],n)
endx := valuewhen(ispivothigh,bar_index,n)

slope:=(endy-starty)/(endx-startx)

valend = endy
var float Endy=0.0

Endy:=abs(endx-startx+rightlen)*slope + starty

if slope<0

if n==0
upper0 = line.new(endx, Endy, startx-rightlen, starty, width = 1, color=color.red, extend=extend.left)
line.delete(upper0[1])

upper1 = line.new(endx, Endy, startx-rightlen, starty, width = 1, color=color.red, extend=extend.none)
line.delete(upper1[1])

var float slope2= (endy-starty2)/(endx-startx2)
var float Endy2=0.0

Endy:=abs(endx-startx2+rightlen)*slope + starty2
if slope2<0
upper2 = line.new(endx, Endy2, startx2-rightlen, starty2, width = 1, color=color.red, extend=extend.none)
line.delete(upper2[1])

//lower trend line
var int lstartx=0
var float lstarty=0.0
var int lstartx2=0
var float lstarty2=0.0

var int lendx=0
var float lendy=0.0
var float lendy0=0.0
var float lslope=0.0
var bool ispivotlow =false

ispivotlow:=Low[rightlen] == pivotlow(Low,leftlen,rightlen)

lstarty2:=valuewhen(ispivotlow,Low[rightlen],n+2)
lstartx2 := valuewhen(ispivotlow,bar_index,n+2)

lstarty:=valuewhen(ispivotlow,Low[rightlen],n+1)
lstartx := valuewhen(ispivotlow,bar_index,n+1)

lendy:=valuewhen(ispivotlow,Low[rightlen],n)
lendx := valuewhen(ispivotlow,bar_index,n)

lslope:=(lendy-lstarty)/(lendx-lstartx)
var float lEndy=0.0

lEndy:=abs(lendx-lstartx+rightlen)*lslope + lstarty

if lslope>0

if n==0
Lower0 = line.new(lendx, lEndy, lstartx-rightlen, lstarty, width = 1, color=color.green, extend=extend.left)
line.delete(Lower0[1])

Lower1 = line.new(lendx, lEndy, lstartx-rightlen, lstarty, width = 1, color=color.green, extend=extend.none)
line.delete(Lower1[1])

var float lslope2= (lendy-lstarty2)/(lendx-lstartx2)
var float lEndy2=0.0

lEndy:=abs(lendx-lstartx2+rightlen)*lslope + lstarty2
if lslope2>0
lower2 = line.new(lendx, lEndy2, lstartx2-rightlen, lstarty2, width = 1, color=color.green, extend=extend.none)
line.delete(lower2[1])

left=strength
right=strength

//draw current trendling
draw_trend(h, l,left,right,0)

showhtrend=input(true, title=”Show History Trend Line”)

if showhtrend
//show history trendling
draw_trend(h, l,left,right,1)
draw_trend(h, l,left,right,2)
draw_trend(h, l,left,right,3)
draw_trend(h, l,left,right,4)
draw_trend(h, l,left,right,5)
draw_trend(h, l,left,right,6)
draw_trend(h, l,left,right,7)
draw_trend(h, l,left,right,8)
draw_trend(h, l,left,right,9)
draw_trend(h, l,left,right,10)
draw_trend(h, l,left,right,11)
draw_trend(h, l,left,right,12)

 

2- Support & Res Price

//@version=4

//this study simply Support & Res Price,
study(‘Support & Res Price’, overlay=true)

testStartYear = input(2019, “Backtest Start Year”)
testStartMonth = input(10, “Backtest Start Month”)
testStartDay = input(20, “Backtest Start Day”)
testStartHour = input(0, “Backtest Start Hour”)
testStartMin = input(0, “Backtest Start Minute”)
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,testStartHour,testStartMin)
testStopYear = input(2099, “Backtest Stop Year”)
testStopMonth = input(1, “Backtest Stop Month”)
testStopDay = input(30, “Backtest Stop Day”)
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)
testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false

lenH = input(title=’Length High’, type=input.integer, defval=20, minval=1)
lenL = input(title=’Length Low’, type=input.integer, defval=20, minval=1)

fun(src, len, isHigh, _style, _yloc, _color) =>
p = nz(src[len])
isFound = true
for i = 0 to len * 2
if isHigh and src[i] > p
isFound := false
if not isHigh and src[i] < p
isFound := false
if isFound and testPeriod()
label.new(bar_index[len], p, tostring(p), style=_style, yloc=_yloc, color=_color)
line.new(bar_index[len], p, bar_index, p, extend=extend.right, color=_color)

fun(high, lenH, true, label.style_labeldown, yloc.abovebar, color.red)
fun(low, lenL, false, label.style_labelup, yloc.belowbar, color.green)

3- Signal Top/Buttom Price

//this study simply

study(title = “Signal Top/Buttom Price”, overlay = true)

//Mode
Factor=input(title=”Super Trend”, defval=3, minval=1,maxval = 100)
ATR=input(title=”ATR”, defval=12, minval=1,maxval = 100)

//Super Trend ATR 1
Up=hl2-(Factor*atr(ATR))
Dn=hl2+(Factor*atr(ATR))

TUp=close[1]>TUp[1]? max(Up,TUp[1]) : Up
TDown=close[1]<TDown[1]? min(Dn,TDown[1]) : Dn

Trend = close > TDown[1] ? 1: close< TUp[1]? -1: nz(Trend[1],1)

Tsl1 = Trend==1? TUp: TDown
Tsl2 = Trend==1? TDown: TUp

linecolor = Trend == 1 ? green : red

//Affichage
P1 = plot(Tsl1, color = linecolor , style = line , linewidth = 1,title = “SuperTrend ATR-1”)
P2 = plot(Tsl2, color = linecolor , style = line , linewidth = 1,title = “SuperTrend ATR-2”)
fill(P1, P2, color = linecolor == red ? red : green)

//plotshape(P2, title = “Long”, text = ‘Long’, style = shape.labelup, location = location.belowbar, color= green,textcolor = white, transp = 0, size = size.tiny)
//plotshape(P1, title = “short”, text = ‘Short’, style = shape.labeldown, location = location.abovebar, color= red,textcolor = white, transp = 0, size = size.tiny)

 


💥 Các sàn Forex & Crypto 375Group đang giao dịch gồm:

👉 Snapex,Margin Crypto: https://375group.club/snapex

👉 ByBit,Margin Crypto BTC/USDT: https://partner.bybit.com/b/vn375

👉 Tigerwit, Forex Broker: https://375group.club/VN375Tigerwit


💥 Cộng đồng chính thức của 375GROUP gồm :

👉 375Group Official Group: https://t.me/VN375Group_Official

👉 375Group Official Channel: https://t.me/VN375Group_Channel

👉 Facebook Group: https://www.facebook.com/groups/375GROUP/

👉 Facebook Page: https://www.facebook.com/375group.page

Mẫn Nhi - VN375GROUP

Xinh đẹp và cá tính

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Vui lòng nhập Captcha *