
Chiến lược này dựa trên các chỉ số Brin Belt để đánh giá tín hiệu giao dịch và thiết lập dừng lỗ. Khi giá chạm đường trung tâm của Brin Belt, mở nhiều lỗ hổng và thiết lập 0.5% dừng và 3% dừng là chiến lược giao dịch ngắn.
Brin Belt là trung bình di chuyển đơn giản N ngày của giá đóng cửa. Brin Belt là trung bình di chuyển đơn giản N ngày của giá đóng cửa. Brin Belt là trung bình + K lần chênh lệch tiêu chuẩn giá đóng cửa N ngày của trung bình + K lần chênh lệch tiêu chuẩn giá đóng cửa N ngày của trung bình.
Phương pháp giải quyết rủi ro:
Chiến lược này có ý tưởng tổng thể rõ ràng, sử dụng dây chuyền Brin để đánh giá hiệu quả tín hiệu giao dịch. Tuy nhiên, giao dịch thường xuyên và có không gian lợi nhuận hạn chế, nên kết hợp các chỉ số đánh giá xu hướng để lọc tín hiệu, đồng thời bằng cách tối ưu hóa các tham số để tăng hiệu quả chiến lược.
/*backtest
start: 2024-02-01 00:00:00
end: 2024-02-29 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Estrategia Bollinger Bands", shorttitle="BB Strategy", overlay=true)
// Parámetros de las Bandas de Bollinger
length = input(20, title="Longitud")
mult = input(2.0, title="Multiplicador")
// Calcula las Bandas de Bollinger
basis = ta.sma(close, length)
upper_band = basis + mult * ta.stdev(close, length)
lower_band = basis - mult * ta.stdev(close, length)
// Condiciones para realizar operaciones
price_touches_basis_up = ta.crossover(close, basis)
price_touches_basis_down = ta.crossunder(close, basis)
// Lógica de la estrategia
if (price_touches_basis_up)
strategy.entry("Compra", strategy.long, qty = 1)
if (price_touches_basis_down)
strategy.entry("Venta", strategy.short, qty = 1)
// Lógica para cerrar la operación con un movimiento del 0,5% (take profit) o 3% (stop loss)
target_profit = 0.005 // Actualizado a 0.5%
stop_loss = 0.03
if (strategy.position_size > 0)
strategy.exit("Take Profit/Close", from_entry = "Compra", profit = close * (1 + target_profit))
strategy.exit("Stop Loss/Close", from_entry = "Compra", loss = close * (1 - stop_loss))
if (strategy.position_size < 0)
strategy.exit("Take Profit/Close", from_entry = "Venta", profit = close * (1 - target_profit))
strategy.exit("Stop Loss/Close", from_entry = "Venta", loss = close * (1 + stop_loss))
// Dibuja las Bandas de Bollinger en el gráfico
plot(upper_band, color=color.blue, title="Upper Band")
plot(lower_band, color=color.red, title="Lower Band")
plot(basis, color=color.green, title="Basis")