[Backtest] Chiến lược Novecento - cũ mà mới.

[Backtest] Chiến lược Novecento - cũ mà mới.

[Backtest] Chiến lược Novecento - cũ mà mới.

anhnguyen14

Active Member
14,702
17,422
* Hi anh em, hôm nay mình sẽ làm backtest cho một chiến lược khá cũ và khá là không hiệu quả, đó cũng là lý do vì sao anh tác giả qua đến trang 2 của chiến lược ở BOE đã phải thêm thắt vào một cơ số các indi mới :D Chiến lược sơ khai không hiệu quả không đồng nghĩa với một ý tưởng tồi, chỉ là nó chưa được phát triển hoàn chỉnh thôi, không biết anh ấy cải tiến ra sao nhưng có vẻ anh ấy thích đánh theo kinh nghiệm nhiều hơn nên thường xuyên phá rule, do các lệnh thắng của anh ấy đa phần không theo setup, nhưng lúc có setup thì anh ấy vẫn bỏ lệnh nên thật khó để đánh giá chính xác mức độ hiệu quả của chiến lược. Do đó mình sẽ code cho tradingview backtest và cải tiến theo ý mình xem thế nào, đồng thời giới thiệu đến anh em cùng thư giãn cuối tuần nhé (đương nhiên sẽ có code backtest tặng anh em tự test nhé) :D

* Trước khi vào backtest và thêm thắt rule, mời anh em đọc bài gốc ở đây

BOE: http://www.binaryoptionsedge.com/topic/5910-novecento-5-min-reversal-strategy/
Bài giới thiệu trên TraderViet: https://traderviet.org/threads/bina...chi-danh-cho-newbie-khong-can-nhin-nen.10619/

* Rule cơ bản:

0a.png

0b.png


Chart EU IDC M5 (từ bar M5 14/10 5:00 am - 9/11/2019)

* Backtest theo rule cơ bản của tác giả và thông số chỉ báo giống như ảnh minh họa của tác giả chiến lược trên BOE (TDF(5,20) - Vostro(4))
0c.png


* Bactest theo rule cơ bản + điều chỉnh chu kỳ Vostro(4) thành Vostro(8) như mặc định của indicator
01.png

* Backtest theo rule cơ bản + rule của mình :D
02.png

* Phân tích các lệnh OTM theo rule cơ bản
03.png

04.png


* Thêm rule của mình: rule PA nhé
05.png

06.png


* Code indi Vostro, TDF và code backtest để anh em trải nghiệm chiến lược ở các cặp khác trên các sàn khác
1. Indi Vostro

Mã:
//@version=4
//author:Kıvanç Özbilgiç @fr3762 on twitter
study("The Vostro Indicator")
period156 = input(100, minval=1)
level = input(8, type=input.integer)
gd120 = sum(hl2, 5)
gd128 = gd120 * .2
gd121 = sum(high - low, 5)
gd136 = gd121 * .2 * .2

ibuff116 = (low - gd128) / gd136
ibuff112 = (high - gd128) / gd136

ibuff108 = iff(ibuff112 > level and high > wma(hl2, period156), 90, iff(ibuff116 < -level and low < wma(hl2, period156), -90, 0))
ibuff109 = iff(ibuff112 > level and ibuff112[1] > level or ibuff116 < -level and ibuff116[1] < -8, 0, ibuff108)
plot(ibuff109, color=color.blue, linewidth=2)
plot(80)
plot(-80)

2. Indi Trend Direction Force Index
Mã:
//@version=4
//author:causecelebre
study("Trend Direction Force Index - TDFI [wm]", shorttitle="TDFI [wm]")

filterHigh = input(1, title="Filter High")
filterMid1 = 0.5
filterMid2 = -0.5
filterLow = input(-1, title="Filter Low")
price = input(close, "Period")

//TFD5
lookback5 = input(5, title="Lookback")
mma5 = ema(price * 1000, lookback5)
smma5 = ema(mma5, lookback5)

