
Đây là một chiến lược giao dịch tần số cao dựa trên hướng đóng cửa K trong 1 phút. Chiến lược xác định xu hướng thị trường bằng cách đánh giá mối quan hệ giữa giá đóng cửa K và giá mở cửa, và làm nhiều sau khi K đường thị giá được hình thành, làm trống sau khi K đường thị giá được hình thành. Chiến lược sử dụng thời gian giữ vị trí cố định, thanh toán vị trí khi K đường tiếp theo được đóng cửa và giới hạn số lần giao dịch tối đa mỗi ngày để kiểm soát rủi ro.
Lập luận cốt lõi của chiến lược là đánh giá xu hướng thị trường ngắn hạn thông qua đường K:
Chiến lược này là một hệ thống giao dịch tần số cao dựa trên hướng đóng cửa K-line để nắm bắt cơ hội thị trường ngắn hạn thông qua phân tích hành vi giá đơn giản. Ưu điểm của chiến lược là logic đơn giản, thời gian nắm giữ ngắn, rủi ro có thể kiểm soát được, nhưng đồng thời cũng phải đối mặt với các thách thức như chi phí giao dịch cao, phá vỡ giả.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-12-10 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Candle Close Strategy", overlay=true)
// Define conditions for bullish and bearish candlesticks
isBullish = close > open
isBearish = close < open
// Track the number of bars since the trade was opened and the number of trades per day
var int barsSinceTrade = na
var int tradesToday = 0
// Define a fixed position size for testing
fixedPositionSize = 1
// Entry condition: buy after the close of a bullish candlestick
if (isBullish and tradesToday < 200) // Limit to 200 trades per day
strategy.entry("Buy", strategy.long, qty=fixedPositionSize)
barsSinceTrade := 0
tradesToday := tradesToday + 1
// Entry condition: sell after the close of a bearish candlestick
if (isBearish and tradesToday < 200) // Limit to 200 trades per day
strategy.entry("Sell", strategy.short, qty=fixedPositionSize)
barsSinceTrade := 0
tradesToday := tradesToday + 1
// Update barsSinceTrade if a trade is open
if (strategy.opentrades > 0)
barsSinceTrade := nz(barsSinceTrade) + 1
// Reset tradesToday at the start of a new day
if (dayofmonth != dayofmonth[1])
tradesToday := 0
// Exit condition: close the trade after the next candlestick closes
if (barsSinceTrade == 2)
strategy.close("Buy")
strategy.close("Sell")
// Plot bullish and bearish conditions
plotshape(series=isBullish, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=isBearish, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Plot the candlesticks
plotcandle(open, high, low, close, title="Candlesticks")