[PineScript]Indicator Pre-H1 Fibo Line

[PineScript]Indicator Pre-H1 Fibo Line

[PineScript]Indicator Pre-H1 Fibo Line

anhnguyen14

Active Member
15,534
19,106
Hi anh em, lâu quá mình không có cái gì tặng anh em để giải trí với món BO rùi, hôm nay mình tặng anh em cái indi Pre-H1 Fibo Line này để chơi đùa với ma kẹt nha. Indi này mình hứng thì viết thôi, cũng không biết có tác dụng gì, anh em thích thì vọc, dùng được thế nào thì tùy vào duyên của anh em với nó nha. Chúc anh em trade tốt!
Lucky Trading!
1. Code Pine
Mã:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © inno14

//@version=4
study(title="Pre-H1 Fibo Line", overlay=true)
H1_High = security(syminfo.tickerid, '60', high[1])
H1_Low = security(syminfo.tickerid, '60', low[1])
H1_Close = security(syminfo.tickerid, '60', close[1])
H1_Open = security(syminfo.tickerid, '60', open[1])
rescol = color.new(color.black,30)
supcol = color.new(color.black,30)

//Standar Fibo
Fib0=H1_Close>H1_Open?H1_Low:H1_High
Fib1=H1_Close>H1_Open?H1_High:H1_Low
Dis=H1_High-H1_Low
Fib0_236 = H1_Close>H1_Open?Fib0 + 0.236*Dis:Fib0 - 0.236*Dis
Fib0_382 = H1_Close>H1_Open?Fib0 + 0.382*Dis:Fib0 - 0.382*Dis
Fib0_5 = H1_Close>H1_Open?Fib0 + 0.5*Dis:Fib0 - 0.5*Dis
Fib0_618 = H1_Close>H1_Open?Fib0 + 0.618*Dis:Fib0 - 0.618*Dis
Fib0_786 = H1_Close>H1_Open?Fib0 + 0.786*Dis:Fib0 - 0.786*Dis
Fibcol=color.new(color.green,30)
//Fibo
lFib0 = line.new(bar_index[20], Fib0, bar_index[0],Fib0, width = 4, color=supcol, extend=extend.right)
line.delete(lFib0[1])
lFib0_236 = line.new(bar_index[20], Fib0_236, bar_index[0],Fib0_236, width = 4, color=Fibcol, extend=extend.right)
line.delete(lFib0_236[1])
lFib0_382 = line.new(bar_index[20], Fib0_382, bar_index[0],Fib0_382, width = 4, color=Fibcol, extend=extend.right)
line.delete(lFib0_382[1])
lFib0_5 = line.new(bar_index[20], Fib0_5, bar_index[0],Fib0_5, width = 4, color=Fibcol, extend=extend.right)
line.delete(lFib0_5[1])
lFib0_618 = line.new(bar_index[20], Fib0_618, bar_index[0],Fib0_618, width = 4, color=Fibcol, extend=extend.right)
line.delete(lFib0_618[1])
lFib0_786 = line.new(bar_index[20], Fib0_786, bar_index[0],Fib0_786, width = 4, color=Fibcol, extend=extend.right)
line.delete(lFib0_786[1])
lFib1 = line.new(bar_index[20], Fib1, bar_index[0],Fib1, width = 4, color=rescol, extend=extend.right)
line.delete(lFib1[1])
//Label
lablecol=color.new(color.orange,50)

