ATR Trade Assistant
- Experts
- Version: 1.0
- Activations: 10
Dynamic Volatility-Based Trade Management for MetaTrader 5
ATR Trade Assistant is a dynamic trade-management Expert Advisor for MetaTrader 5, designed to manage a trade from the moment of entry through to its final exit.
Whether you prefer to enter trades manually using the custom BUY and SELL buttons directly on your trading chart, or use the included Sample Strategy for automated entries, ATR Trade Assistant provides a complete volatility-based framework for position sizing, initial Stop Loss, Take Profit, trailing-stop management, and partial profit taking.
The core philosophy is simple:
Let market volatility determine how the trade should be managed.
Instead of relying exclusively on fixed distances, the EA uses ATR-based calculations throughout its trade-management engine. This allows protective levels, position sizing and trailing behaviour to adapt to changing market conditions.
KEY FEATURESManual Trading From the Chart
ATR Trade Assistant includes dedicated on-chart BUY and SELL buttons, allowing traders to initiate positions directly from the trading canvas.
Once a trade is opened, the EA can automatically take over the management process according to the selected settings.
Depending on your configuration, the EA can manage:
-
Initial Stop Loss
-
Initial Take Profit
-
Position sizing
-
ATR-based trailing stops
-
Progressive trailing-stop reduction
-
Partial Take Profit
-
Volatility-based position adjustments
-
Automated Sample Strategy entries
This makes the EA suitable for traders who want to control their own entries while automating the repetitive aspects of trade management.
FULL ATR-BASED TRADE MANAGEMENTATR Trade Assistant is built around the Average True Range (ATR) as a core volatility measurement.
Initial protective levels can be calculated from the current ATR rather than using a fixed number of points or pips.
For example:
If Gold has a current ATR value of $3.00:
-
Stop Loss Multiplier = 2.0
-
Initial Stop Loss distance = $6.00
With:
-
Take Profit Multiplier = 4.0
-
Initial Take Profit distance = $12.00
This creates a 1:2 initial risk-to-reward relationship based on the selected ATR multipliers.
The same volatility-aware philosophy continues into the trailing and position-sizing engines.
DYNAMIC POSITION SIZINGATR Trade Assistant provides multiple lot-sizing methods so traders can choose how position volume is calculated.
Available modes include:
LOT_FIXED
Uses a fixed transaction volume for every trade.
LOT_DYNAMIC_COMPLEMENT
A dynamic low-balance mode designed to adapt transaction volume according to available account balance and margin requirements.
LOT_DYNAMIC_VOLATILITY
The recommended volatility-based sizing mode.
This mode adjusts calculated position volume according to changes in market volatility. When volatility expands, the sizing model can increase the calculated exposure according to the configured expansion factor. When volatility contracts, the model can reduce calculated exposure according to the configured contraction factor.
LOT_DYNAMIC_RISK
Calculates the required position volume according to the configured percentage risk and Stop Loss distance.
This allows traders to establish a consistent risk model where position volume is determined by the relationship between account equity, risk percentage and Stop Loss distance.
THREE TRAILING-STOP MANAGEMENT MODESATR Trade Assistant includes three different trailing approaches.
1. STEP REDUCTION
A progressive ATR-based trailing system.
The trailing engine begins after the configured activation milestone is reached and progressively reduces the trailing multiplier as the trade moves further into profit.
This allows the trade to retain more breathing room during the early stages of the move while progressively tightening protection as additional profit milestones are achieved.
A configurable minimum multiplier prevents the trailing distance from being reduced below the defined floor.
2. STANDARD ATR TRAILING
A conventional ATR-based trailing mechanism.
Once the configured activation threshold has been reached, the Stop Loss follows the market using a volatility-based buffer.
This provides a straightforward way to keep the protective stop dynamically aligned with current market conditions.
3. AGGRESSIVE ATR TRAILING
Designed for traders who want the protective Stop Loss to begin following the market very quickly.
The aggressive mode activates immediately according to its configured logic and maintains an ATR-based buffer around the current market price.
This mode can be useful when capital protection is prioritised over allowing a larger pullback.
PROGRESSIVE STEP-REDUCTION ENGINEThe Step Reduction system gives traders control over how aggressively a winning trade is protected.
You can configure:
-
The profit level at which trailing begins
-
The initial ATR trailing multiplier
-
The amount the multiplier is reduced at each step
-
The ATR distance between profit steps
-
The minimum trailing multiplier allowed
For example, with:
-
Activation = 1.5 ATR
-
Start Multiplier = 1.4
-
Step Reduction = 0.2
-
Step Size = 1.5 ATR
-
Minimum Multiplier = 1.2
the EA can progressively tighten the trailing distance as the position reaches successive profit milestones while respecting the configured minimum trailing buffer.
AUTOMATED 50% PARTIAL TAKE PROFITATR Trade Assistant can automatically reduce an open position by 50% once the configured partial-profit milestone is reached.
The milestone is calculated as a percentage of the original Take Profit target.
For example:
If the Take Profit target is 4 ATR and the Partial Profit Factor is 0.5, the EA will target the halfway point of the original Take Profit distance for the partial close.
This allows traders to:
-
Secure a portion of the position's profit
-
Reduce remaining exposure
-
Continue allowing the remaining position to participate in a larger market move
-
Combine partial profit taking with the ATR trailing engine
The feature can be enabled or disabled independently.
INCLUDED SAMPLE STRATEGYATR Trade Assistant also includes a built-in Sample Strategy that can be used for:
-
Strategy Tester experimentation
-
Automated trading
-
Demonstrating the EA's trade-management capabilities
-
Testing the integrated internal indicator calculations
The Sample Strategy uses a combination of trend, momentum and money-flow conditions.
EMA Trend Structure
The strategy uses a faster EMA reference together with a longer-term trend filter.
The default 200 EMA acts as the primary directional filter:
-
Price above the 200 EMA → Buy setups permitted
-
Price below the 200 EMA → Sell setups permitted
This is intended to reduce trades taken against the prevailing directional structure.
Volume Momentum Delta
The internal VMD calculation provides an additional confirmation layer for volume and momentum behaviour.
Money Flow Index
The MFI component provides an additional money-flow confirmation condition before a setup is considered valid.
Adaptive Spread Protection
The Sample Strategy includes an automatic spread-management option.
When enabled, the EA can adapt the spread ceiling according to broker/server parameters and market characteristics.
A manual fallback spread limit is also available.
NO iCUSTOM DEPENDENCYThe Sample Strategy's required custom indicator calculations are embedded directly inside the EA.
The EA does not require separate external custom-indicator files to perform these calculations through iCustom() calls.
This simplifies deployment and helps keep the complete strategy calculation framework contained within the Expert Advisor.
MANUAL OR AUTOMATED OPERATIONATR Trade Assistant can be configured according to your preferred workflow.
Manual Mode
Disable the Sample Strategy and use the on-chart BUY/SELL buttons to initiate trades manually.
The EA then provides automated trade management according to your selected ATR settings.
Automated Mode
Enable the Sample Strategy and allow the integrated strategy engine to identify and execute trades according to its internal conditions.
The same trade-management framework can then manage those positions.
Hybrid Workflow
The EA can also be used as a trade-management assistant while the trader retains control over manual entries, with automated strategy functionality available when required.
DESIGNED FOR FLEXIBLE MARKET CONDITIONSBecause the core trade-management calculations are volatility-aware, the EA is designed to avoid relying exclusively on static distances.
The ATR framework can adapt to changes in the market's current trading range, making the management parameters more responsive than a purely fixed-point approach.
The EA can therefore be configured for different trading styles, instruments and volatility environments by adjusting the available parameters.
IMPORTANT RISK NOTICEATR Trade Assistant is a trading tool and does not guarantee profits.
Financial markets involve substantial risk, and automated or semi-automated trading can result in losses. Position sizing and risk parameters should be selected carefully and tested under the conditions of your chosen broker, symbol and account.
Always perform your own testing and optimisation before using the EA with real funds.
Past performance and Strategy Tester results do not guarantee future results.
INPUT PARAMETER MANUALINITIAL TRADE SETTINGS
Stop Loss ATR Multiplier ( InpStopLossAtrMult )
Default: 2.0
Sets the distance of the initial protective Stop Loss using the current ATR value.
For example, if the current ATR on Gold is $3.00 and the multiplier is 2.0, the initial Stop Loss distance is calculated as $6.00 from the entry price.
Take Profit ATR Multiplier ( InpTakeProfitAtrMult )
Default: 4.0
Sets the initial Take Profit distance using the current ATR value.
For example, with an ATR of $3.00 and a multiplier of 4.0, the Take Profit distance is calculated as $12.00 from the entry price.
With the default Stop Loss and Take Profit multipliers, the initial target structure is 1:2 risk-to-reward.
RISK & LOT SIZING SETTINGSLot Sizing Method ( InpLotMethod )
Default: LOT_DYNAMIC_VOLATILITY
Selects the position-volume calculation method.
Available choices:
LOT_FIXED
Uses a fixed lot size for every trade.
LOT_DYNAMIC_COMPLEMENT
Dynamic low-balance sizing mode that adjusts exposure according to account balance and margin requirements.
LOT_DYNAMIC_VOLATILITY
Recommended volatility-based sizing method. Adjusts calculated position volume according to changes in market volatility.
LOT_DYNAMIC_RISK
Calculates position volume according to the configured account risk percentage and Stop Loss distance.
Fixed Lot Size ( InpLotSize )
Default: 0.01
Defines the fixed position volume when LOT_FIXED is selected.
It can also serve as the baseline starting lot size for configurations where a minimum/base volume is required.
Risk % Per Trade ( InpRiskPercent )
Default: 1.0
Defines the percentage of account equity used by the risk-based position-sizing model for an individual trade.
Volatility Expansion Factor ( InpVolUpMultiplier )
Default: 1.25
Used by LOT_DYNAMIC_VOLATILITY .
When the engine detects expanding ATR conditions, this factor adjusts the calculated risk/volume model according to the configured value.
Volatility Contraction Factor ( InpVolDownMultiplier )
Default: 0.75
Used by LOT_DYNAMIC_VOLATILITY .
When the engine detects contracting volatility, this factor reduces the calculated volume according to the configured value.
Volatility Sizing ATR Period ( InpVolATRPeriod )
Default: 14
Defines the ATR lookback period used by the volatility-sizing engine to evaluate changes in market volatility.
GLOBAL TRAILING CONTROLSTrailing Method ( InpTrailingMethod )
Default: TRAIL_STEP_REDUCTION
Selects the active trailing-stop algorithm.
Available choices:
TRAIL_STEP_REDUCTION
Progressively reduces the ATR trailing multiplier as the position reaches additional profit milestones.
TRAIL_STANDARD_ATR
Maintains an ATR-based trailing distance from the current market price.
TRAIL_AGGRESSIVE_ATR
Uses an aggressive trailing approach designed to begin protecting a position very quickly.
Enable Trailing Engine ( InpUseTrailing )
Default: true
Enables or disables the background trailing-stop management engine.
ATR Engine Lookback Period ( InpAtrRiskPeriod )
Default: 14
Defines the ATR lookback period used to calculate the volatility buffer for the Standard and Aggressive ATR trailing mechanisms.
STEP REDUCTION PARAMETERSActivation Milestone ( InpTrailingActivation )
Default: 1.5
Defines the minimum profit distance, measured in ATR multiples, required before the Step Reduction trailing engine activates.
Start Factor ( InpStartMultiplier )
Default: 1.4
Defines the initial ATR trailing multiplier used when Step Reduction first becomes active.
Step Factor ( InpTrailingStep )
Default: 0.2
Defines how much the trailing multiplier is reduced at each new profit step.
A larger value results in faster tightening of the trailing distance.
Profit Step Interval ( InpStepSizeATR )
Default: 1.5
Defines the additional profit distance, measured in ATR multiples, required before another trailing reduction step is triggered.
Max Cap / Minimum Multiplier Floor ( InpMaxCapMultiplier )
Default: 1.2
Defines the minimum trailing multiplier allowed by the Step Reduction engine.
This prevents the trailing distance from being reduced below the configured floor.
STANDARD & AGGRESSIVE TRAILING PARAMETERSStandard Mode Activation ATR Multiple ( InpTrailingStartMult )
Default: 1.5
Defines the profit distance, measured in ATR multiples, required before Standard ATR Trailing activates.
This parameter is not used for the immediate activation behaviour of Aggressive Mode.
Step Factor ATR Multiple ( InpTrailingStepMult )
Default: 1.5
Defines the ATR-based volatility buffer maintained between the current market price and the trailing Stop Loss for the applicable trailing modes.
SAMPLE STRATEGY SETTINGSEnable Sample Strategy Execution ( InpEnableSampleStrategy )
Default: true
Enables or disables the integrated automated Sample Strategy.
Disable this option when using ATR Trade Assistant exclusively as a manual trade-management assistant with the on-chart BUY/SELL buttons.
Internal EMA Reference Filter Period ( InpEmaPeriod )
Default: 20
Defines the faster EMA calculation used by the Sample Strategy as part of its signal-generation process.
Macro Trend Filter EMA ( InpEmaFilterPeriod )
Default: 200
Defines the primary trend-filter EMA.
By default:
-
Price above the EMA → Buy direction permitted
-
Price below the EMA → Sell direction permitted
This provides the Sample Strategy with a higher-timeframe-style directional filter based on the selected chart data.
VMD Smoothing Period ( InpVmdPeriod )
Default: 14
Defines the calculation period used by the internal Volume Momentum Distribution component.
This provides an additional volume/momentum confirmation layer within the Sample Strategy.
MFI Evaluation Period ( InpMfiPeriod )
Default: 14
Defines the calculation period used by the internal Money Flow Index component.
The MFI calculation provides an additional money-flow confirmation condition for the Sample Strategy.
Auto-Adjust Spread Ceiling ( InpAutoAdjustSpread )
Default: true
Enables adaptive spread-limit handling.
When enabled, the EA can automatically determine an appropriate spread ceiling based on available broker/server information and market characteristics.
This is particularly useful when working with instruments such as indices, cryptocurrencies and metals where spread behaviour can differ significantly from traditional FX pairs.
Fallback Max Allowed Spread ( InpMaxSpreadPips )
Default: 15
Defines the manual maximum spread limit used when automatic spread adjustment is disabled.
Sample Strategy Magic Number ( InpMagicNumber )
Default: 123456
Defines the Magic Number assigned to trades generated by the automated Sample Strategy.
This allows automated trades to be identified separately from manually initiated positions and other Expert Advisors operating on the same account.
PARTIAL TAKE PROFIT SETTINGSEnable 50% Partial Take Profit ( InpUsePartialTP )
Default: true
Enables or disables the automatic partial position-closing engine.
When enabled, the EA closes 50% of the eligible position volume when the configured partial-profit milestone is reached.
Milestone Target ( InpPartialProfitFactor )
Default: 0.5
Defines the point at which the partial close is triggered as a proportion of the original Take Profit distance.
For example, a value of 0.5 means the partial Take Profit milestone is reached when price has travelled 50% of the distance toward the original Take Profit target.
WHY ATR TRADE ASSISTANT?ATR Trade Assistant combines several important components into one integrated MetaTrader 5 Expert Advisor:
✓ Manual BUY/SELL chart controls
✓ Automated Sample Strategy
✓ ATR-based Stop Loss
✓ ATR-based Take Profit
✓ Multiple position-sizing methods
✓ Risk-based position sizing
✓ Dynamic volatility-based sizing
✓ Volatility expansion/contraction adjustments
✓ Three trailing-stop algorithms
✓ Progressive Step Reduction trailing
✓ Standard ATR trailing
✓ Aggressive ATR trailing
✓ Automatic 50% Partial Take Profit
✓ EMA trend filtering
✓ VMD confirmation
✓ MFI confirmation
✓ Adaptive spread management
✓ Configurable Magic Number
✓ Internally embedded indicator calculations
✓ No external iCustom() indicator dependency
ATR Trade Assistant is built to give the trader control over entries while providing a systematic, configurable and volatility-aware framework for managing the trade from entry to exit.
Test. Configure. Optimize. Trade with a defined management framework.
