
Chiến lược này được gọi là Blitz Rings, một chiến lược theo dõi xu hướng dựa trên ba đường trung bình di chuyển. Nó đánh giá xu hướng giá bằng cách tính toán chéo của đường nhanh, đường trung và đường chậm và đặt giá mục tiêu và giá dừng bằng giá trị ATR.
Chiến lược này sử dụng ba đường trung bình di chuyển sau:
Khi đường nhanh đi qua đường trung bình, đường trung bình đi qua đường chậm, đánh giá là xem xu hướng nhiều; khi đường nhanh đi qua đường trung bình, đường trung bình đi qua đường chậm, đánh giá là xu hướng trần.
Để lọc ra một số giao dịch ồn ào, chiến lược cũng đặt ra một số điều kiện phụ:
Khi đáp ứng các điều kiện này, sẽ phát ra tín hiệu mua hoặc bán. Mỗi lần chỉ giữ một vị trí, bạn có thể mở lại vị trí sau khi thanh toán hoặc dừng lỗ.
Giá mục tiêu và giá dừng là một số nhân của giá trị ATR.
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:
Để kiểm soát rủi ro, khuyến nghị điều chỉnh các tham số trung bình di chuyển thích hợp, tối ưu hóa ATR và đặt thời gian giữ tối đa để tránh tổn thất đơn lẻ quá lớn.
Chiến lược này có thể được tối ưu hóa bằng cách:
Chiến lược này nói chung là một chiến lược theo dõi xu hướng ổn định. Nó chủ yếu dựa trên phương tiện di chuyển để xác định hướng xu hướng, và có một số chỉ số kỹ thuật hợp tác để hỗ trợ, có thể lọc một phần tiếng ồn. Mặc dù vẫn còn không gian để tối ưu hóa hơn nữa, nhưng rủi ro tổng thể có thể kiểm soát được, phù hợp để đầu tư theo xu hướng đường dài.
/*backtest
start: 2024-01-02 00:00:00
end: 2024-02-01 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © greenmask9
//@version=4
strategy("Dazzling Bolts", overlay=true)
//max_bars_back=3000
// 13 SMMA
len = input(10, minval=1, title="SMMA Period")
src = input(close, title="Source")
smma = 0.0
smma := na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len
// 55 EMA
emalength = input(55, title="EMA Period")
ema = ema(close, emalength)
// 100 SMA
smalength = input(110, title="SMA Period")
sma = sma(close, smalength)
emaforce = input(title="Force trend with medium EMA", type=input.bool, defval=true)
offsetemavalue = input(defval = 6)
bullbounce = smma>ema and ema>sma and low[5]>ema and low[2]<ema and close[1]>ema and (ema[offsetemavalue]>sma or (not emaforce))
bearbounce = smma<ema and ema<sma and high[5]<ema and high[2]>ema and close[1]<ema and (ema[offsetemavalue]<sma or (not emaforce))
plotshape(bullbounce, title= "Purple", location=location.belowbar, color=#ff33cc, transp=0, style=shape.triangleup, size=size.tiny, text="Bolts")
plotshape(bearbounce, title= "Purple", location=location.abovebar, color=#ff33cc, transp=0, style=shape.triangledown, size=size.tiny, text="Bolts")
strategy.initial_capital = 50000
ordersize=floor(strategy.initial_capital/close)
longs = input(title="Test longs", type=input.bool, defval=true)
shorts = input(title="Test shorts", type=input.bool, defval=true)
atrlength = input(title="ATR length", defval=12)
atrm = input(title="ATR muliplier",type=input.float, defval=2)
atr = atr(atrlength)
target = close + atr*atrm
antitarget = close - (atr*atrm)
//limits and stop do not move, no need to count bars from since
bullbuy = bullbounce and longs and strategy.opentrades==0
bb = barssince(bullbuy)
bearsell = bearbounce and shorts and strategy.opentrades==0
bs = barssince(bearsell)
if (bullbuy)
strategy.entry("Boltsup", strategy.long, ordersize)
strategy.exit ("Bolts.close", from_entry="Boltsup", limit=target, stop=antitarget)
if (crossover(smma, sma))
strategy.close("Boltsup", qty_percent = 100, comment = "Bolts.crossover")
if (bearsell)
strategy.entry("Boltsdown", strategy.short, ordersize)
strategy.exit("Bolts.close", from_entry="Boltsdown", limit=antitarget, stop=target)
if (crossunder(smma, sma))
strategy.close("Boltsdown", qty_percent = 100, comment = "Bolts.crossover")
// if (bb<5)
// bulltarget = line.new(bar_index[bb], target[bb], bar_index[0], target[bb], color=color.blue, width=2)
// bullclose = line.new(bar_index[bb], close[bb], bar_index[0], close[bb], color=color.blue, width=2)
// bullstop = line.new(bar_index[bb], antitarget[bb], bar_index[0], antitarget[bb], color=color.blue, width=2)
// if (bs<5)
// bulltarget = line.new(bar_index[bs], antitarget[bs], bar_index[0], antitarget[bs], color=color.purple, width=2)
// bullclose = line.new(bar_index[bs], close[bs], bar_index[0], close[bs], color=color.purple, width=2)
// bullstop = line.new(bar_index[bs], target[bs], bar_index[0], target[bs], color=color.purple, width=2)