MFRider Documentation - The-OmniLabs/gunbot-mfride GitHub Wiki

MFRider Strategy GUNBOT Documentation

Overview

MFRider is an advanced momentum-based trading strategy for Gunbot that combines trend-following principles with dynamic Dollar-Cost Averaging (DCA). It's designed to "ride the market wave with precision" by optimizing capital allocation, managing risk dynamically, and executing trades based on multiple technical indicators.

Strategy Type: Spot Trading
Market: Spot Markets
License Compatibility: All Gunbot licenses
Documentation: GitHub Wiki


Strategy Configuration Parameters

1. Pair Configuration

Parameter Type Default Range/Options Performance Impact
PAIR_NAME String "USDT-BTC" Any valid trading pair Critical - Determines which asset to trade. Pair selection affects volatility exposure and trading opportunities.

2. Core Trading Configuration

Parameter Type Default Range/Options Performance Impact
TRADE_MODE Select "auto" auto, normal, safe High - Controls overall strategy aggressiveness. "auto" optimizes based on market conditions, "safe" reduces risk exposure.
MF_TRADING_LIMIT String "5" Min exchange limit+ Critical - Base order size. Higher values = larger positions but fewer trades with same capital.
MIN_VOLUME_TO_SELL String "1" 0.1+ Medium - Minimum sell threshold. Too low may create dust trades, too high may miss small profit opportunities.
MF_CAPITAL String "500" 100+ Critical - Total strategy budget. Directly affects maximum position size and DCA depth. Recommended: 200x Trading Limit.
MF_COMPOUND_RATIO Range 0 0-1 (0.1 steps) High - Profit reinvestment rate. 1 = reinvest all profits, 0 = no compounding. Higher values accelerate growth but increase risk.
MF_COMPOUND_CAPITAL_SINCE String "648687600000" Epoch timestamp (ms) Medium - Start date for compound calculations. Affects profit calculation baseline.
MF_COMPOUND_TL Boolean false true/false Medium - Whether to compound trading limit with profits. Increases position sizes over time.
PERIOD Select "5" 1, 5, 15, 30, 60, 240 High - Primary timeframe. Lower = more reactive/frequent trades, Higher = smoother but slower signals.
PERIOD_MEDIUM Select "240" 1, 5, 15, 30, 60, 240 High - Medium-term trend filter. Should be higher than PERIOD for trend confirmation.
PERIOD_LONG Select "1440" 60, 240, 360, 720, 1440 High - Long-term trend direction. Higher values provide stronger trend confirmation but slower adaptation.

3. Profit & Loss Management

Parameter Type Default Range/Options Performance Impact
AUTO_GAIN Boolean true true/false Critical - Dynamic profit targeting based on market conditions vs fixed GAIN%. Auto typically outperforms in volatile markets.
MIN_AUTO_PROFIT Range 0.3 0.1-10 (0.1 steps) High - Minimum profit threshold for auto-gain. Lower = more frequent but smaller profits, Higher = fewer but larger profits.
MIN_AUTO_PARTIAL_PROFIT Range 0.3 0.1-10 (0.1 steps) High - Minimum for partial profit taking. Allows early profit extraction while maintaining position.
PROFIT_QUOTIENT Range 2 1-10 (0.1 steps) High - Multiplier for auto-gain targets. Higher values = more aggressive profit targets but may miss opportunities.
PARTIAL_PROFIT_QUOTIENT Range 2 1-10 (0.1 steps) High - Multiplier for partial profit targets. Balances between early profit taking and position holding.
GAIN Range "2" 1-10 (0.1 steps) High - Fixed profit target when AUTO_GAIN disabled. Lower = frequent small profits, Higher = infrequent large profits.
ENABLE_TRAILING Boolean true true/false High - Trailing stop-loss activation. Maximizes profits in trending markets but may trigger early in choppy conditions.
TRAILING_SPREAD Range "1" 1-10 (0.1 steps) High - Distance % for trailing stops. Too tight = early exits, Too wide = large drawdowns.
RIDE_PROFIT_WAVE Boolean true true/false High - Continues holding after profit targets hit until reversal. Maximizes trending profits but risks giving back gains.
ENABLE_STOP_LOSS Boolean false true/false High - Hard stop-loss activation. Limits maximum losses but may exit before recoveries.
STOP_LOSS_PERCENTAGE Range 2 0.1-20 (0.1 steps) Critical - Loss threshold for stop-loss trigger. Lower = tighter risk control but more frequent stops.
STOP_LOSS_THRESHOLD Range 50 1-100 (1 step) High - Capital usage % before stop-loss activation. Lower = earlier risk management, Higher = more tolerance.

