Mark_Strat Strategy In-Depth Analysis
Strategy Number: #462 (462nd of 465 strategies)
Strategy Type: Bollinger Bands Mean Reversion + Ultra-Short-Term Trailing Stop Strategy
Timeframe: 1 minute (1m)
I. Strategy Overview
Mark_Strat is an ultra-short-term strategy based on Bollinger Bands mean reversion, employing a 1-minute timeframe for high-frequency trading. The core logic is to enter when price falls below the Bollinger Bands lower band (oversold rebound), and exit when price returns to the Bollinger Bands middle band with RSI extremely overbought. The strategy is equipped with a loose initial stop loss and aggressive trailing stop mechanism, aiming to capture quick rebound movements.
Core Features
| Feature | Description |
|---|---|
| Buy Conditions | 1 combined buy signal (Bollinger Bands lower band breakout) |
| Sell Conditions | 1 combined sell signal (RSI extreme overbought + Bollinger Bands regression) |
| Protection Mechanism | Trailing stop (activates after +17.493% offset) |
| Timeframe | 1 minute (1m) |
| Dependencies | talib, qtpylib, numpy, pandas |
II. Strategy Configuration Analysis
2.1 Basic Risk Parameters
# ROI Exit Table (4-level take-profit)
minimal_roi = {
"0": 0.03653, # Immediate: 3.653%
"7": 0.01223, # 7 minutes later: 1.223%
"16": 0.00756, # 16 minutes later: 0.756%
"29": 0 # 29 minutes later: 0% (forced exit)
}
# Stop Loss Setting
stoploss = -0.23936 # -23.936%
# Trailing Stop
trailing_stop = True
trailing_only_offset_is_reached = True
trailing_stop_positive = 0.13595 # 13.595%
trailing_stop_positive_offset = 0.17493 # 17.493%
Design Philosophy:
- Initial stop loss -23.936%, exceptionally loose, providing ample volatility space
- Trailing stop activates after profit reaches 17.493%
- Trailing stop protects profits at 13.595% position
- 29-minute forced exit, typical ultra-short-term strategy
2.2 Order Type Configuration
order_types = {
'buy': 'limit', # Limit buy
'sell': 'limit', # Limit sell
'stoploss': 'market', # Market stop loss
'stoploss_on_exchange': False
}
order_time_in_force = {
'buy': 'gtc', # Good Till Cancel
'sell': 'gtc'
}
2.3 Strategy Behavior Configuration
process_only_new_candles = False # Process every tick
use_sell_signal = True # Use sell signals
sell_profit_only = True # Respond to sell signals only when profitable
ignore_roi_if_buy_signal = False # ROI takes priority
startup_candle_count = 20 # Requires 20 candles warm-up
III. Buy Conditions Detailed Analysis
3.1 Buy Signal Structure
The strategy employs a single combined buy signal:
# Buy Conditions
(
((dataframe['close'] < dataframe['bb_lowerband'])) & # Condition 1: Break below Bollinger Bands lower band
(dataframe['volume'] > 0) # Condition 2: Has trading volume
)
3.2 Buy Conditions Detailed Analysis
Condition #1: Bollinger Bands Lower Band Breakout
# Logic
- Close price < Bollinger Bands lower band
- Bollinger Bands parameters: 20 periods, 2 standard deviations
- Price breaking below lower band = oversold signal
Design Intent: Capture rebound opportunities after excessive price decline.
Condition #2: Volume Confirmation
# Logic
- Volume > 0
- Ensures market activity
Design Intent: Avoid entering when there is no liquidity.
3.3 Buy Signal Characteristics
| Characteristic | Description |
|---|---|
| Signal Type | Oversold rebound |
| Trigger Condition | Break below Bollinger Bands lower band |
| Filtering Mechanism | Volume confirmation |
IV. Sell Logic Detailed Analysis
4.1 Multi-Layer Exit Mechanism
The strategy employs a three-layer exit mechanism:
First Layer: ROI Take-Profit (Time Priority)
Profit Margin Range Holding Time Target Return
──────────────────────────────────────
Immediate Exit 0 minutes 3.653%
Short-term Holding 7 minutes 1.223%
Medium-term Holding 16 minutes 0.756%
Forced Exit 29 minutes 0%
Characteristics:
- Extremely short time window, 29-minute forced exit
- Target returns decrease with time
- Typical ultra-short-term/scalping strategy
Second Layer: Trailing Stop (Profit Protection)
# Trailing Stop Configuration
trailing_stop = True
trailing_stop_positive = 0.13595 # Stop loss position
trailing_stop_positive_offset = 0.17493 # Activation threshold
Mechanism Analysis:
- When profit reaches 17.493%, trailing stop activates
- Stop loss line triggers when profit retraces to 13.595%
- Protects approximately 4% profit buffer
Third Layer: Sell Signal (Active Exit)
# Sell Conditions
(
(dataframe['rsi'] > 90) & # Condition 1: RSI extreme overbought
((dataframe['close'] > dataframe['bb_middleband'])) & # Condition 2: Regression to middle band
(dataframe['volume'] > 0) # Condition 3: Has trading volume
)
4.2 Sell Signal Analysis
| Condition | Logic | Description |
|---|---|---|
| RSI > 90 | Extreme overbought | Momentum reaches extreme value |
| Price > Bollinger Bands Middle Band | Mean reversion complete | Price returns to normal range |
| Volume > 0 | Liquidity confirmation | Ensures counterparty exists |
Design Intent: Actively exit when rebound is in place and RSI is extremely overbought, locking in profits.
4.3 Exit Priority
Priority: Sell Signal > ROI Take-Profit > Trailing Stop > Initial Stop Loss
V. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicator | Usage |
|---|---|---|
| Trend Indicator | Bollinger Bands (BB) | Oversold identification, mean reversion |
| Momentum Indicator | RSI | Overbought identification |
| Momentum Indicator | Stochastic RSI | Auxiliary confirmation (calculated but not used) |
| Momentum Indicator | MACD | Auxiliary confirmation (calculated but not used) |
| Trend Indicator | SAR | Auxiliary confirmation (calculated but not used) |
5.2 Bollinger Bands Parameters
# Bollinger Bands Configuration
bollinger = qtpylib.bollinger_bands(
qtpylib.typical_price(dataframe),
window=20,
stds=2
)
dataframe['bb_lowerband'] = bollinger['lower'] # Lower band
dataframe['bb_middleband'] = bollinger['mid'] # Middle band
dataframe['bb_upperband'] = bollinger['upper'] # Upper band
5.3 Unused Indicators Explanation
The strategy calculates the following indicators but does not use them in trading logic:
- Stochastic RSI (fastk_rsi)
- MACD
- SAR (Parabolic Stop and Reverse)
These indicators are configured in plot_config for chart display but do not participate in trading decisions.
VI. Risk Management Features
6.1 Loose Initial Stop Loss
| Parameter | Value | Description |
|---|---|---|
| Initial Stop Loss | -23.936% | Extremely loose |
Design Philosophy:
- Provide sufficient volatility space for price
- Rely on trailing stop and sell signals to protect profits
- Avoid noise stop losses at 1-minute level
6.2 Trailing Stop Mechanism
Profit Development Stop Loss Behavior
─────────────────────────────────
0% ~ 17.49% Initial stop loss -23.936% active
Reach 17.49% Trailing stop activates
Profit retraces to 13.595% Trailing stop triggers exit
Characteristics:
- Trailing stop only activates when profit is sufficiently high
- Protects approximately 4% profit buffer
- Let profits run
6.3 Time Constraint
startup_candle_count = 20 # 20-minute warm-up period
minimal_roi["29"] = 0 # 29-minute forced exit
Design Intent:
- Quick entry and exit
- Avoid overnight risk
- Fast capital turnover
VII. Strategy Advantages and Limitations
✅ Advantages
- Simple Logic: Bollinger Bands breakout is a classic mean reversion strategy
- Trailing Stop: Let profits run while protecting gains
- Time Constraint: 29-minute forced exit, avoids long-term position holding
- Sell Only When Profitable: sell_profit_only = True prevents being washed out at a loss
⚠️ Limitations
- Initial Stop Loss Too Wide: -23.936% may lead to large losses
- 1-Minute Level: Sensitive to network and exchange latency
- Indicator Redundancy: Calculates multiple unused indicators (MACD, SAR, StochRSI)
- Scalping Risk: Ultra-short-term strategy transaction costs may erode profits
VIII. Applicable Scenario Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Sideways Market | ✅ Recommended | Mean reversion strategy's optimal scenario |
| High Volatility Market | ✅ Can use | Many Bollinger Bands breakout opportunities |
| Single-Sided Trend | ⚠️ Caution | Easy to get trapped catching falling knives against trend |
| Low Liquidity | ❌ Not Recommended | High slippage risk at 1-minute level |
IX. Applicable Market Environment Detailed Analysis
Mark_Strat is a typical mean reversion scalping strategy. Based on its code architecture, it is best suited for sideways volatile markets and carries significant risk in single-sided trend markets.
9.1 Strategy Core Logic
- Oversold Entry: Enter when price falls below Bollinger Bands lower band
- Mean Reversion: Wait for price to return to Bollinger Bands middle band
- Extreme Exit: Actively exit when RSI reaches 90
9.2 Performance in Different Market Environments
| Market Type | Performance Rating | Reason Analysis |
|---|---|---|
| 📊 Sideways Volatile | ⭐⭐⭐⭐⭐ | Mean reversion strategy's optimal scenario |
| 📈 Moderate Uptrend | ⭐⭐⭐⭐☆ | Has pullback opportunities, strategy can be profitable |
| 📉 Downtrend | ⭐⭐☆☆☆ | Easy to catch falling knives halfway down |
| 🚀 Strong Single-Sided | ⭐☆☆☆☆ | Counter-trend operation carries extreme risk |
9.3 Key Configuration Recommendations
| Configuration Item | Recommended Value | Description |
|---|---|---|
| Trading Pairs | Currencies with moderate volatility | Avoid extreme volatility |
| Timeframe | 1m (default) | Can try 3m or 5m |
| Initial Stop Loss | Can tighten to -15% | Reduce maximum loss risk |
X. Important Reminder: The Cost of Complexity
10.1 Learning Cost
Strategy logic is relatively simple, suitable for learning Bollinger Bands mean reversion strategies. Core concepts:
- Bollinger Bands upper/lower band identification
- RSI overbought/oversold
- Trailing stop mechanism
10.2 Hardware Requirements
| Number of Trading Pairs | Minimum Memory | Recommended Memory |
|---|---|---|
| 1-5 pairs | 2GB | 4GB |
| 5-20 pairs | 4GB | 8GB |
1-minute level requires higher system response.
10.3 Differences Between Backtesting and Live Trading
Due to employing 1-minute level, differences between backtesting and live trading may be significant:
- Slippage Cost: Scalping strategy slippage impact is significant
- Latency Risk: Price changes rapidly within 1 minute
- Transaction Fees: Commission costs from frequent trading
- Liquidity: Small orders have little impact, large orders may produce slippage
10.4 Manual Trader Recommendations
The core logic can be manually applied:
- Set up Bollinger Bands (20 periods, 2 standard deviations)
- Wait for price to break below lower band
- Set wide stop loss (-15% to -20%)
- Exit when price returns to middle band and RSI > 90
XI. Summary
Mark_Strat is a classic Bollinger Bands mean reversion scalping strategy. Its core value lies in:
- Simple Logic: Buy at Bollinger Bands lower band, sell at middle band
- Trailing Stop: Let profits run while protecting gains
- Time Constraint: 29-minute forced exit, suitable for ultra-short-term trading
For quantitative traders, this is a template suitable for learning Bollinger Bands strategies, but attention must be paid to:
- Risks of overly wide initial stop loss
- Execution challenges at 1-minute level
- Transaction costs eroding profits