impetmma5 = mma5 - mma5[1]
impetsmma5 = smma5 - smma5[1]
divma5 = abs(mma5 - smma5)
averimpet5 = (impetmma5 + impetsmma5) / 2

number5 = averimpet5
pow5 = 3
result5 = float(na)

for i = 1 to pow5 - 1 by 1
    if i == 1
        result5 := number5
        result5
    result5 := result5 * number5
    result5

tdf5 = divma5 * result5
ntdf5 = tdf5 / highest(abs(tdf5), lookback5 * 3)

//c = ntdf5 > filterHigh ? color.green : ntdf < filterLow ? color.red : color.gray
plot(ntdf5, linewidth=3, color=color.red)

//TFD20
lookback20 = input(20, title="Lookback")
mma20 = ema(price * 1000, lookback20)
smma20 = ema(mma20, lookback20)

impetmma20 = mma20 - mma20[1]
impetsmma20 = smma20 - smma20[1]
divma20 = abs(mma20 - smma20)
averimpet20 = (impetmma20 + impetsmma20) / 2

number20 = averimpet20
pow20 = 3
result20 = float(na)

for i = 1 to pow20 - 1 by 1
    if i == 1
        result20 := number20
        result20
    result20 := result20 * number20
    result20

tdf20 = divma20 * result20
ntdf20 = tdf20 / highest(abs(tdf20), lookback20 * 3)

//c = ntdf5 > filterHigh ? color.green : ntdf < filterLow ? color.red : color.gray
plot(ntdf20, linewidth=3, color=color.yellow)

hline(filterHigh, color=color.black, linewidth=3)
hline(filterMid1, color=color.gray)
hline(filterMid2, color=color.gray)
hline(filterLow, color=color.black, linewidth=3)

3. Code backtest
Mã:
//@version=4
//Bo Novecento M5
//author: anhnguyen14

strategy(title="Bo Novecento M5", overlay=true, pyramiding=14)

// === INPUTS

setup=input(true, title="Check = Novecentas Setup / Uncheck = anhnguyen14 Setup")

// - /INPUTS

//The Vostro Indicator
period156 = 100
level = input(8, title="Vostro Level")
gd120 = sum(hl2, 5)
gd128 = gd120 * .2
gd121 = sum(high - low, 5)
gd136 = gd121 * .2 * .2

ibuff116 = (low - gd128) / gd136
ibuff112 = (high - gd128) / gd136


ibuff108 = iff(ibuff112 > level and high > wma(hl2, period156), 90, iff(ibuff116 < -level and low < wma(hl2, period156), -90, 0))
ibuff109 = iff(ibuff112 > level and ibuff112[1] > level or ibuff116 < -level and ibuff116[1] < -8, 0, ibuff108)
//plot(ibuff109, color=color.blue, linewidth=2)
//plot(80)
//plot(-80)

//Trend Direction Force Index
filterHigh = 0.5
filterMid = 0
filterLow = -0.5
price = close

//TFD5
lookback5 = input(5, title="TDF Slow")
mma5 = ema(price * 1000, lookback5)
smma5 = ema(mma5, lookback5)

impetmma5 = mma5 - mma5[1]
impetsmma5 = smma5 - smma5[1]
divma5 = abs(mma5 - smma5)
averimpet5 = (impetmma5 + impetsmma5) / 2

number5 = averimpet5
pow5 = 3
result5 = float(na)

for i = 1 to pow5 - 1 by 1
    if i == 1
        result5 := number5
        result5
    result5 := result5 * number5
    result5

tdf5 = divma5 * result5
ntdf5 = tdf5 / highest(abs(tdf5), lookback5 * 3)

//c = ntdf5 > filterHigh ? color.green : ntdf < filterLow ? color.red : color.gray
//plot(ntdf5, linewidth=3, color=color.red)

//TFD20
lookback20 = input(20, title="TDF Fast")
mma20 = ema(price * 1000, lookback20)
smma20 = ema(mma20, lookback20)