4. Trade Execution & Automation

Parameter Type Default Range/Options Performance Impact
BUY_ENABLED Boolean true true/false Critical - Master buy switch. Disable to only manage existing positions.
SELL_ENABLED Boolean true true/false Critical - Master sell switch. Disable to hold positions indefinitely.
STOP_AFTER_SELL Boolean false true/false Medium - Pauses strategy after sell completion. Useful for manual intervention or cooldown periods.
FIRST_TRADE_MULTIPLIER Boolean false true/false Medium - Dynamic initial position sizing based on market conditions. Can improve entry efficiency.
ENABLE_DCA_MULTIPLIER Boolean false true/false High - Enables dynamic DCA sizing. Increases DCA effectiveness but adds complexity.
MAX_DCA_MULTIPLIER Range 3 1-10 (0.1 steps) High - Maximum DCA size multiplier. Higher = faster averaging but larger capital usage.
DCA_QUOTIENT Range 3 1-20 (1 step) High - Number of allowed consecutive buys per price region. Higher = more aggressive averaging.
TRADE_SUPPORT Range 0 0-1 (0.25 steps) Medium - Portion of orders placed at support levels. Can improve entry prices but may miss momentum.
BATTLEGROUND_DCA_QUOTIENT Range 5 1-20 (1 step) High - DCA frequency below key levels. Higher values increase recovery potential but use more capital.
ENFORCE_DCA_MIN_STEP Boolean false true/false Medium - Minimum spacing between DCA orders. Prevents over-concentration at similar prices.
ENFORCE_DCA_MIN_STEP_QUOTIENT Range 3 1-20 (0.1 steps) Medium - Size of minimum DCA step. Higher = more spacing, fewer but larger DCAs.
DCA_MODE Select "decline" decline Medium - DCA trigger method. Currently only "decline" mode available.
SMOOTH_FACTOR Range 3 1-10 (0.1 steps) Medium - Smoothing for DCA calculations. Higher = smoother but less responsive DCA timing.

5. Technical Indicators & Momentum

Parameter Type Default Range/Options Performance Impact
OVERSOLD_TYPE Select "mfi" mfi, rsi High - Primary oversold indicator. MFI includes volume, RSI is price-only. MFI often more reliable in trending markets.
RSI_BUY_LEVEL Range "30" 1-100 (1 step) High - RSI oversold threshold. Lower = stricter entry conditions, Higher = more frequent entries.
RSI_SELL_LEVEL Range "70" 1-100 (1 step) High - RSI overbought threshold. Lower = earlier profit taking, Higher = extended profit riding.
MFI_BUY_LEVEL Range "30" 1-100 (1 step) High - MFI oversold threshold. Similar to RSI but considers volume. Often more accurate for entry timing.
MFI_SELL_LEVEL Range "70" 1-100 (1 step) High - MFI overbought threshold. Volume-weighted overbought signal for exit timing.
ADX_THRESHOLD Range "25" 1-100 (1 step) High - Minimum trend strength requirement. Higher = only strong trends, Lower = more flexible trend detection.
STOCHRSI_BUY_LEVEL Range "0.2" 0-1 (0.1 steps) Medium - StochRSI oversold level. More sensitive than regular RSI, good for short-term timing.
STOCHRSI_SELL_LEVEL Range "0.7" 0-1 (0.1 steps) Medium - StochRSI overbought level. Early warning for potential reversals.
OVERSOLD_BULLISH_BUY_LEVEL Range "50" 1-100 (1 step) Medium - Relaxed buy level during bullish conditions. Allows entries in stronger uptrends.
STOCHRSI_BULLISH_LEVEL Range "0.5" 0-1 (0.1 steps) Medium - StochRSI buy level in bullish momentum. Higher threshold for momentum trading.

