Strategy logic: the EA searches for a classic Inside Bar pattern consisting of a Main Bar and a Signal Bar.
The Signal Bar must be completely inside the range of the Main Bar. If the Main Bar closes bullish, a Buy Stop order is placed above the Main Bar high. If the Main Bar closes bearish, a Sell Stop order is placed below the Main Bar low.
Stop Loss is calculated as a fraction of the Main Bar range.
Take Profit is calculated using a predefined Risk/Reward ratio.
An optional ATR filter can be applied to require the Main Bar to be significantly larger than recent market volatility.
This EA was built as a research tool for testing the statistical behavior of the Inside Bar pattern across different markets and timeframes.
ATR Filter
Example:
ATR = 100 points
Min Main Bar Size (x ATR) = 1.5
The Main Bar range must be at least 150 points for the setup to be considered valid.
Inside Bar Filter
Example:
Main Bar range = 100 points
Max Inside Bar Size (% of Main) = 50
The Signal Bar range must not exceed 50 points.
Position Settings
Example:
Main Bar range = 100 points
StopLoss (x Main Bar Range) = 0.62
The Stop Loss will be placed 62 points away from the entry price.
Example:
Stop Loss = 50 points
TakeProfit (Risk/Reward) = 2.5
The Take Profit will be placed 125 points away from the entry price.
Order Management
Risk Calculation
When using % Risk from Start Balance, position size is calculated from the account balance captured when the EA starts, not from the current account balance.
This behavior is intentional and was designed to make strategy testing more consistent. Risk remains constant throughout the test and does not change as the balance grows or declines.
If you prefer the traditional approach based on current balance or equity, the position sizing logic can be modified in the CalcLot() function.
The strategy was tested on EURUSD, XAUUSD and SP500 across the H1 and M15 timeframes.
The purpose of this Expert Advisor is research rather than optimization. The source code is published to allow independent verification, modification and testing of the hypothesis on other markets and datasets.
EURUSD M15 back test
Full research report, equity curves and test results: /en/blogs/post/771362
Source code is open — feel free to modify it, test it on other instruments and build upon it.
This EA was created to test a trading hypothesis, not to trade real money without additional research and validation.
Geometric signal validation for indicator signals
A state engine to provide geometric signal validation for indicator signals
Multi Forex Scanner MT5
Instead of having to analyze each pair individually, you can see at a glance what are the most promising pairs according to your own criteria.
ADX Trend Pullback EA
This Expert Advisor combines an ADX-based trend strength filter with an EMA pullback entry technique, using ATR for dynamic stop loss and take profit sizing. It is designed for trading a single symbol with one position open at a time.
Long-Term Trend TRIX Oscillator
A long-term momentum and trend oscillator based on dual TRIX and LWMA filtering.