impetmma20 = mma20 - mma20[1]
impetsmma20 = smma20 - smma20[1]
divma20 = abs(mma20 - smma20)
averimpet20 = (impetmma20 + impetsmma20) / 2

number20 = averimpet20
pow20 = 3
result20 = float(na)

for i = 1 to pow20 - 1 by 1
    if i == 1
        result20 := number20
        result20
    result20 := result20 * number20
    result20

tdf20 = divma20 * result20
ntdf20 = tdf20 / highest(abs(tdf20), lookback20 * 3)

//c = ntdf5 > filterHigh ? color.green : ntdf < filterLow ? color.red : color.gray
//plot(ntdf20, linewidth=3, color=color.yellow)

//hline(filterHigh, color=color.black)
//hline(filterMid, color=color.black)
//hline(filterLow, color=color.black)


//Barry Support & Resistance
FractalLen=3
isFractal(x) => highestbars(x,FractalLen*2+1)==-FractalLen
sF=isFractal(-low), support=low, support:=sF ? low[FractalLen] : support[1]
rF=isFractal(high), resistance=high, resistance:=rF ? high[FractalLen] : resistance[1]
//plot(series=support, title="Support", color=color.blue, offset=-FractalLen)
//plot(series=resistance, title="Resistance", color=color.red, offset=-FractalLen)
plotshape(sF, title="Lower fractal", style=shape.diamond, location=location.belowbar, color=color.black, offset=-FractalLen, size=size.tiny)
plotshape(rF, title="Upper fractal", style=shape.diamond, location=location.abovebar, color=color.black, offset=-FractalLen, size=size.tiny)

//Put Condition

//Novecento M5 - Put Condition
x=
       setup?
       ibuff109>80
       and ntdf5==1
       and ntdf20<0.5
       :
       ibuff109>80
       and ntdf5==1
       and ntdf20<0.5
       and high[barssince(rF)+3]<resistance[barssince(rF)+3]
       and close[0]<resistance[barssince(rF)+3]
      
    
//Call Condition

//Novecento M5 - Call Condition
y=
       setup?
       ibuff109<-80
       and ntdf5==-1
       and ntdf20>-0.5
       :
       ibuff109<-80
       and ntdf5==-1
       and ntdf20>-0.5
       and low[barssince(sF)+3]>support[barssince(sF)+3]
       and close[0]>support[barssince(sF)+3]
      


// - /FUNCTIONS

//--------------------------------------\\

// Alert
putcol = x ? color.red : na
callcol = y ? color.blue : na
bgcolor(putcol, transp=70, offset=1, title="Put Signal For Macro (A)")
bgcolor(callcol, transp=70, offset=1, title="Call Signal For Macro (A)")

strategy.entry("Call", strategy.long, when=(y))

strategy.entry("Put", strategy.short, when=(x))

strategy.close_all(when=barstate.isnew)

    
//EOF

=====Nice Weekend & Lucky Trading===
 

Giới thiệu sách Trading hay
Bộ sách Giao Dịch Thực Chiến của Trader Chuyên Nghiệp

Bộ sách tổng hợp những phương pháp giao dịch hiệu quả cao của những Trader chuyên nghiệp
* Backtest rule cơ bản với setup Strong breakout bar nhưng tráo đổi setup call thành put, put thành call :D
07.png
08.png
 
Chỉnh sửa lần cuối:
* Tổng kết lại sau khi thêm Price Action vào rule của anh tác giả và trả giá trị indi Vostro về mặc định là 8 chúng ta có được kết quả backtest khá tốt trong 4 tuần qua với chiến lược này :)
chrome_qh7ceVqQ5x.png
 
với bác có cách nào để chỉnh lại xem lịch sử của indi này đc ko, lịch sử của nó chỉ tầm 4 ngày là hết rồi.
Thua, mình không biết mql, với lại mình cũng không có xài MT4 luôn, chỉ có MT5 để review nhiều cặp cùng lúc thôi hà, các kỹ thuật trade mình đều dùng Tradingview, bạn vào khu vực MQL trên TraderViet mình hỏi thử xem :D
 
