
Chiến lược này là một hệ thống giao dịch động dựa trên các đột phá của đám mây và các đường giao thoa song song. Nó kết hợp nhiều thành phần của chỉ số đám mây để xác định định hướng và động lực thay đổi của xu hướng thị trường, tạo ra tín hiệu giao dịch thông qua mối quan hệ giữa vị trí của giá với đám mây và sự giao thoa của đường chuyển đổi với đường chuẩn. Ý tưởng cốt lõi của chiến lược là nắm bắt cơ hội động lực trong xu hướng mạnh.
Chiến lược này sử dụng các thành phần quan trọng sau:
Điều kiện tham gia:
Điều kiện xuất phát: Hạ lỗ khi có tín hiệu giao dịch ngược lại
Đề xuất kiểm soát rủi ro:
Đây là một hệ thống chiến lược tổng hợp kết hợp theo dõi xu hướng và giao dịch động lực. Bằng cách sử dụng kết hợp của phá vỡ đám mây và giao thoa đồng tuyến, nó có thể nắm bắt hiệu quả cơ hội xu hướng thị trường trong khi duy trì sự ổn định của chiến lược. Việc áp dụng chiến lược thành công đòi hỏi phải chú ý đến ba khía cạnh quan trọng là tối ưu hóa tham số, kiểm soát rủi ro và thích ứng với thị trường.
/*backtest
start: 2024-02-08 00:00:00
end: 2025-02-06 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Ichimoku Cloud Strategy", shorttitle="IchimokuStrat", overlay=true)
//=== Užívateľské vstupy ===//
tenkanLen = input.int(9, "Tenkan-Sen Length")
kijunLen = input.int(26, "Kijun-Sen Length")
senkouSpanBLen = input.int(52, "Senkou Span B Length")
displacement = input.int(26, "Cloud Displacement")
//=== Výpočet Ichimoku liniek ===//
// Tenkan-Sen (Conversion Line)
tenkanHigh = ta.highest(high, tenkanLen)
tenkanLow = ta.lowest(low, tenkanLen)
tenkan = (tenkanHigh + tenkanLow) / 2.0
// Kijun-Sen (Base Line)
kijunHigh = ta.highest(high, kijunLen)
kijunLow = ta.lowest(low, kijunLen)
kijun = (kijunHigh + kijunLow) / 2.0
// Senkou Span A = (Tenkan + Kijun)/2, posunutý dopredu
spanA = (tenkan + kijun) / 2.0
// Senkou Span B = (highest high + lowest low)/2, posunutý dopredu
spanBHigh = ta.highest(high, senkouSpanBLen)
spanBLow = ta.lowest(low, senkouSpanBLen)
spanB = (spanBHigh + spanBLow) / 2.0
// Chikou Span (voliteľný) = current close, posunutý dozadu
chikou = close[displacement]
//=== Podmienky pre LONG / SHORT ===//
// Cena NAD oblakom => close > spanA a close > spanB
// Tenkan NAD Kijun => tenkan > kijun
longCondition = (close > spanA and close > spanB) and (tenkan > kijun)
// Cena POD oblakom => close < spanA a close < spanB
// Tenkan POD Kijun => tenkan < kijun
shortCondition = (close < spanA and close < spanB) and (tenkan < kijun)
//=== Vstup do pozícií ===//
if longCondition
strategy.entry("Long", strategy.long)
if shortCondition
strategy.entry("Short", strategy.short)
//=== Výstup pri opačnom signáli ===//
if strategy.position_size > 0 and shortCondition
strategy.close("Long", comment="Exit Long")
if strategy.position_size < 0 and longCondition
strategy.close("Short", comment="Exit Short")
//=== Vykreslenie Ichimoku = vyplnený oblak ===//
// Najskôr si ulož premenne (plot) pre spanA, spanB
plotA = plot(spanA, title="Span A", offset=displacement, color=color.new(color.green, 0))
plotB = plot(spanB, title="Span B", offset=displacement, color=color.new(color.red, 0))
// Namiesto plotfill() použijeme fill()
fill(plotA, plotB, title="Cloud Fill", color=color.new(color.green, 80))