Chiến lược ngắn hạn và dài hạn của Ichimoku với quản lý tiền bạc

Tác giả:ChaoZhang, Ngày: 2023-12-28 12:12:51
Tags:

img

Tổng quan

Chiến lược này là một cải tiến dựa trên hệ thống giao dịch Ichimoku. Ý tưởng chính là kết hợp chỉ số Ichimoku và các quy tắc quản lý tiền để xác định các cơ hội giao dịch ngắn và dài.

Nguyên tắc chiến lược

Chiến lược sử dụng hệ thống Ichimoku cổ điển như một tham chiếu cơ bản.

Tenkan-Sen: Đường chuyển đổi.

Kijun-Sen: Đường cơ sở.

Senkou Span: Đường dẫn.

Chikou Span: Đường đi lại.

Trên cơ sở này, chiến lược đã cải thiện như sau:

  1. Các thông số thời gian theo lý thuyết vuông lẻ để phù hợp hơn với các mô hình thị trường.

  2. Các quy tắc quản lý tiền được thêm vào, bao gồm dừng lỗ, lấy lợi nhuận, kích thước vị trí vv, để kiểm soát rủi ro giao dịch.

  3. Thời gian kiểm tra ngược có thể điều chỉnh để kiểm tra toàn diện hơn.

Cụ thể, các điều kiện nhập cảnh dài bao gồm tenkan cross kijun lên, chikou trên giá, giá trên kumo, kumo tăng trong tương lai v.v.

Các quy tắc quản lý tiền đòi hỏi 30% lợi nhuận và 5% dừng lỗ cho các giao dịch dài; dừng lỗ nếu nhiều hơn 3 ATR từ tenkan cho các giao dịch ngắn.

Phân tích lợi thế

Những lợi thế chính của việc kết hợp Ichimoku và quản lý tiền là:

  1. Ichimoku chính nó phản ánh xu hướng ngắn hạn, trung bình và dài hạn, nhập / ra hợp lý.

  2. Lý thuyết vuông lẻ tối ưu hóa các thông số để phù hợp với thống kê thị trường.

  3. Quản lý tiền hiệu quả kiểm soát lệnh dừng thương mại duy nhất trong khi lợi nhuận vượt quá.

  4. Thời gian thử nghiệm ngược có thể điều chỉnh cho phép thử nghiệm toàn diện hơn.

Tóm lại, chiến lược này xem xét toàn diện xu hướng, lựa chọn tham số, kiểm soát rủi ro vv, và có hiệu quả trong việc xác định các cơ hội ngắn hạn và kiểm soát rủi ro giao dịch, với tính thực tế mạnh mẽ.

Phân tích rủi ro

Những rủi ro chính của chiến lược này xuất phát từ:

  1. Ichimoku có xu hướng phát hiện ra những thông tin sai, gây ra các mục nhập không cần thiết.

  2. Lợi nhuận cố định và dừng lỗ có thể dễ bị bẫy.

  3. Dữ liệu backtesting không toàn diện có thể đánh giá quá cao hiệu suất.

  4. Chiến lược phù hợp hơn với thị trường xu hướng. Có thể hoạt động kém hơn ở các thị trường khác nhau. Điều kiện nhập cảnh có thể được tối ưu hóa để xác định xu hướng.

Hướng dẫn cải thiện

Các lĩnh vực cải tiến chính bao gồm:

  1. Thêm bộ lọc chỉ số để cải thiện chất lượng đầu vào.

  2. Lợi nhuận động và dừng lỗ. Ví dụ, lợi nhuận sau khi N ATR phá vỡ, dừng lỗ dưới mức hỗ trợ.

  3. Kiểm tra nhiều tài sản trên dữ liệu dài hơn để xác minh tính ổn định.

  4. Phân biệt xu hướng và các thị trường khác nhau. Tối ưu hóa các mục nhập để thích nghi với các điều kiện thị trường khác nhau.

Kết luận

Chiến lược này xem xét toàn diện xu hướng, quản lý tiền bạc vv, sử dụng Ichimoku để xác định các cơ hội dài hạn và áp dụng các quy tắc kiểm soát rủi ro để hạn chế lỗ giao dịch duy nhất.