tui có xài indi này trong chiến lược cũ, có đều nếu chỉnh thành 8, tín hiệu nhiều lắm...
chiến lược cũ ở đây https://traderviet.org/threads/chia-se-bo-indi-bo-cua-toi.30263/
Cái này giống Novecento cải tiến nè, không biết Vostro111 này tác giả chiến lược có chế biến lại không chứ Vostro của tác giả indi trên tradingview (cũng là tác giả Vostro trên MT4) khi tăng lên 8 độ nhiễu giảm hẳn, bạn xem ảnh minh họa bên trên á :D
 
Bạn mở file tpl ra tìm đến đoạn name=VOSTRO111 dòng Length=4 sửa lại thành 8 là ok
Mã:
name=VOSTRO111
flags=339
window_num=2
<inputs>
Length=4
với bác có cách nào để chỉnh lại xem lịch sử của indi này đc ko, lịch sử của nó chỉ tầm 4 ngày là hết rồi.
Cái này giống Novecento cải tiến nè, không biết Vostro111 này tác giả chiến lược có chế biến lại không chứ Vostro của tác giả indi trên tradingview (cũng là tác giả Vostro trên MT4) khi tăng lên 8 độ nhiễu giảm hẳn, bạn xem ảnh minh họa bên trên á :D
không rõ lắm, nhưng trên mt4 mà chỉnh 4 thành 8 là ra 1 đống tín hiệu. Thanks ông nhá
 
với bác có cách nào để chỉnh lại xem lịch sử của indi này đc ko, lịch sử của nó chỉ tầm 4 ngày là hết rồi.

không rõ lắm, nhưng trên mt4 mà chỉnh 4 thành 8 là ra 1 đống tín hiệu. Thanks ông nhá
Ừm MT4/MT5 indi mà không có file mq4/mq5 là mình không biết trong đó nó viết thuật toán thế nào, mà mình không biết nó code thế nào thì không bao giờ mình dùng, nên mình chọn tradingview là vậy :D
 
Sau hai tuần quay lại xem backtest của em này thì thật ấn tượng, phong độ không hề giảm mà còn tăng lên, chỉ có điều là quá ít lệnh thui :D
chrome_Ii2SIYghyx.png
 
Sau vài tuần quay lại, thật sự nể cái chiến lược này rồi, phong độ luôn ổn định :)
chrome_ZDwMIC3tQD.png
 
@vĩnh0902 test lại cái này 2 tháng xem, keke, vốn lớn tính kelly đi chiến lược này ổn áp :D
Mã:
//@version=4
//Bo Novecento M5
//author: anhnguyen14

strategy(title="Bo Novecento M5", overlay=true, pyramiding=14)

// === INPUTS

setup1=input(true, title="Novecentas Setup")
// - /INPUTS

//The Vostro Indicator
period156 = 100
level = input(8, title="Vostro Level")
gd120 = sum(hl2, 5)
gd128 = gd120 * .2
gd121 = sum(high - low, 5)
gd136 = gd121 * .2 * .2

ibuff116 = (low - gd128) / gd136
ibuff112 = (high - gd128) / gd136


ibuff108 = iff(ibuff112 > level and high > wma(hl2, period156), 90, iff(ibuff116 < -level and low < wma(hl2, period156), -90, 0))
ibuff109 = iff(ibuff112 > level and ibuff112[1] > level or ibuff116 < -level and ibuff116[1] < -8, 0, ibuff108)
//plot(ibuff109, color=color.blue, linewidth=2)
//plot(80)
//plot(-80)

//Trend Direction Force Index
filterHigh = 0.5
filterMid = 0
filterLow = -0.5
price = close

//TFD5
lookback5 = input(5, title="TDF Fast")
mma5 = ema(price * 1000, lookback5)
smma5 = ema(mma5, lookback5)