6. Advanced Strategy Behaviors

Parameter Type Default Range/Options Performance Impact
BASE_DCA_PERCENT Range 0.5 0.05-5 (0.05 steps) High - Minimum price drop % before DCA triggers. Lower = more frequent DCA, Higher = larger drops required.
SR (Soft Reduction) Range 50 1-100 (1 step) High - Target position size as % of capital. Lower = more conservative, Higher = more aggressive position sizing.
MS (Momentum Sell) Range 100 1-100 (1 step) High - Capital usage % threshold for momentum selling. Lower = earlier profit protection, Higher = more profit riding.
SCALPING_RATIO Range 100 0-100 (1 step) Medium - % of capital available for upper-region buying. Lower = more conservative scalping approach.
SCALPING_SELL_AMOUNT Range 0.25 0.1-1 (0.1 steps) Medium - Portion of lower-region profitable positions to sell. Higher = more aggressive profit taking.
SCALPING_UPPER_SELL_AMOUNT Range 0.75 0.1-1 (0.1 steps) Medium - Portion of upper-region profitable positions to sell. Higher = quicker profit realization.
TRADING_DURATION String "168" Hours (numeric) Medium - Maximum trade holding time before forced exit. Lower = more active management, Higher = more patience.
PARTIAL_SELL_TYPE Select "auto" trail, decline, limit, auto High - Method for partial sell execution. "auto" adapts to conditions, others use fixed methods.
MAGIC_COOLDOWN Boolean false true/false Medium - Dynamic trading frequency adjustment. Reduces overtrading in certain market conditions.
STRICT_ENTRY Boolean false true/false High - Enforces stricter entry criteria. Fewer but higher-quality trades. Reduces frequency, may improve win rate.
STRICT_DCA Boolean false true/false High - Stricter DCA execution conditions. More conservative averaging approach, better risk management.
IGNORE_TRADES_BEFORE String "0" Epoch timestamp (ms) Low - Excludes historical trades from calculations. Useful for strategy resets or testing.

Strategy Usage Scenarios

Scenario 1: Conservative Long-Term Growth/Accumulation

Target: Steady growth with minimal risk in established markets (BTC, ETH)

Key Settings:

  • MF_CAPITAL: 1000
  • MF_TRADING_LIMIT: 10
  • GAIN: 10%
  • AUTO_GAIN: false
  • STRICT_ENTRY: true
  • STRICT_DCA: true
  • SR: 70
  • BASE_DCA_PERCENT: 1.0
  • TRADE_MODE: safe
  • SELL_ENABLED: false

Expected Performance: Lower frequency trades, higher win rate, steady compound growth

Conservative Setup Example

Scenario 2: Aggressive Scalping

Target: High-frequency trading for quick profits in volatile altcoins

Key Settings:

  • MF_CAPITAL: 500
  • MF_TRADING_LIMIT: 5
  • PERIOD: 1
  • AUTO_GAIN: true
  • MIN_AUTO_PROFIT: 0.5
  • PARTIAL_SELL_TYPE: 'trail or limit'
  • ENABLE_TRAILING: true
  • TRAILING_SPREAD: 0.5
  • SCALPING_RATIO: 100
  • MS: 50
  • TRADE_MODE: auto

Expected Performance: High trade frequency, smaller individual profits, faster capital turnover

