[PineScript]Indicator Pre-H1 Fibo Line

[PineScript]Indicator Pre-H1 Fibo Line

[PineScript]Indicator Pre-H1 Fibo Line

anhnguyen14

Active Member
15,083
18,145
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
Naked Forex - Phương Pháp Price Action Tinh Gọn

Naked Forex được đánh giá cao trên toàn cầu (theo Amazon) vì đã cung cấp một cẩm nang thực thụ cho những nhà giao dịch theo trường phái Price Action
@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
 

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

  • TraderViet News trong Chuyện bên lề 352 Xem / 1 Trả lời
  • ono trong Lập trình MQL - Expert Advisor - Indicator 17,781 Xem / 5 Trả lời
  • Mạc An trong Phân tích Forex - Vàng - Hàng hóa 1,134 Xem / 41 Trả lời
  • Nhật Hoài trong Lập trình MQL - Expert Advisor - Indicator 160,918 Xem / 1,108 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