LastPrice
This EA monitors the market depth (order book) and places limit orders based on the last traded price relative to the bid/ask spread. It scalps by entering BUY when the last price is above ask plus an interval threshold, and SELL when below bid minus the interval, then manages existing positions by attempting to close or reverse them when the price returns to favorable levels. Trading is restricted to specific intraday time windows and filtered by volume and spread conditions.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
Not backtested yet — this EA could not be converted automatically.
Strategy analysis
The strategy exploits short-term price dislocations by monitoring the order book depth and the deviation of the last traded price from the current bid/ask. Entry conditions: when no position exists, a BUY limit order is placed if the last price exceeds ask plus a configurable interval, and a SELL limit order if last price falls below bid minus the interval, provided volume is within [minVolume, maxVolume] and spread is within the Spread threshold. Exit conditions: when holding a position, a reverse limit order is placed to close it—BUY positions are closed with a SELL limit at bid when the price retreats, and vice versa for SELL positions. Position sizing uses a fixed lot size (Lots parameter) with no dynamic adjustment. Money management relies solely on a fixed stop loss (SlPips converted to price) and restricted trading time windows, with no trailing stop or dynamic take-profit mechanism. The EA also implements a frozen-order handling loop that deletes and potentially replaces limit orders when the market price drifts from the order price.
Strengths
- Leverages order book depth data for more precise market microstructure information, giving entry logic a solid foundation in actual market data
- Includes a frozen-order handling mechanism that automatically deletes and replaces limit orders when market price drifts, reducing slippage losses
- Implements multiple filters including trading session restrictions, volume filters, and spread filters to avoid trading in unsuitable market conditions
Weaknesses
- The while loop in position management that waits for order execution can block the EA thread, preventing other event handlers from running
- No independent take-profit logic exists; exits rely solely on reverse limit orders, making profit targets uncertain
- Fixed lot sizing without account-equity-proportional calculation leads to unbalanced risk exposure across different account sizes
- Order book data may be unavailable or delayed on some broker platforms, limiting the strategy's applicability
Possible improvements
- Replace the while loop with an event-driven approach using OnTrade or OnTradeTransaction callbacks to handle order state changes, preventing EA thread blocking
- Add independent take-profit logic and a trailing stop mechanism to define a clear risk-reward ratio for each trade
- Implement dynamic position sizing based on account equity percentage to align risk management with account size
Risk assessment
Overall risk: Caution
- The while loop waiting for order fills can block the EA for extended periods, preventing timely response during fast market moves
- The reverse position closing conditions are relatively loose, potentially causing frequent round-trip entries and exits at unfavorable prices leading to repeated losses
- Full dependency on order book data means the strategy completely fails if the data source is interrupted
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Interval | 400 | Bid/Ask price deviation threshold (points) |
minVolume | 1 | Minimum volume filter |
maxVolume | 900000 | Maximum volume filter |
Spread | 200 | Maximum allowed spread |
Lots | 1 | Trade lot size |
SlPips | 400 | Stop loss in pips |
Filling | ORDER_FILLING_RETURN | Order fill type |
Similar Scalping EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.