Aggressive Scalping Example

Scenario 3: DCA-Heavy Bear Market Strategy

Target: Accumulation during downtrends with strong recovery potential

Key Settings:

  • MF_CAPITAL: 50000
  • MF_TRADING_LIMIT: 50
  • DCA_QUOTIENT: 10
  • BATTLEGROUND_DCA_QUOTIENT: 15
  • ENABLE_DCA_MULTIPLIER: true
  • MAX_DCA_MULTIPLIER: 5
  • SR: 70
  • TRADE_MODE: auto
  • BASE_DCA_PERCENT: 0.3

Expected Performance: Heavy position building during dips, strong recovery profits

DCA Bear Market Example

Scenario 4: Balanced Momentum Trading

Target: Balanced approach for trending markets with moderate volatility

Key Settings:

  • MF_CAPITAL: 1000
  • MF_TRADING_LIMIT: 10
  • AUTO_GAIN: true
  • PROFIT_QUOTIENT: 2.5
  • RIDE_PROFIT_WAVE: true
  • ADX_THRESHOLD: 30
  • OVERSOLD_TYPE: "mfi"
  • MFI_BUY_LEVEL: 25

Expected Performance: Balanced trade frequency, good trend following, moderate risk

Balanced Momentum Example


Examples

Normal Strategy Initialization

            "USDT-ETH": {
                "strategy": "mfrider",
                "enabled": true,
                "override": {
                    "MF_TRADING_LIMIT": "50",
                    "BUY_METHOD": "custom",
                    "SELL_METHOD": "custom",
                    "MIN_VOLUME_TO_SELL": "1",
                    "MF_CAPITAL": "10000",
                    "PERIOD": "5",
                    "PERIOD_MEDIUM": "240",
                    "PERIOD_LONG": "1440",
                    "AUTO_GAIN": true,
                    "AUTO_PROFIT_QUOTIENT": 2,
                    "PARTIAL_AUTO_PROFIT_QUOTIENT": 2,
                    "GAIN": "2",
                    "ENABLE_TRAILING": true,
                    "TRAILING_SPREAD": "2",
                    "BUY_ENABLED": true,
                    "SELL_ENABLED": true,
                    "STOP_AFTER_SELL": false,
                    "FIRST_TRADE_MULTIPLIER": false,
                    "ENABLE_DCA_MULTIPLIER": true,
                    "MAX_DCA_MULTIPLIER": 3,
                    "ENFORCE_DCA_MIN_STEP": false,
                    "ENFORCE_DCA_MIN_STEP_QUOTIENT": 3,
                    "STRICT_DCA": false,
                    "DCA_QUOTIENT": 5,
                    "DCA_MODE": "decline",
                    "SMOOTH_FACTOR": 3,
                    "OVERSOLD_TYPE": "mfi",
                    "RSI_BUY_LEVEL": "30",
                    "RSI_SELL_LEVEL": "70",
                    "MFI_BUY_LEVEL": "30",
                    "MFI_SELL_LEVEL": "70",
                    "ADX_THRESHOLD": "25",
                    "STOCHRSI_BUY_LEVEL": "0.2",
                    "STOCHRSI_SELL_LEVEL": "0.8",
                    "MS": 100,
                    "TRADING_DURATION": "168",
                    "PARTIAL_SELL_TYPE": "auto",
                    "MAGIC_COOLDOWN": false,
                    "ENABLE_LOGGING": false,
                    "TRADE_MODE": "auto",
                    "TRADE_SUPPORT": "1"
                }
            }

