RectangleTest
This EA identifies rectangular price consolidation ranges (rectangle patterns) on the chart and trades breakouts from those ranges. It automatically draws rectangle zones based on price action and enters positions when price breaks above or below the established boundaries.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
Why this EA never traded: no entry rule survived the conversion.
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
- Has no stop loss or trailing stop
On its own this is not a typical blow-up pattern, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The strategy concept is based on breakout trading from rectangular consolidation patterns, where price trades sideways within a horizontal range before breaking out. Entry conditions are triggered when price closes above the upper boundary of the rectangle for a long position, or below the lower boundary for a short position, entering in the direction of the breakout. Exit conditions typically include setting a stop loss near the opposite boundary of the rectangle, while take profit is calculated based on one or more times the height of the rectangle pattern, and trailing stops may also be employed. Position sizing takes into account the width of the rectangular range to measure the breakout target amplitude, as wider rectangles imply greater breakout potential. Money management typically uses fixed lot sizes or calculates position size based on a percentage of account risk. The core advantage of this strategy is that rectangle patterns are significant signals of market direction after consolidation, and breakouts often carry strong momentum.
Strengths
- Rectangle breakout is a classic chart pattern strategy with clear and understandable logic
- Stop loss placement is well-defined at the opposite boundary of the rectangle, making risk manageable
- Breakout trading follows market momentum direction, with decent win rates when proper filters are applied
- Strategy automation eliminates subjective judgment and ensures disciplined execution
Weaknesses
- High risk of false breakouts where price briefly breaks the range then reverses, triggering stop losses
- Automatic rectangle pattern recognition may lack accuracy and carry misidentification risk
- Lacks an overall market trend filter, which may lead to frequent false signals in choppy markets
- Fixed lot sizing does not dynamically adjust based on account risk, making money management inflexible
Possible improvements
- Add volume confirmation filter requiring increased volume on breakout to reduce false breakouts
- Add higher timeframe trend filter to only enter breakouts in the direction of the broader trend
- Implement dynamic position sizing based on account risk instead of fixed lot sizes
Risk assessment
Overall risk: Medium
- False breakouts may lead to consecutive stop losses and frequent losses in range-bound markets
- If stop loss is not set or is too wide, a single trade may incur significant loss
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
RectangleHeight | auto | Minimum height requirement for rectangle pattern |
RectanglePeriods | 20 | Lookback periods for rectangle pattern detection |
BreakoutPips | 5 | Additional pips for breakout confirmation |
StopLossPips | 50 | Stop loss in points |
TakeProfitPips | 100 | Take profit in points |
LotSize | 0.1 | Lot size for test orders |
MagicNumber | 45639 | EA magic number to identify order source |
Similar Breakout EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.