
This is a quantitative trading strategy based on market pressure and candlestick overlap patterns. The strategy identifies potential market reversal points by analyzing trading volume, candlestick patterns, and price overlap relationships, combined with take-profit conditions for automated trading. The strategy uses fixed position sizing and sets a 20% take-profit target.
The core logic of the strategy incorporates two main dimensions: market pressure and candlestick overlap. For market pressure, the strategy determines buying and selling pressure by comparing current trading volume with the 20-period volume moving average. When the volume of a green candle (bullish) exceeds the moving average, it indicates buying pressure; when the volume of a red candle (bearish) exceeds the moving average, it indicates selling pressure. For candlestick overlap, the strategy focuses on the overlap relationship between adjacent candles. When a green candle overlaps with the previous red candle, it’s considered a potential long signal; when a red candle overlaps with the previous green candle, it’s considered a potential short signal.
The strategy captures market reversal opportunities by combining market pressure and candlestick overlap patterns, demonstrating solid theoretical foundation and practical feasibility. Its strengths lie in multi-dimensional signal verification and clear risk control, though it faces certain market risks and has room for optimization. Through further optimization and refinement, the strategy shows potential for improved performance in actual trading.
/*backtest
start: 2024-12-06 00:00:00
end: 2025-01-04 08:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Pressure Reversal & Candle Overlap", overlay=true, default_qty_type=strategy.fixed, default_qty_value=0.1)
// Parameters
take_profit_percent = 20 // Take Profit Percentage
qty = 0.1 // Quantity to trade (BTC)
// Candle Definitions
green_candle = close > open
red_candle = close < open
current_body = math.abs(close - open)
// Previous Candle Data
prev_close = ta.valuewhen(green_candle or red_candle, close, 1)
prev_open = ta.valuewhen(green_candle or red_candle, open, 1)
// Check Candle Overlaps
green_overlaps_red = green_candle and close >= prev_open and open <= prev_close
red_overlaps_green = red_candle and close <= prev_open and open >= prev_close
// Define Buying and Selling Pressure
buying_pressure = green_candle and volume > ta.sma(volume, 20)
selling_pressure = red_candle and volume > ta.sma(volume, 20)
// Entry Conditions
long_entry_pressure = selling_pressure
long_entry_overlap = green_overlaps_red
short_entry_pressure = buying_pressure
short_entry_overlap = red_overlaps_green
// Calculate Take Profit Levels
take_profit_level_long = close * (1 + 20 / 100)
take_profit_level_short = close * (1 - 20 / 100)
// Strategy Logic
if (long_entry_pressure or long_entry_overlap)
strategy.entry("Buy Long", strategy.long, qty=qty)
strategy.exit("TP Long", "Buy Long", limit=take_profit_level_long)
if (short_entry_pressure or short_entry_overlap)
strategy.entry("Sell Short", strategy.short, qty=qty)
strategy.exit("TP Short", "Sell Short", limit=take_profit_level_short)