impetmma5 = mma5 - mma5[1]
impetsmma5 = smma5 - smma5[1]
divma5 = abs(mma5 - smma5)
averimpet5 = (impetmma5 + impetsmma5) / 2

number5 = averimpet5
pow5 = 3
result5 = float(na)

for i = 1 to pow5 - 1 by 1
    if i == 1
        result5 := number5
        result5
    result5 := result5 * number5
    result5

tdf5 = divma5 * result5
ntdf5 = tdf5 / highest(abs(tdf5), lookback5 * 3)

//c = ntdf5 > filterHigh ? color.green : ntdf < filterLow ? color.red : color.gray
//plot(ntdf5, linewidth=3, color=color.red)

//TFD20
lookback20 = input(20, title="TDF Slow")
mma20 = ema(price * 1000, lookback20)
smma20 = ema(mma20, lookback20)

impetmma20 = mma20 - mma20[1]
impetsmma20 = smma20 - smma20[1]
divma20 = abs(mma20 - smma20)
averimpet20 = (impetmma20 + impetsmma20) / 2

number20 = averimpet20
pow20 = 3
result20 = float(na)

for i = 1 to pow20 - 1 by 1
    if i == 1
        result20 := number20
        result20
    result20 := result20 * number20
    result20

tdf20 = divma20 * result20
ntdf20 = tdf20 / highest(abs(tdf20), lookback20 * 3)

//c = ntdf5 > filterHigh ? color.green : ntdf < filterLow ? color.red : color.gray
//plot(ntdf20, linewidth=3, color=color.yellow)

//hline(filterHigh, color=color.black)
//hline(filterMid, color=color.black)
//hline(filterLow, color=color.black)


//Barry Support & Resistance
FractalLen=3
isFractal(x) => highestbars(x,FractalLen*2+1)==-FractalLen
sF=isFractal(-low), support=low, support:=sF ? low[FractalLen] : support[1]
rF=isFractal(high), resistance=high, resistance:=rF ? high[FractalLen] : resistance[1]
//plot(series=support, title="Support", color=color.blue, offset=-FractalLen)
//plot(series=resistance, title="Resistance", color=color.red, offset=-FractalLen)
plotshape(sF, title="Lower fractal", style=shape.diamond, location=location.belowbar, color=color.black, offset=-FractalLen, size=size.tiny)
plotshape(rF, title="Upper fractal", style=shape.diamond, location=location.abovebar, color=color.black, offset=-FractalLen, size=size.tiny)

//Put Condition

//Novecento M5 - Put Condition - Novecentas Setup
x1=
       setup1?
       ibuff109>80
       and ntdf5==1
       and ntdf20<0.5
       :false


//Novecento M5 - Call Condition - Novecentas Setup
y1=
       setup1?
       ibuff109<-80
       and ntdf5==-1
       and ntdf20>-0.5
       : false


// - /FUNCTIONS

x=
       x1
y=
       y1
     
//--------------------------------------\\

// Alert
putcol = x ? color.red : na
callcol = y ? color.blue : na
bgcolor(putcol, transp=70, offset=1, title="Put Signal For Macro (A)")
bgcolor(callcol, transp=70, offset=1, title="Call Signal For Macro (A)")

strategy.entry("Call", strategy.long, when=(y))

strategy.entry("Put", strategy.short, when=(x))

strategy.close_all(when=barstate.isnew)

   
//EOF
 
Xem danh sách giao dịch tháng 12 thì đa số lệnh nằm ngoài khung giao dịch của ma trận, thôi để ngắm làm động lực thôi :D
 

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

  • DuongHuy trong Hệ thống giao dịch - Trading system 37,485 Xem / 18 Trả lời
  • Mạc An trong Phân tích Forex - Vàng - Hàng hóa 1,555 Xem / 94 Trả lời
  • DuongHuy trong Phân tích Forex - Vàng - Hàng hóa 366 Xem / 29 Trả lời
  • Quíc Óp trong Phân tích Forex - Vàng - Hàng hóa 340 Xem / 18 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