EA-14307 · Session Trading

sentiment_ea

This EA trades based on market sentiment by comparing the ratio of buy vs sell orders and volumes from the order book. It opens positions when one side significantly dominates the other in both trader count and volume, and closes when the sentiment ratio reverses or weakens. Trading is restricted to a specific weekday and intraday time window.

Open the interactive view (equity curve, symbol switch)

Key facts

RiskMedium
Rating★★☆☆☆
TypeTrading EA
TimeframesM5, M15, M30, H1
IndicatorsOrder Book Depth, Session Time
AuthorMetaQuotes Software Corp.

Backtest results (H1, about 1 year)

Not backtested yet — this EA could not be converted automatically.

Strategy analysis

The strategy concept is based on detecting buy-sell order imbalance from market depth data to gauge market sentiment direction, classifying it as an order flow/sentiment analysis strategy. Entry conditions require both the trader count ratio and volume ratio between buy and sell sides to exceed configured thresholds simultaneously, with at least one side meeting minimum trader count (MinTraders) and minimum volume (MinVolume) requirements, all within a defined trading session (Mon-Fri 10:15:30 to 23:35:30). After opening a position, the thresholds switch to lower maintenance levels (MinDiffVolumesEx and MinDiffTradersEx), implementing a hysteresis mechanism to avoid frequent open-close cycles. Exit conditions trigger when the sentiment ratio for the held position falls below the maintenance threshold, or when outside the trading session, at which point the position is closed and thresholds reset to entry levels. Position sizing is fixed lot-based (Lots parameter) with no scaling logic. Money management relies solely on fixed-pip stop loss and take profit (SlPips and TpPips) with no dynamic adjustment or proportional risk control.

Strengths

  • Uses real order book depth data for sentiment rather than lagging technical indicators
  • Hysteresis mechanism (separate entry vs maintenance thresholds) reduces overtrading and transaction costs
  • Trading session filter effectively avoids low-liquidity periods and weekends

Weaknesses

  • Using Sleep() in OnTick blocks the main thread, potentially freezing the terminal or missing market events
  • No proper position check logic; pos variable is int but assigned true/false, causing type inconsistency and potential logic errors
  • SL/TP calculated with gTickSize instead of point, which may be inaccurate on non-standard instruments
  • No new bar check mechanism, potentially triggering signals repeatedly on the same bar
  • Position tracking relies on tradeResult flag instead of actual position state; state is lost on EA restart

Possible improvements

  • Replace Sleep() with EventSetTimer/OnTimer to avoid blocking the main thread and maintain EA responsiveness
  • Add real position query (PositionSelect) instead of pos flag variable to ensure correct state recovery after restart
  • Add new bar check and spread filter to prevent repeated entries under unfavorable conditions

Risk assessment

Overall risk: Medium

  • Sleep() blocking the main thread may prevent timely stop-loss execution, creating delay risk
  • EA restart loses tradeResult and pos state, potentially causing duplicate entries or failure to close positions
  • Fixed lot sizing with no dynamic risk control may lead to excessive losses during extreme market moves
  • Buy-sell ratio signals may produce false signals when market depth data is anomalous

Evaluation scores

Code quality2.0
Strategy logic3.0
Risk management2.0
Robustness2.0
Innovation3.0
Documentation1.0
Overall2.2

Parameters

ParameterDefaultDescription
MinVolume20000Minimum order volume threshold
MinTraders1000Minimum trader count threshold
DiffVolumesEx2.0Buy/sell volume ratio threshold for entry
DiffTradersEx1.5Buy/sell trader ratio threshold for entry
MinDiffVolumesEx1.5Volume ratio maintenance threshold while in position
MinDiffTradersEx1.3Trader ratio maintenance threshold while in position
Sleep5Sleep interval between ticks (minutes)
Lots1Trade lot size
TpPips500Take profit points
SlPips500Stop loss points
FillingORDER_FILLING_RETURNOrder filling type

Similar Session Trading EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.