Reexcel Bot – Comprehensive User Guide
Welcome to the Reexcel Bot, an advanced tool for automating cryptocurrency trading strategies on Binance. This guide provides a thorough walkthrough of setting up, configuring, operating, and troubleshooting the bot.
1. Introduction & Overview
The Reexcel Bot is a Python application designed to execute complex trading strategies on the Binance exchange. It combines technical analysis across multiple timeframes (Higher Time Frame – HTF, and Trading Time Frame – TTF) to identify potential entry points and employs a suite of risk management features to protect your capital.
Core Features & Capabilities:
- Multi-Timeframe Strategy Engine: Define distinct conditions for confirming trends (HTF) and identifying entry signals (TTF). The bot only considers a buy if all enabled HTF conditions AND all enabled TTF conditions are met for a symbol.
- Extensive Technical Indicators: Configure strategies using EMA, MACD, RSI, Stochastic RSI, Standard Stochastic, ATR, LRC (Linear Regression Channel), MA (Moving Average), and Bullish Confirmation Candles.
- Advanced Risk Management:
- Position Sizing: Choose between investing a fixed USDT amount or a percentage of your available balance per trade.
- Fixed Exits: Set Take Profit (TP) and Stop Loss (SL) percentages for automatic market sells.
- Dynamic Profit Protection: Implement a Profit Drawdown (PDD) strategy with up to three tiers (e.g., secure 50% of profit if 2% is reached, then 70% if 2.5% is reached, finally 100% if 3.5% is reached).
- Capital Preservation: Use Drawdown from Peak sell (sell if position P&L drops below a set percentage from its highest point) and Age-Based Selling (automatically close positions held longer than a specified time).
- Exposure Control: Limit the maximum number of simultaneous open trades.
- Intuitive Web Interface: Monitor your bot’s status, configure all settings, view detailed trade history, analyze performance, and control the bot’s operation through a responsive web dashboard.
- Paper Trading Mode: Test your strategies with virtual funds and configurable simulated trading fees before risking real capital.
- Comprehensive Trade History & Analytics: Access detailed logs of all trades (paper and live), including entry/exit prices, timestamps, fees, and P&L. Filter, sort, and search your history. Analyze performance with key metrics (Total P&L, Win Rate, Profit Factor, Max Drawdown) and interactive charts (Cumulative P&L, P&L per Trade, Sell Reasons). Export data or generate detailed PDF reports.
- Real-time Monitoring & Alerts: Get live updates on your portfolio and open positions via the dashboard (using WebSockets). Receive customizable alerts via Telegram and Email for trades, errors, and periodic performance summaries. Optional audible alerts (sounds) for key events.
- Scanner Filters: Narrow down potential trades using filters for volume, price change, new listings, stablecoins, and even indicator value ranges (RSI, Stochastic RSI).
2. Getting Started
Prerequisites:
- Operating System: Windows, macOS, or Linux.
- Python: Python 3.10 or newer installed and accessible from your command line/terminal. You can check by running
python --versionorpython3 --version. - Internet Connection: Stable connection for downloading dependencies and interacting with Binance.
Installation Steps:
- Obtain the Bot Files: Download the bot package (likely a
.zipfile) and extract it to a directory of your choice (e.g.,~/binance-trading-botorC:\Users\YourName\binance-trading-bot). This directory will be referred to as the “bot directory”. - Run the Automated Setup Script (
setup.py):- Open your terminal (Linux/macOS) or Command Prompt/PowerShell (Windows).
- Navigate to the bot directory using the
cdcommand. For example:cd ~/binance-trading-bot - Execute the setup script by running:
python setup.py - What the Script Does:
- Creates a Virtual Environment: It creates an isolated Python environment named
venvwithin the bot directory. This prevents conflicts with other Python projects on your system. - Installs Dependencies: It automatically installs all the required Python libraries listed in
requirements.txtinto thevenv. This includespython-binance,pandas,pandas-ta,Flask, and others. - Patches Dependencies: It applies a necessary fix to the
pandas_talibrary to ensure compatibility and prevent import errors (ImportError: cannot import name 'NaN' from 'numpy'). - Creates Web UI User: It runs
create_user.py, prompting you to enter a username and password. These credentials will be used to log into the bot’s web interface.
- Creates a Virtual Environment: It creates an isolated Python environment named
- During Setup: The terminal will display progress messages. It may take several minutes depending on your internet speed. You might see warnings (like the
pygamedeprecation warning, which is harmless) but watch for errors. A successful setup ends with a message indicating completion.
- Completion: Once
setup.pyfinishes without errors, your environment is ready. Thevenvdirectory contains the isolated Python environment with all necessary packages.
First Run:
- Choose Your Launcher Script:
- Linux/macOS: Double-click the
run_in_terminal.shscript. This will open a terminal window, activate the virtual environment, and start the bot. Alternatively, you can run./run_in_terminal.shdirectly in your terminal from the bot directory. - Windows: Double-click the
run.batscript. This will open a Command Prompt window, activate the virtual environment, and start the bot. - Generic (Linux/macOS): Run
./run.shin your terminal from the bot directory. This script also activates the environment and starts the bot.
- Linux/macOS: Double-click the
- Bot Startup Process: The launcher script activates the
venvand runsapp/main.py. You will see initialization messages in the terminal window:- License check (if applicable).
- Loading configuration from
config.json. - Initializing the Strategy Engine (listing HTF/TTF intervals, active conditions).
- Initializing Paper Trader or Live Trader.
- Starting the Web Server (usually on
http://127.0.0.1:5000). - Starting the Scanner loop.
- Access the Web Interface: Open your web browser (Chrome, Firefox, Edge, Safari) and navigate to
http://127.0.0.1:5000. You should see the bot’s login page. - Login: Enter the username and password you created during the
setup.pyprocess.
3. Web Interface Guide
The web interface is the central hub for managing your bot.
Login (login.html)
- A simple form requiring the username and password set up by
create_user.py. Security is handled byFlask-Login.
Dashboard (index.html)
The main dashboard provides a real-time overview of the bot’s status and your portfolio.
- Bot Status Panel: Shows whether the bot is “Running”, “Paused”, or in “Sell-Only Mode”. Also displays the currently loaded configuration name.
- Portfolio Summary: Displays your current USDT balance, total portfolio value (balance + value of open positions), unrealized P&L (total value change of open positions), and the value of currently held positions.
- Active Parameters Panel: This crucial panel summarizes the currently active scanner filters, HTF conditions, and TTF conditions based on your
config.json. It shows the specific parameter values (e.g., “EMA (9/26): Fast EMA Rising, Price > Fast EMA”). This helps you instantly verify if your strategy is configured as intended. - Open Trades Table: Lists all currently held positions. Columns typically include Symbol, Quantity, Buy Price, Current Price, P&L (USDT and %), Duration Held, and Target Sell Prices (calculated TP, SL, PDD levels). You can manually trigger a sell for any position using the “Sell” button.
- System Health Metrics: Monitors the bot’s resource usage (CPU %, RAM %, Disk Space %) to ensure it’s running smoothly.
- Real-time Updates: The dashboard updates automatically via WebSockets, reflecting changes in portfolio value, open trade P&L, and bot status without needing a page refresh.
Configuration (config.html)
This is the heart of strategy definition. The page is organized into collapsible sections for easier navigation.
- Scanner Settings (
config.jsonsectionscanner):- Volume Filter:
use_volume_filter(Checkbox): Enable/disable.volume_filter_timeframe(Dropdown: 15m, 1h, 4h, 12h, 24h): Timeframe to measure volume.min_volume_usdt(Number): Minimum volume threshold (in USDT) for the selected timeframe.
- Price Change Filter:
use_price_change_filter(Checkbox): Enable/disable.price_change_filter_timeframe(Dropdown: 15m, 1h, 4h, 12h, 24h): Timeframe to measure price change.min_price_change_pct(Number): Minimum percentage price increase for the selected timeframe.
- New Listing Filter:
use_new_listings_filter(Checkbox): Enable/disable.min_listing_age_months(Number): Exclude symbols listed within this many months.
- Stablecoin Exclusion:
exclude_stablecoins(Checkbox): Exclude major stablecoins (USDT, BUSD, USDC, DAI, TUSD, USDP, USDD, EURT, LUSD, GUSD, FRAX, USTC, ALUSD, MIM, VAI, DOLA, XAI, EURS, USDK, USDN, UST, SUSD, USDQ, ZUSD, HUSD, RSV, AUSD, USDJ, IDRT, BIDR, USDR, TRYB, EURA).
- Indicator Filters (RSI/StochRSI Ranges):
use_rsi9_filter,rsi9_min_value,rsi9_max_value: Filter symbols where RSI(9) is within a specific range.use_stoch_rsi_filter,stoch_rsi_k_min_value,stoch_rsi_k_max_value,stoch_rsi_d_min_value,stoch_rsi_d_max_value: Filter symbols where Stochastic RSI %K and %D are within specific ranges.filter_timeframe_matches_ttf(Checkbox): If enabled, the RSI/StochRSI filters use the TTF interval; otherwise, they use a default (likely 15m).
- Volume Filter:
- HTF Conditions (
config.jsonsectionstrategy.htf_conditions):- HTF Interval (
htf_interval): Select the Higher Time Frame for trend analysis (e.g., 1h, 4h, 1d). - HTF EMA Strategy:
use_htf_ema_strategy(Checkbox): Enable/disable.htf_ema_params.fast_ema_length,htf_ema_params.slow_ema_length(Numbers): EMA periods.- Triggers (Checkboxes):
htf_ema_trigger_fast_rising,htf_ema_trigger_slow_rising,htf_ema_trigger_price_above_fast,htf_ema_trigger_price_above_slow,htf_ema_trigger_fast_above_slow,htf_ema_trigger_fast_cross_slow_bullish.
- HTF MACD Strategy:
use_htf_macd_strategy(Checkbox): Enable/disable.htf_macd_params.fast_period,htf_macd_params.slow_period,htf_macd_params.signal_period(Numbers): MACD periods.- Triggers (Checkboxes):
htf_macd_trigger_line_above_signal_and_rising,htf_macd_trigger_line_cross_signal_bullish,htf_macd_trigger_histogram_positive_and_rising.
- HTF LRC Strategy:
use_htf_LRC(Checkbox): Enable/disable.htf_LRC_params.length,htf_LRC_params.ema_fast,htf_LRC_params.ema_slow(Numbers): LRC length and EMA periods.- Triggers (Checkboxes):
htf_LRC_trigger_rising,htf_LRC_trigger_price_above_LRC,htf_LRC_trigger_EMA_cross_above_LRC.
- HTF RSI Rising from Bottom:
use_htf_rsi14_rising_from_bottom(Checkbox): Enable/disable.htf_rsi14_rising_oversold_level(Number): RSI level considered “oversold” (e.g., 30).htf_rsi14_rising_confirmation_candles(Number): Number of candles the RSI must be rising after being below the oversold level.
- HTF StochRSI %K Rising from Bottom:
use_htf_stoch_rsi_k_rising_from_bottom(Checkbox): Enable/disable.htf_stoch_rsi_k_params_rising.k_period,htf_stoch_rsi_k_params_rising.d_period,htf_stoch_rsi_k_params_rising.smooth_k,htf_stoch_rsi_k_params_rising.oversold_level,htf_stoch_rsi_k_params_rising.confirmation_candles(Numbers): Parameters for detecting the StochRSI %K rising from oversold.
- HTF Volume Spike Buy:
use_htf_volume_spike_buy(Checkbox): Enable/disable.htf_volume_spike_buy_sma_period(Number): Period for the Simple Moving Average (SMA) used as the baseline.htf_volume_spike_min_pct_increase(Number): Minimum percentage increase over the SMA for a spike (e.g., 100.0 for 100% increase).
- HTF Interval (
- TTF Conditions (
config.jsonsectionstrategy.ttf_conditions):- TTF Interval (
ttf_interval): Select the Trading Time Frame for entry signals (e.g., 5m, 15m, 1h). - Bullish Confirmation Candle:
use_bullish_confirmation_candle(Checkbox): Wait for a bullish confirmation candle before considering a TTF buy signal.
- TTF RSI Strategies:
use_rsi9_oversold_reversal,rsi9_oversold_level,rsi9_reversal_confirmation_candles.use_rsi14_oversold_reversal,rsi14_oversold_level,rsi14_reversal_confirmation_candles.
- TTF StochRSI Strategy:
use_stoch_rsi_oversold_reversal,stoch_rsi_k_period,stoch_rsi_d_period,stoch_rsi_smooth_k,stoch_rsi_oversold_level,stoch_rsi_reversal_confirmation_candles.
- TTF ATR Rising:
use_atr_rising,atr_period,atr_confirmation_candles.
- TTF EMA Strategy:
use_ttf_ema_strategy(Checkbox): Enable/disable.ttf_ema_params.primary_short_length,ttf_ema_params.primary_long_length,ttf_ema_params.custom_short_length,ttf_ema_params.custom_long_length(Numbers): EMA periods.- Triggers (Checkboxes):
ttf_ema_trigger_primary_short_rising,ttf_ema_trigger_primary_short_cross_long_bullish,ttf_ema_trigger_custom_short_cross_long_bullish,ttf_ema_trigger_price_above_all_configured_emas.
- TTF MACD Strategy:
use_ttf_macd_strategy(Checkbox): Enable/disable.ttf_macd_params.fast_period,ttf_macd_params.slow_period,ttf_macd_params.signal_period(Numbers): MACD periods.- Triggers (Checkboxes):
ttf_macd_trigger_line_cross_signal_bullish,ttf_macd_trigger_histogram_positive_and_rising,ttf_macd_trigger_signal_rising_bullish.
- TTF LRC Strategy:
use_ttf_LRC(Checkbox): Enable/disable.ttf_LRC_params.length,ttf_LRC_params.ema_fast,ttf_LRC_params.ema_slow(Numbers): LRC length and EMA periods.- Triggers (Checkboxes):
ttf_LRC_trigger_rising,ttf_LRC_trigger_price_above_LRC,ttf_LRC_trigger_EMA_cross_above_LRC.
- TTF MA/EMA Cross Strategy:
use_ttf_ma_ema_cross_strategy(Checkbox): Enable/disable.ttf_ma_ema_cross_params.ma_length,ttf_ma_ema_cross_params.ema_length(Numbers): MA and EMA periods.- Triggers (Checkboxes):
ttf_ma_ema_trigger_ma_rising,ttf_ma_ema_trigger_ema_rising,ttf_ma_ema_trigger_ma_above_ema,ttf_ma_ema_trigger_ma_cross_ema_bullish.
- TTF Volume Spike Buy:
use_ttf_volume_spike_buy(Checkbox): Enable/disable.ttf_volume_spike_buy_sma_period(Number): Period for the SMA baseline.ttf_volume_spike_min_pct_increase(Number): Minimum percentage increase for a spike.
- TTF RSI Rising from Bottom:
use_ttf_rsi14_rising_from_bottom(Checkbox): Enable/disable.ttf_rsi14_rising_oversold_level(Number): Oversold level.ttf_rsi14_rising_confirmation_candles(Number): Confirmation candles.
- TTF StochRSI %K Rising from Bottom:
use_ttf_stoch_rsi_k_rising_from_bottom(Checkbox): Enable/disable.ttf_stoch_rsi_k_params_rising.k_period,ttf_stoch_rsi_k_params_rising.d_period,ttf_stoch_rsi_k_params_rising.smooth_k,ttf_stoch_rsi_k_params_rising.oversold_level,ttf_stoch_rsi_k_params_rising.confirmation_candles(Numbers).
- TTF EMA9 Above EMA26:
use_ema9_above_ema26_ttf(Checkbox): Simple EMA crossover condition.
- TTF Target Value Conditions (Advanced):
- Match current indicator values to specific targets with tolerance.
use_macd_target_values_ttf,ttf_macd_target_values_params(Line, Signal, Histogram targets).use_rsi_target_value_ttf,ttf_rsi_target_value_params(RSI target).use_stoch_target_values_ttf,ttf_stoch_target_values_params(Stoch %K, %D targets).use_atr_target_value_ttf,ttf_atr_target_value_params(ATR target).
- TTF Interval (
- Risk Management Settings (
config.jsonsectionrisk):- Position Sizing:
use_fixed_investment_per_trade(Checkbox): If checked, use fixed USDT amount.fixed_investment_per_trade_usdt(Number): Fixed amount in USDT.use_percentage_of_capital_per_trade(Checkbox): If checked, use percentage.percentage_of_capital_per_trade(Number): Percentage of available balance.min_investment_usdt(Number): Minimum USDT amount to invest per trade, regardless of percentage setting.
- Take Profit & Stop Loss:
use_take_profit,take_profit_percent(Number): Enable TP and set percentage gain.use_stop_loss,stop_loss_percent(Number): Enable SL and set percentage loss (use negative value, e.g., -1.0).
- Maximum Exposure:
max_open_trades(Number): Maximum number of simultaneous open positions (0 = unlimited).
- Profit Drawdown (PDD) Sell Strategy:
- Three tiers of PDD rules, each with a trigger percentage and a secure percentage.
use_pdd_tier_1,pdd_tier_1_trigger_percent,pdd_tier_1_secure_percent.use_pdd_tier_2,pdd_tier_2_trigger_percent,pdd_tier_2_secure_percent.use_pdd_tier_3,pdd_tier_3_trigger_percent,pdd_tier_3_secure_percent.
- Drawdown from Peak Sell:
use_drawdown_from_peak_sell(Checkbox): Enable/disable.drawdown_from_peak_sell_percent(Number): Sell if P&L drops below this percentage from its peak (use negative value, e.g., -1.0).
- Age-Based Selling:
enable_age_based_sell(Checkbox): Enable/disable.max_position_age_hours(Number): Maximum holding time in hours.age_based_sell_min_pnl_percent(Number): Minimum P&L percentage required before age-based sell can trigger (e.g., 0.1).
- Sell Condition Monitoring:
sell_monitor_interval_seconds(Number): How often (in seconds) the bot checks open positions for sell conditions (TP, SL, PDD, Drawdown, Age).- Individual enable/disable flags for specific sell conditions:
use_take_profit,use_stop_loss,use_drawdown_from_peak_sell,enable_age_based_sell,use_pdd_tier_1/2/3,use_stoch_rsi_k_reversal_sell,use_ema_based_sell.
- Specific Sell Condition Parameters:
stoch_rsi_k_reversal_sell_params: Parameters for selling based on StochRSI reversal.ema_sell_params: Parameters for selling based on EMA behavior.
- Position Sizing:
- Notification Settings (
config.jsonsectionnotifications):- Sounds:
sounds_enabled(Checkbox): Enable/disable all sounds.- Individual sound file assignments for events (
sound_on_start,sound_on_buy,sound_on_scan_complete,sound_on_sell,sound_on_error).
- Telegram Alerts:
enable_telegram_alerts(Checkbox): Enable/disable.telegram_token(Text): Your Telegram Bot Token.telegram_chat_id(Text): Your Telegram Chat ID.telegram_alert_types(Checkboxes): Select which events trigger alerts (start, buy, sell, error, summary).telegram_summary_interval_hours(Number): Frequency of performance summary messages.
- Email Alerts:
- Configuration fields for SMTP server settings (
email_smtp_server,email_smtp_port,email_use_tls,email_username,email_password,email_from,email_to). Enable/disable viaenable_email_alerts.
- Configuration fields for SMTP server settings (
- Sounds:
- Web Interface Settings (
config.jsonsectionweb):dashboard_update_interval_seconds(Number): How often the dashboard polls for updates if WebSockets fail.trade_history_page_size(Number): Number of trades displayed per page in the history table.
- Saving & Managing Configurations:
- Save Configuration: Click the “Save Configuration” button at the bottom. This writes the current settings to the
config.jsonfile. - Save As: Save the current configuration under a different name (stored in
data/configs/). - Load Configuration: Load a previously saved named configuration.
- Reset to Default: Revert all settings to the initial values defined in the code.
- Important: After saving configuration changes, you must restart the bot for the new settings to take effect (via the Control panel).
- Save Configuration: Click the “Save Configuration” button at the bottom. This writes the current settings to the
Controls (control.html)
Manage the bot’s operational state and critical settings.
- API Keys (
config.jsonsectionapi_keys):- Live Trading API Key & Secret: Enter your Binance API credentials here. These are required for live trading. Ensure the API key has permissions for “Read” and “Spot & Margin Trade”. Security: These keys are stored locally in the
config.jsonfile. Keep the file secure. - Paper Trading API Key & Secret: Optional. Used for paper trading to fetch accurate balance and price data. If left blank, dummy data is used.
- Live Trading API Key & Secret: Enter your Binance API credentials here. These are required for live trading. Ensure the API key has permissions for “Read” and “Spot & Margin Trade”. Security: These keys are stored locally in the
- Trading Mode (
mode_preference.json):- Switch Between Modes: Use the dropdown to select “Paper Trading” or “Live Trading”. Click “Apply Mode” to save the preference. A bot restart is required for the change to take effect.
- Bot Activity Control:
- Pause/Resume Bot Activity: Click “Pause Bot Activity” to temporarily stop scanning and placing new buy orders. The bot process continues running, but trading activity halts. Click “Resume Bot Activity” to restart scanning/buying.
- Sell-Only Mode (
sell_only_preference.json): Click “Enable Sell-Only Mode” to prevent new buys while allowing existing positions to be managed (sells based on strategy/risk rules). Click “Disable Sell-Only Mode” to resume normal buying (subject to Pause state).
- Reset Trader State:
- Reset Paper Trader State: Clears the paper trading state file (
data/papertrader_state.json). This resets virtual balances and closes virtual positions. Use with caution. - Reset Live Trader State: Clears the live trading positions file (
data/livetrader_positions.json). This affects the bot’s internal tracking of live positions. Use with extreme caution, especially if you have open positions on Binance that the bot isn’t tracking.
- Reset Paper Trader State: Clears the paper trading state file (
- Restart Bot: Clicking this button will shut down the current bot process and initiate a restart. This is the recommended way to apply configuration changes or refresh the bot’s state.
Trade History (trade_history.html)
Review and analyze all closed trades.
- Filters & Search:
- Configuration Used: Filter trades executed under a specific saved configuration name.
- Symbol: Filter by trading pair (e.g., BTCUSDT).
- Trade Type: Show only Paper trades, Live trades, or both.
- Sell Reason: Filter by the reason the trade was closed (e.g., TP, SL, PDD, Manual Sell).
- Date Range: Filter trades closed within a specific date/time range.
- Inline Column Search: Type directly into the header row of any column (Symbol, P&L, Sell Reason, etc.) to filter the table contents in real-time. Use
>10in the P&L column to find trades with P&L > 10 USDT.
- Trade List Table:
- Displays closed trades with details: Symbol, Quantity, Buy/Sell Prices, Fees, Realized P&L (USDT and %), Sell Reason, Configuration Used, Duration Held, Entry Time, Exit Time.
- Expand Trade Row: Click the arrow icon at the start of a row to reveal detailed information.
- Expanded Trade Details:
- Entry Configuration Snapshot: Shows the exact HTF/TTF conditions and scanner filters that were active when the trade was opened. This is crucial for backtesting and strategy refinement.
- Trade Chart: An interactive chart (using Lightweight Charts) showing the price action for the traded symbol during the holding period, with markers for the buy and sell times.
- Performance Summary & Charts (Above Trade List):
- Metrics: Calculated based on the currently filtered trades. Includes Total Realized P&L, Win Rate, Number of Wins/Losses, Average P&L per Trade, Largest Win/Loss, Total Capital Invested, Profit Factor, Max Drawdown, Average Win/Loss Amounts, Ratio of Avg Win to Avg Loss.
- Charts:
- Cumulative P&L Over Time.
- P&L Per Trade.
- Distribution of Sell Reasons.
- Win/Loss Distribution by Entry Hour (GMT+1).
- Data Export:
- Export to CSV/XLSX: Exports the currently filtered trade list to a downloadable file.
- Import Binance Trade History:
- Allows you to import your historical Binance Spot trade history (via API keys) to merge with the bot’s internal trade history for a complete performance view.
- Generate PDF Report (
report_template.html):- Creates a downloadable PDF summarizing the filtered trade history, performance metrics, charts, and entry configurations.
4. Configuration Deep Dive
Understanding the nuances of each setting is key to crafting effective strategies.
Scanner Settings (config.json section scanner)
These filters reduce the number of symbols the bot analyzes, improving efficiency and focus.
- Volume Filter: Helps focus on liquid markets. A high
min_volume_usdton a24htimeframe ensures you’re looking at actively traded pairs. - Price Change Filter: Targets symbols showing momentum. A positive
min_price_change_pcton a1htimeframe finds pairs gaining strength recently. - New Listing Filter: Avoids very new coins which can be highly volatile or lack sufficient historical data for indicator calculations. Setting
min_listing_age_monthsto 3 or more is common. - Stablecoin Exclusion: Prevents the bot from trading stablecoins, focusing on volatile assets.
- Indicator Filters (RSI/StochRSI Ranges): Pre-filters symbols based on indicator values before applying complex HTF/TTF conditions. For example, setting
use_rsi9_filterwithrsi9_min_value: 20.0andrsi9_max_value: 40.0ensures the bot only considers symbols where RSI(9) is in a specific “oversold but not extremely oversold” range.
Strategy Settings (HTF & TTF Conditions – config.json sections strategy.htf_conditions & strategy.ttf_conditions)
Define the precise technical criteria for trend confirmation and entry signals.
- Setting Timeframes: Choose intervals that reflect your trading style. A common setup might be HTF = 4h (for trend) and TTF = 15m (for entry). Ensure the intervals are available on Binance.
- HTF Conditions (
strategy.htf_conditions): These act as filters or trend confirmations. The bot will only consider a symbol for a TTF buy if all enabled HTF conditions are currently met for that symbol on the HTF chart.- EMA Strategy: Useful for trend following. “Fast EMA Rising” and “Price > Fast EMA” confirm an uptrend. “Fast EMA > Slow EMA” confirms the short-term trend is stronger than the long-term trend.
- MACD Strategy: Looks for bullish momentum. “Histogram Positive & Rising” indicates increasing bullish momentum. “Line Cross > Signal” is a classic bullish crossover signal.
- LRC Strategy: LRC acts like a dynamic support/resistance line. “LRC Rising” suggests bullish momentum. “Price > LRC” means price is above the dynamic support. “EMA Cross > LRC” combines EMA crossovers with the LRC level.
- RSI/StochRSI Rising: Looks for these oscillators coming out of oversold territory, indicating potential reversal or continuation of an uptrend. The
confirmation_candlessetting adds robustness by requiring the indicator to rise for a specified number of consecutive candles. - Volume Spike Buy: Identifies sudden surges in trading activity on the HTF, which can precede significant price moves.
- TTF Conditions (
strategy.ttf_conditions): These define the precise entry signal on the shorter timeframe. All enabled TTF conditions must be met simultaneously for a symbol on the TTF chart at the same time that the HTF conditions are met.- Bullish Confirmation Candle: Adds a price action filter, waiting for a specific bullish candlestick pattern on the TTF before entering.
- RSI/StochRSI Oversold Reversal: Looks for these oscillators bouncing from oversold levels on the TTF as an entry trigger.
- ATR Rising: Indicates increasing volatility on the TTF, which might precede a breakout.
- EMA/MACD/LRC/MA-EMA Strategies: Similar logic to HTF, but applied on the TTF for the precise entry moment.
- Volume Spike Buy: Identifies surges in activity specifically on the TTF chart at the moment of potential entry.
- Target Value Conditions: Allows entry when indicators reach specific, user-defined values (e.g., “Enter when MACD Histogram is between 0.0001 and 0.0005”). This requires careful backtesting to define effective target ranges.
- How HTF & TTF Work Together: The bot sequentially checks conditions:
- It scans symbols passing the Scanner Filters.
- For each symbol, it checks if all enabled HTF conditions are TRUE on the HTF chart.
- If HTF conditions are met, it then checks if all enabled TTF conditions are TRUE on the TTF chart for the same symbol at the same moment.
- Only if both HTF and TTF checks pass is a buy order potentially placed.
Risk Management Settings (config.json section risk)
Essential for protecting capital and defining exit strategies.
- Position Sizing:
- Fixed USDT: Invests the same dollar amount in each trade, regardless of account size.
- Percentage: Invests a percentage of your current available balance, meaning position sizes grow/shrink with your account.
- Minimum Investment: Ensures a minimum amount is traded even if the percentage calculation yields a lower value. This is important for Binance’s minimum order sizes.
- Take Profit (TP) & Stop Loss (SL):
- TP: Automatically sells a position when it reaches a specified gain percentage. Simple and effective for locking in profits.
- SL: Automatically sells a position when it reaches a specified loss percentage. Crucial for limiting downside risk.
- Max Open Trades: Prevents over-exposure by limiting the number of simultaneous positions.
- Profit Drawdown (PDD) Sell Strategy: A sophisticated trailing stop mechanism. Instead of a fixed trailing stop, it allows you to define tiers. For example, if a position gains 2%, you might secure 50% of the profit. If it gains 2.5%, you secure 70%, and so on. This allows profits to run while protecting gains at key milestones.
- Drawdown from Peak Sell: Sells a position if its value drops significantly from its highest point since purchase. For example,
drawdown_from_peak_sell_percent: -2.0would sell if the P&L dropped from +5% to +3% (a 2% drop from the peak). This helps exit trades that are reversing against you. - Age-Based Selling: Forces the closure of positions held longer than a set time, preventing indefinite holding of underperforming assets. The
age_based_sell_min_pnl_percentensures it doesn’t trigger immediately on slightly negative or zero P&L trades. - Sell Condition Monitoring: The
sell_monitor_interval_secondsdetermines how frequently the bot re-evaluates open positions for exit conditions. A shorter interval (e.g., 5 seconds) is more responsive but uses slightly more resources. The individual flags (use_take_profit, etc.) allow you to enable/disable specific exit rules.
Notification Settings (config.json section notifications)
Stay informed about bot activity.
- Sounds: Provide immediate, local feedback for key events. Useful if you’re monitoring the machine running the bot.
- Telegram Alerts: Offer remote monitoring. You can receive instant notifications on your phone or desktop Telegram app. The
telegram_summary_interval_hoursallows you to get periodic performance updates without being overwhelmed by individual trade alerts. - Email Alerts: Another remote notification method. Requires configuring SMTP settings for your email provider.
5. Monitoring & Management
- Dashboard Monitoring: Your primary real-time view. Regularly check the bot status, portfolio value, active parameters, open positions, and system health.
- Managing Open Positions: The “Open Trades” table on the dashboard lets you see all active positions. You can manually trigger a sell for any position at any time by clicking the “Sell” button next to it. This overrides any strategy or risk management rules for that specific position.
- Trade History Analysis: Use the Trade History page extensively. Filter by date, symbol, or sell reason to analyze performance. Expand trade rows to see the exact entry configuration. Use the performance charts and metrics to understand which parts of your strategy are working or failing. Export data for deeper analysis in spreadsheets.
- Performance Review: Regularly generate PDF reports to get a comprehensive summary of your trading performance over specific periods.
6. Troubleshooting & FAQ
Common Issues & Solutions:
- Bot Not Placing Trades:
- Check Active Parameters: Go to the Dashboard. Is the “Active Parameters” panel showing the conditions you expect to be active? If not, your
config.jsonmight not be set correctly, or you haven’t restarted the bot after saving changes. - Scanner Filters: Are your scanner filters too restrictive? Try loosening them temporarily to see if the bot finds any symbols to analyze.
- Bot State: Is the bot paused? Check the Bot Status panel on the Dashboard. Is it in Sell-Only Mode? Check the Controls page or the Sell-Only indicator on the Dashboard.
- Trading Mode: Is it set to the mode you intend (Paper vs Live)? Check the Controls page.
- Log Files: Check
logs/bot.logandlogs/scanner.logfor error messages or warnings that might indicate why no trades are being placed (e.g., API key issues, network problems, indicator calculation errors). - Market Conditions: Are the market conditions simply not meeting your strict strategy criteria? This is normal.
- Check Active Parameters: Go to the Dashboard. Is the “Active Parameters” panel showing the conditions you expect to be active? If not, your
- Configuration Not Applying:
- Save: Did you click “Save Configuration” on the Config page? Changes are only written to
config.jsonwhen you save. - Restart: Did you restart the bot via the Control panel after saving? This is a crucial step. The bot reads
config.jsonprimarily at startup.
- Save: Did you click “Save Configuration” on the Config page? Changes are only written to
- Login Issues:
- Credentials: Are you using the exact username and password created during
setup.py? It’s case-sensitive. - Browser Cache: Try refreshing the page or clearing your browser cache/cookies for
127.0.0.1.
- Credentials: Are you using the exact username and password created during
- API Key Problems:
- Correctness: Double-check the API Key and Secret entered in the Control panel. Copy-paste to avoid typos.
- Permissions: Verify on the Binance website that the API key has “Read” and “Spot & Margin Trade” permissions enabled.
- IP Whitelist: If you restricted the API key to specific IP addresses on Binance, ensure the machine running the bot is allowed.
- Paper Trading Keys: Remember, Paper Trading API keys are optional for fetching data but not strictly required for simulated trades.
- Setup Script (
setup.py) Errors:- Python: Ensure Python 3.10+ is installed and accessible via
pythonorpython3in your terminal/command prompt. - Internet: A stable internet connection is required for downloading packages.
- Permissions: Ensure you have permission to create directories and files in the bot directory.
- Firewall/Antivirus: Sometimes, security software can interfere with package downloads. Temporarily disabling it might help diagnose the issue (remember to re-enable it).
- Terminal Output: Carefully read the error messages printed in the terminal during
setup.pyexecution. They often point directly to the problem (e.g., “Permission denied”, “No module named pip”).
- Python: Ensure Python 3.10+ is installed and accessible via
- Web Interface Not Loading (
http://127.0.0.1:5000):- Bot Running: Ensure the bot application is actually running (check the terminal window where you started it; it shouldn’t have exited with an error).
- Correct URL: Make sure you are using
http://127.0.0.1:5000(orhttp://localhost:5000). Note thehttp://prefix. - Port Conflict: Is another application using port 5000? The bot logs should indicate the port it’s trying to use.
- Firewall: Check if your system’s firewall is blocking incoming connections to port 5000 (less common for localhost).
- “pygame” Deprecation Warning:
- Harmless: As noted in
changelog.md, this warning (SC_Accel: dead key support droppedor similar related topygameandSDL) is purely informational and does not affect the bot’s core functionality. It’s related to the sound library and can be ignored.
- Harmless: As noted in
- Slow Performance / High Resource Usage:
- System Resources: Check the System Health section on the Dashboard and your OS’s task manager/activity monitor. Is CPU or RAM usage consistently high?
- Scanner Filters: Too many symbols being analyzed can slow things down. Tighten your scanner filters (e.g., increase volume threshold, enable stablecoin exclusion).
- Timeframes: Very short TTF intervals (like 1m) or very long HTF intervals (like 1w) might require more data fetching/calculations.
- Log File Size: Very large log files (
logs/*.log) can sometimes slow down the application. Consider periodically archiving or deleting old log entries if they are no longer needed for debugging.
- Missing Trade History:
- Files: Ensure the bot has read/write permissions for the
data/directory. The trade history is stored in files likedata/papertrader_state.jsonanddata/livetrader_positions.json. If these files are corrupted or inaccessible, history might not load correctly. - Mode: Ensure you are looking at the correct trade history (Paper vs Live) based on the mode the bot was in when the trades occurred.
- Files: Ensure the bot has read/write permissions for the
- Telegram Alerts Not Working:
- Configuration: Double-check
telegram_tokenandtelegram_chat_idin the config. Ensureenable_telegram_alertsis checked. - Bot Setup: Did you correctly set up your Telegram bot and obtain the token/chat ID? Test sending a message via the Telegram API manually using tools like
curlto verify the token/chat ID work. - Network: Ensure the machine running the bot can make outbound HTTPS requests to Telegram’s servers.
- Configuration: Double-check
- Email Alerts Not Working:
- SMTP Settings: Verify all SMTP configuration fields (
email_smtp_server,port,username,password, etc.) are correct for your email provider. Many providers require “App Passwords” instead of your main account password. - Network/Firewall: Ensure outbound connections to the SMTP server/port are allowed.
- Enable: Check that
enable_email_alertsis checked in the config.
- SMTP Settings: Verify all SMTP configuration fields (
- Strategy Engine Logs Indicate Conditions Not Met:
- Review Config: The logs in
logs/bot.log(INFO level for strategy engine) show which conditions are checked and whether they pass. Compare this output with your expectations based on the “Active Parameters” on the dashboard and the current market data for the symbol. There might be a mismatch in how you think the condition should work versus how it’s implemented.
- Review Config: The logs in
- Indicator Calculation Errors (e.g., NaN issues):
- Data Issues: Sometimes, insufficient or poor-quality data (especially for new or illiquid coins) can cause indicators like
pandas_tafunctions to produceNaN(Not a Number) values, leading to conditions failing. The bot usually handlesNaNgracefully, but persistent issues might indicate a problem with data fetching or a specific symbol.
- Data Issues: Sometimes, insufficient or poor-quality data (especially for new or illiquid coins) can cause indicators like
By carefully following this detailed guide and utilizing the logs and web interface for monitoring, you should be able to successfully set up, configure, operate, and troubleshoot your Reexcel Bot. Remember to start with paper trading to test your strategies thoroughly before moving to live trading.
