
Chiến lược này được thiết kế dựa trên chỉ số kỹ thuật Ichimoku, sử dụng phương thức giao dịch theo xu hướng và phá vỡ cân bằng, nhằm nắm bắt xu hướng giá trung bình và dài, để tạo ra lợi nhuận ổn định.
Chiến lược sử dụng năm đường của bảng cân bằng ban đầu - đường chuyển hướng, đường chuẩn, đường đi trước, đường dẫn đầu và đường trì hoãn để đánh giá xu hướng giá và kháng cự hỗ trợ. Các quy tắc đánh giá cụ thể như sau:
Sau khi đánh giá tổng hợp các tín hiệu giao dịch trên, thời gian nhập cảnh cuối cùng sẽ được quyết định.
Chiến lược này có những ưu điểm sau:
Chiến lược này cũng có những rủi ro sau:
Đối với các rủi ro trên, có thể giải quyết bằng cách thiết lập các tham số tối ưu hóa, kết hợp với các chỉ số khác để đánh giá sự thay đổi xu hướng, dừng nghiêm ngặt.
Các chiến lược có thể được tối ưu hóa bằng cách:
Chiến lược này sử dụng bảng cân bằng để đánh giá xu hướng giá và tình trạng lưu động, sử dụng mô hình theo dõi xu hướng, có thể lọc hiệu quả tiếng ồn để nắm bắt xu hướng đường dài trung bình, rủi ro rút lui nhỏ hơn, phù hợp với vị trí đường dài trung bình. Bằng cách tối ưu hóa thêm các tham số thiết lập, thêm các chỉ số lọc hỗ trợ, khai thác tín hiệu biến đổi xu hướng, có thể nâng cao chiến lược Factor lợi nhuận.
/*backtest
start: 2022-12-04 00:00:00
end: 2023-12-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("My Ichimoku Strat", overlay=true,default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=1000, currency=currency.EUR)
// === BACKTEST RANGE ===
FromMonth = input(defval = 1, title = "From Month", minval = 1)
FromDay = input(defval = 1, title = "From Day", minval = 1)
FromYear = input(defval = 2017, title = "From Year", minval = 2014)
ToMonth = input(defval = 1, title = "To Month", minval = 1)
ToDay = input(defval = 1, title = "To Day", minval = 1)
ToYear = input(defval = 9999, title = "To Year", minval = 2014)
// === SERIES SETUP ===
//**** Inputs *******
KijunSenLag = input(6,title="KijunSen Lag",minval=1)
//Kijun-sen
//Support resistance line, buy signal when price crosses it
KijunSen = sma((high+low)/2,26)
buy2 = crossover(close,KijunSen) and (rising(KijunSen,KijunSenLag) or falling(KijunSen,KijunSenLag))
sell2= crossunder(close,KijunSen) and (rising(KijunSen,KijunSenLag) or falling(KijunSen,KijunSenLag))
//Tenkan-Sen
TenkanSen = sma((high+low)/2,9)
//Senkou Span A
SenkouSpanA = (KijunSen + TenkanSen)/2
//Senkou Span B
SenkouSpanB = sma((high+low)/2,52)
//Cloud conditions : ignore buy if price is under the cloud
// Huge cloud means safe support and resistance. Little cloud means danger.
buy3 = close > SenkouSpanA and close > SenkouSpanB
sell3 = close < SenkouSpanA and close < SenkouSpanB
//Chikou Span
//Buy signal : crossover(ChikouSpan,close)
//Sell Signal : crossunder(ChikouSpan,close)
ChikouSpan = close
buy1=crossover(ChikouSpan,close[26])
sell1=crossunder(ChikouSpan,close[26])
plotshape(buy1,style=shape.diamond,color=lime,size=size.small)
plotshape(sell1,style=shape.diamond,color=orange,size=size.small)
//Alerts
buyCompteur = -1
buyCompteur := nz(buyCompteur[1],-1)
buyCompteur := buy2 or buy3 ? 1 : buyCompteur
buyCompteur := buyCompteur > 0 ? buyCompteur + 1 : buyCompteur
buyCompteur := sell2 or sell3 ? -1 : buyCompteur
sellCompteur = -1
sellCompteur := nz(sellCompteur[1],-1)
sellCompteur := sell2 or sell3 ? 1 : sellCompteur
sellCompteur := sellCompteur > 0 ? sellCompteur + 1 : sellCompteur
sellCompteur := buy2 or buy3 ? -1 : sellCompteur
sell= sell2 and sell3 or (sell1 and buyCompteur <= 8)
buy=buy2 and buy3 or (buy1 and sellCompteur <=8)
plotchar(buy,char='B',size=size.small,color=lime)
plotchar(sell,char='S',size=size.small,color=orange)
//plots
plot(KijunSen,title="Kijun-Sen",color=blue,linewidth=4)
plot(TenkanSen,title="Tenkan-Sen",color=red,linewidth=2)
cloudA = plot(SenkouSpanA,title="cloud A", color=lime,offset=26,linewidth=2)
cloudB = plot(SenkouSpanB,title="cloud B", color=orange,offset=26,linewidth=2)
plot(ChikouSpan,title="lag span",color=fuchsia, linewidth=2,offset=-26)
//plot()
fill(cloudA,cloudB,color=SenkouSpanA>SenkouSpanB?lime:orange)
//plot(close,color=silver,linewidth=4)
// === ALERTS ===
strategy.entry("L", strategy.long, when=(buy and (time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
strategy.close("L", when=(sell and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))