/*backtest
start: 2023-11-27 00:00:00
end: 2023-12-27 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// Author Obarut
//@version=5
strategy("İchimoku Strategy With MM Short-Long",overlay=true,process_orders_on_close=true)

//Ichimoku Inputs
ts_period = input.int(8, minval=1, title="Tenkan-Sen Period")
ks_period = input.int(16, minval=1, title="Kijun-Sen Period")
ssb_period = input.int(24, minval=1, title="Senkou-Span B Period")
cs_offset = input.int(16, minval=1, title="Chikou-Span Offset")
ss_offset = input.int(8, minval=1, title="Senkou-Span Offset")
long_entry = input(true, title="Long Entry")
short_entry = input(true, title="Short Entry")

// Back Testing Period Inputs

fromday = input.int(defval=1,title="Start Date",minval=1,maxval=31) 
frommonth = input.int(defval=1,title="Start Month",minval=1,maxval=12)
fromyear = input.int(defval=1980,title="Start Year",minval=1800, maxval=2100)
today = input.int(defval=1,title="En Date",minval=1,maxval=31)
tomonth = input.int(defval=1,title="End Month",minval=1,maxval=12)
toyear =input.int(defval=2100,title="End Year",minval=1800,maxval=2200)
start=timestamp(fromyear,frommonth,fromday,00,00)
finish=timestamp(toyear,tomonth,today,00,00)
timewindow= time>=start and time<=finish

//Ichimoku Componenets Calculation Function
middle(len) => math.avg(ta.lowest(len), ta.highest(len))

// Ichimoku Components

tenkan = middle(ts_period)
kijun = middle(ks_period)
senkouA = math.avg(tenkan, kijun)
senkouB = middle(ssb_period)
//Senkou Span Lines slopes
slopetenkan=(tenkan-tenkan[2])/tenkan
slopekijun= (kijun-kijun[2])/kijun
//Avarage True Range 
atr = ta.atr(14)
//Senkou Span Lines
ss_above = math.max(senkouA[ss_offset-1], senkouB[ss_offset-1])
ss_below = math.min(senkouA[ss_offset-1], senkouB[ss_offset-1])

// Price Distance From Tenkan
distance = close - tenkan

// Price Distance from Kijun
distancek = close - kijun

// Entry/Exit Signals

tk_cross_kijun_bull = tenkan >= kijun//Tenkan Sen is greater than or equal to  Kijun Sen
tk_cross_kijun_bear = tenkan <= kijun//Tenkan Sen is smaller than or equal to Kijun Sen
cs_cross_bull = close > high[cs_offset-1]//Chikou is above the price
cs_cross_bear = close < close[cs_offset-1]//Chikou is below the price
price_above_kumo = close > ss_above//Price is above the Kumo cloud
pbsenkA = close < ss_above // Price is below the Senkou Span which is higher
pasenkB = close > ss_below// Price is above the Senkou span which is lower
price_below_kumo = close < ss_below // Price is below Kumo cloud
future_kumo_bull = senkouA > senkouB and (ta.roc(senkouA,3)>0) and (ta.roc(senkouB,3)>=0) // Future Kumo cloud is bullish
pbtenkan=close<tenkan
tkbelowkij=tenkan<kijun
future_kumo_bear = senkouA < senkouB//Future Kumo cloud is bearish
// Price Distance From Tenken
disbull = distance < 2*atr
//Price Distance From Kijun
disbullk = distancek < 3*atr
//Price Above Tenkan Condition
patk = close > tenkan
// Kijun Above Senkou Span Condition
kjasenkA = kijun > ss_above
// Price Below Kijun Condition
pbkijun = close < kijun
//Consolidation Tenkan and Kijun are inside Kumo cloud
kijuninsidekumo= kijun<ss_above and kijun>ss_below
tenkaninsidekumo= tenkan<ss_above and tenkan>ss_below
consolidation=kijuninsidekumo and tenkaninsidekumo

//Bullish Entry Condition

bullish= tk_cross_kijun_bull and cs_cross_bull and price_above_kumo and future_kumo_bull and disbull and patk 
     and not consolidation
//Bullish exit
bearish=tk_cross_kijun_bear and pbsenkA and cs_cross_bear  and future_kumo_bear
      or price_below_kumo     
// Bearish Entry Condition

bearish2=tk_cross_kijun_bear and pbtenkan and tkbelowkij and tkbelowkij and cs_cross_bear and future_kumo_bear

if(bullish and timewindow and long_entry )
    strategy.entry("Long Entry", strategy.long)


if(bearish2 and timewindow and short_entry)
    strategy.entry("Short Entry",strategy.short)
// Bearish Condition



lastentryprice = strategy.opentrades.entry_price(strategy.opentrades - 1)

// Take Profit or Stop Loss in Bearish

exit1= (close-tenkan)>3*atr and slopetenkan<=0
exit2= (close-lastentryprice)>5*atr and close<(tenkan-0.04*atr)

if(bearish and timewindow and not short_entry or exit1 or exit2  or (close>1.30*lastentryprice  ) or (close< 0.95*lastentryprice))
    strategy.close("Long Entry")
if(bullish and timewindow and not long_entry)
    strategy.close("Short Entry")
if(time>finish)
    strategy.close_all("time up")

plot(tenkan, color=#0496ff, title="Tenkan-Sen")
plot(kijun, color=#991515, title="Kijun-Sen")
plot(close, offset=-cs_offset+1, color=#2e640e, title="Chikou-Span")
sa=plot(senkouA, offset=ss_offset-1, color=color.rgb(17, 122, 21), title="Senkou-Span A")
sb=plot(senkouB, offset=ss_offset-1, color=color.rgb(88, 8, 8), title="Senkou-Span B")
fill(sa, sb, color = senkouA > senkouB ? color.rgb(198, 234, 198) : color.rgb(208, 153, 153), title="Cloud color")

Thêm nữa