plotshape(Fib0, title="Fibo 0", style=shape.labeldown, location=location.absolute, color=lablecol, text="0.0", textcolor=color.black, offset=3,size=size.tiny, show_last=1)
plotshape(Fib0_236, title="Fibo 0_236", style=shape.labeldown, location=location.absolute, color=lablecol, text="0.236", textcolor=color.black, offset=3, size=size.tiny, show_last=1)
plotshape(Fib0_382, title="Fibo 0_382", style=shape.labeldown, location=location.absolute, color=lablecol, text="0.382", textcolor=color.black, offset=3, size=size.tiny, show_last=1)
plotshape(Fib0_5, title="Fibo 0_5", style=shape.labeldown, location=location.absolute, color=lablecol, text="0.5", textcolor=color.black, offset=3, size=size.tiny, show_last=1)
plotshape(Fib0_618, title="Fibo 0_618", style=shape.labeldown, location=location.absolute, color=lablecol, text="0.618", textcolor=color.black, offset=3, size=size.tiny, show_last=1)
plotshape(Fib0_786, title="Fibo 0_786", style=shape.labeldown, location=location.absolute, color=lablecol, text="0.786", textcolor=color.black, offset=3, size=size.tiny, show_last=1)
plotshape(Fib1, title="Fibo 1", style=shape.labeldown, location=location.absolute, color=lablecol, text="1.0", textcolor=color.black, offset=3, size=size.tiny, show_last=1)

plotshape(H1_Close>H1_Open?Fib0:na, title="Pre-H1 Blue", style=shape.arrowup, location=location.absolute, color=color.blue, text="Pre-H1 Blue", textcolor=color.black, offset=4, size=size.normal, transp=0, show_last=1)
plotshape(H1_Close<H1_Open?Fib0:na, title="Pre-H1 Red", style=shape.arrowdown, location=location.absolute, color=color.red, text="Pre-H1 Red", textcolor=color.black, offset=4, size=size.normal, transp=0, show_last=1)

//End

2.Giao diện indi
chrome_4ik5cEfjRo.png
chrome_YQx9lDXCby.png
 
 

Giới thiệu sách Trading hay
Phương Pháp VPA - Kỹ Thuật Nhận Diện Dòng Tiền Thông Minh bằng Hành Động Giá kết hợp Khối Lượng Giao Dịch

Phương pháp VPA - Volume Price Analysis - là phương pháp Price Action hướng dẫn ĐỌC GIÁ / NẾN kết hợp với KHỐI LƯỢNG GIAO DỊCH để tìm ra hướng đi của DÒNG TIỀN THÔNG MINH
@vĩnh0902 test giúp mình 2 tháng nha :)
Code backtest
Mã:
// © anhnguyen14
//@version=4
strategy("Pre-H1 Fibo", overlay=true)
t0=time(timeframe.period, "0000-0000")
//bgcolor(t0?color.aqua:na)

H1_High = security(syminfo.tickerid, '60', high[1])
H1_Low = security(syminfo.tickerid, '60', low[1])
H1_Close = security(syminfo.tickerid, '60', close[1])
H1_Open = security(syminfo.tickerid, '60', open[1])
rescol = color.new(color.black,30)
supcol = color.new(color.black,30)

//Standar Fibo
Fib0=H1_Close>H1_Open?H1_Low:H1_High
Fib1=H1_Close>H1_Open?H1_High:H1_Low
Dis=H1_High-H1_Low
Fib0_236 = H1_Close>H1_Open?Fib0 + 0.236*Dis:Fib0 - 0.236*Dis
Fib0_382 = H1_Close>H1_Open?Fib0 + 0.382*Dis:Fib0 - 0.382*Dis
Fib0_5 = H1_Close>H1_Open?Fib0 + 0.5*Dis:Fib0 - 0.5*Dis
Fib0_618 = H1_Close>H1_Open?Fib0 + 0.618*Dis:Fib0 - 0.618*Dis
Fib0_786 = H1_Close>H1_Open?Fib0 + 0.786*Dis:Fib0 - 0.786*Dis

preH1 = H1_Close>H1_Open?"blue":"red"

Call =
       crossunder(close,Fib0_5)
       and close>Fib0_382
       and preH1 == "blue"
       and volume<valuewhen(lowest(low,7),volume,1)
       and sma(volume,14)>sma(volume,14)[1]

strategy.entry("Call", strategy.long, when=Call and t0)

Put =
       crossover(close,Fib0_5)
       and close<Fib0_382
       and preH1 == "red"
       and volume<valuewhen(highest(high,7),volume,1)
       and sma(volume,14)>sma(volume,14)[1]

strategy.entry("Put", strategy.short, when=Put and t0)

strategy.close_all(when=barstate.isnew)