Safe Configuration

            "USDT-BTC": {
                "strategy": "mfrider",
                "enabled": true,
                "override": {
                    "MF_TRADING_LIMIT": "50",
                    "BUY_METHOD": "custom",
                    "SELL_METHOD": "custom",
                    "MIN_VOLUME_TO_SELL": "1",
                    "MF_CAPITAL": "10000",
                    "PERIOD": "15",
                    "PERIOD_MEDIUM": "240",
                    "PERIOD_LONG": "1440",
                    "AUTO_GAIN": true,
                    "AUTO_PROFIT_QUOTIENT": 2,
                    "PARTIAL_AUTO_PROFIT_QUOTIENT": 2,
                    "GAIN": "2",
                    "ENABLE_TRAILING": true,
                    "TRAILING_SPREAD": "2",
                    "BUY_ENABLED": true,
                    "SELL_ENABLED": true,
                    "STOP_AFTER_SELL": false,
                    "FIRST_TRADE_MULTIPLIER": false,
                    "ENABLE_DCA_MULTIPLIER": true,
                    "MAX_DCA_MULTIPLIER": 3,
                    "ENFORCE_DCA_MIN_STEP": true,
                    "ENFORCE_DCA_MIN_STEP_QUOTIENT": 2,
                    "STRICT_DCA": true,
                     "DCA_QUOTIENT": 3,
                    "DCA_MODE": "decline",
                    "SMOOTH_FACTOR": 3,
                    "OVERSOLD_TYPE": "mfi",
                    "RSI_BUY_LEVEL": "30",
                    "RSI_SELL_LEVEL": "70",
                    "MFI_BUY_LEVEL": "30",
                    "MFI_SELL_LEVEL": "70",
                    "ADX_THRESHOLD": "25",
                    "STOCHRSI_BUY_LEVEL": "0.2",
                    "STOCHRSI_SELL_LEVEL": "0.8",
                    "MS": 100,
                    "TRADING_DURATION": "168",
                    "PARTIAL_SELL_TYPE": "auto",
                    "MAGIC_COOLDOWN": false,
                    "TRADE_MODE": "safe",
                    "TRADE_SUPPORT": "0"
                }
            }

Performance Optimization Tips

Capital Allocation

  1. MF_CAPITAL should be 50-100x MF_TRADING_LIMIT for optimal DCA depth
  2. Higher capital allows more DCA levels but requires more careful monitoring
  3. Consider compound ratio based on portfolio size - smaller accounts benefit from higher compounding

Timeframe Selection

  1. PERIOD < PERIOD_MEDIUM < PERIOD_LONG for proper trend hierarchy
  2. Lower timeframes increase trade frequency but also noise sensitivity
  3. Higher timeframes provide stronger signals but slower reaction times

Risk Management

  1. Enable stop-loss in highly volatile or unknown markets
  2. Use STRICT_ENTRY in uncertain market conditions
  3. Enable MAGIC_COOLDOWN to slow down trades
  4. Adjust SR (Soft Reduction) based on risk tolerance

Market Adaptation

  1. Use AUTO_GAIN in trending markets for dynamic profit optimization
  2. Switch to fixed GAIN in ranging markets for consistent targets
  3. Adjust indicator levels based on asset volatility

Troubleshooting Common Issues

Low Trading Frequency

  • Reduce STRICT_ENTRY and STRICT_DCA restrictions
  • Lower indicator buy levels (RSI_BUY_LEVEL, MFI_BUY_LEVEL)
  • reduce PERIOD for more responsive signals

Excessive Capital Usage

  • increase period to filter out more noise
  • Reduce DCA_QUOTIENT and BATTLEGROUND_DCA_QUOTIENT
  • Lower SR (Soft Reduction) percentage
  • Enable ENFORCE_DCA_MIN_STEP for better spacing
  • Enable MAGIC_COOLDOWN to slow down trades

Poor Profit Realization

  • Enable AUTO_GAIN if using fixed targets
  • Reduce TRAILING_SPREAD for tighter profit protection
  • Increase SCALPING_SELL_AMOUNT for more aggressive profit taking

Community & Support

🚀 Join the MFANYA STRATEGY Community:

Demo

🚀 Checkout the Demo:

⚠️ **GitHub.com Fallback** ⚠️