=== Backtest 1 tháng ===
01.jpg
02.jpg
 
 
upload_2019-12-18_20-44-24.png
upload_2019-12-18_20-39-2.png

2 tháng này bac ơi nhiêu chiến thuật quá hjhj
@vĩnh0902 test giúp mình 2 tháng nha :)
Code backtest
Mã:
// © anhnguyen14
//@version=4
strategy("Pre-H1 Fibo", overlay=true)
t0=time(timeframe.period, "0000-0000")
//bgcolor(t0?color.aqua:na)

H1_High = security(syminfo.tickerid, '60', high[1])
H1_Low = security(syminfo.tickerid, '60', low[1])
H1_Close = security(syminfo.tickerid, '60', close[1])
H1_Open = security(syminfo.tickerid, '60', open[1])
rescol = color.new(color.black,30)
supcol = color.new(color.black,30)

//Standar Fibo
Fib0=H1_Close>H1_Open?H1_Low:H1_High
Fib1=H1_Close>H1_Open?H1_High:H1_Low
Dis=H1_High-H1_Low
Fib0_236 = H1_Close>H1_Open?Fib0 + 0.236*Dis:Fib0 - 0.236*Dis
Fib0_382 = H1_Close>H1_Open?Fib0 + 0.382*Dis:Fib0 - 0.382*Dis
Fib0_5 = H1_Close>H1_Open?Fib0 + 0.5*Dis:Fib0 - 0.5*Dis
Fib0_618 = H1_Close>H1_Open?Fib0 + 0.618*Dis:Fib0 - 0.618*Dis
Fib0_786 = H1_Close>H1_Open?Fib0 + 0.786*Dis:Fib0 - 0.786*Dis

preH1 = H1_Close>H1_Open?"blue":"red"

Call =
       crossunder(close,Fib0_5)
       and close>Fib0_382
       and preH1 == "blue"
       and volume<valuewhen(lowest(low,7),volume,1)
       and sma(volume,14)>sma(volume,14)[1]

strategy.entry("Call", strategy.long, when=Call and t0)

Put =
       crossover(close,Fib0_5)
       and close<Fib0_382
       and preH1 == "red"
       and volume<valuewhen(highest(high,7),volume,1)
       and sma(volume,14)>sma(volume,14)[1]

strategy.entry("Put", strategy.short, when=Put and t0)

strategy.close_all(when=barstate.isnew)

=== Backtest 1 tháng ===
View attachment 127514 View attachment 127515
 
 
Hehe, nhiều chứ, vĩnh thấy em Fibo này thế nào, mình chưa rãnh rà thời gian mà nó hiệu suất cao nữa, cái này là full-time á :)
PS: cho cái indicator Pre-H1 Fibo Line vào nhìn cho đẹp, keke :D
mấy hnay e cũng k có time ngồi ngắm chart mấy kaka chắc phải để mấy hôm nữa chờ có thêm chiến thuật ngâm cứu tiếp sắp hoàn thiện bảng qlv tháng 11 vs tháng 12 rồi keke tuần này winrate hơi thấp bộ phân kì còn 2 ngày nữa hi vọng winrate sẽ tăng
 
 
@vĩnh0902 đã có code rà khung thời gian,vĩnh rà giúp mình 2 tháng có khung nào ổn không nha, rãnh hãy rà, ko gấp :D
chrome_vdku3HhTsb.png
vAT38Y9kWg.png
 
 

BÌNH LUẬN MỚI NHẤT

  • Mạc An trong Phân tích Forex - Vàng - Hàng hóa 1,327 Xem / 66 Trả lời
  • Bianas trong Kiến thức Trading - Kinh nghiệm Trading 28,118 Xem / 12 Trả lời
  • Quíc Óp trong Phân tích Forex - Vàng - Hàng hóa 534 Xem / 6 Trả lời
  • Quíc Óp trong Phân tích Forex - Vàng - Hàng hóa 691 Xem / 5 Trả lời
  • lapuma trong Kiến thức Trading - Kinh nghiệm Trading 241,291 Xem / 1,089 Trả lời
  • AdBlock Detected

    We get it, advertisements are annoying!

    Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

    Back
    Bên trên