Capital Asset Pricing Model Trend EA
FREE
Published:
9 May 2026
Current version:
3.0
Didn't find a suitable robot?
Order your own one
on Freelance
Go to Freelance
Order your own one
on Freelance
How to buy а trading robot or an indicator
Run your EA on
virtual hosting
virtual hosting
Test аn indicator/trading robot before buying
Want to earn in the Market?
How to present a product for a sell-through
Version 3.0
2026.05.11
============================================================
1. PROP FIRM SAFETY / ACCOUNT PROTECTION PATCH
============================================================
Purpose
- Add prop-firm style risk controls around the EA without changing the core CAPM entry idea.
- Reduce the chance of breaching daily loss, maximum loss, lot-size, trade-count, and weekend-holding style rules.
- Keep these protections optional so the EA can still be used on normal broker/demo/live accounts.
Main inputs added / supported
- InpUsePropFirmGuard
- InpPropInitialBalance
- InpPropDailyLossPercent
- InpPropMaxLossPercent
- InpPropSafetyBufferPercent
- InpPropUseAccountWideEquity
- InpPropCloseOwnTradesNearBreach
- InpPropEmergencyBufferPercent
- InpPropStopAfterDailyProfit
- InpPropDailyProfitStopPercent
- InpPropMaxTradesPerDay
- InpPropMaxOpenPositions
- InpPropMaxTotalOpenLots
- InpPropMaxLotPerTrade
- InpPropBlockHighImpactNews
- InpPropCloseOwnBeforeNews
- InpPropNoWeekendHolding
- InpPropFridayFlatHour
- InpPropDailyResetHour
- InpPropUseConsistencyGuard
- InpPropProfitTargetPercent
- InpPropMaxBestDayPercentOfTarget
Functional changes
- Added daily prop-loss guard based on configured account/equity reference.
- Added maximum prop-loss guard to stop new trading when the account approaches the configured breach level.
- Added safety buffer logic so the EA can stop before the actual prop-firm limit is reached.
- Added emergency buffer logic for more urgent near-breach handling.
- Added optional close-own-trades behavior near breach conditions.
- Added optional account-wide equity mode versus own-EA/open-PnL scoped calculation.
- Added daily profit stop so the EA can stop trading after reaching a configured daily profit level.
- Added maximum trades per day control.
- Added maximum open positions control.
- Added maximum total open lots control.
- Added maximum lot per trade cap.
- Added no-weekend-holding protection with configurable Friday flat hour.
- Added prop daily reset-hour handling.
- Added optional consistency guard inputs to help avoid one unusually large day dominating a challenge target.
Safety behavior
- Prop-firm guard does not increase risk.
- Prop-firm guard does not override broker stop/freeze protections.
- Prop-firm guard does not remove normal EA daily loss, floating drawdown, margin, spread, or trade-mode checks.
- Prop-firm guard is optional and should be configured according to the specific prop-firm rule set.
============================================================
2. PROFIT PROTECTION / TRADE HEALTH PATCH
============================================================
Purpose
- Improve the EA's ability to protect floating profit before a winner turns into a larger loser.
- Reduce the pattern of small floating gains disappearing and later becoming full stop-loss trades.
- Add smarter exit behavior while keeping the original entry strategy intact.
Main inputs added / supported
- InpUseProfitGivebackGuard
- InpProfitGuardMinBars
- InpProfitGuardActivateR
- InpProfitGuardActivateMoney
- InpProfitGuardGivebackPercent
- InpProfitGuardMinLockR
- InpProfitGuardMinLockMoney
- InpProfitGuardCloseOnGiveback
- InpProfitGuardTightenSL
- InpUseTradeHealthExit
- InpHealthMinBarsOpen
- InpHealthAdverseR
- InpHealthMinFavorableR
- InpHealthScoreDropPoints
- InpHealthRequiredFailures
- InpHealthUseSignalDeterioration
- InpHealthUseCAPMFlip
- InpHealthUseShockExit
- InpUseTPConfidenceLayer
- InpTPExtendRequiresDirection
- InpTPExtendRequiresCAPM
- InpTPConfidenceBlockOnShock
- InpTPExtendScoreTolerancePoints
- InpTPTightenOnWeakness
- InpTPWeaknessTightenMinR
- InpTPWeaknessTrailDistanceATR
Functional changes
- Added profit-giveback guard.
- Tracks when an open trade has achieved meaningful floating profit.
- If the trade gives back too much of that profit, the EA can close the trade or tighten the stop.
- Added minimum profit-lock logic.
- Allows the EA to protect at least a small amount of profit once the trade has moved sufficiently in favor.
- Added trade-health exit logic.
- Evaluates whether an open trade is deteriorating after being open for a minimum number of bars.
- Can react to adverse movement after prior favorable movement.
- Can consider signal deterioration, CAPM direction flip, and volatility/shock conditions.
- Added TP confidence layer.
- Allows the EA to be more selective about extending or trusting take-profit behavior.
- Can tighten TP/trailing behavior when the current trade shows weakness.
- Can block aggressive TP extension during shock conditions.
- Added trailing/protection refinement.
- Keeps the normal trailing stop and trailing take-profit framework.
- Adds earlier protective behavior when trade quality weakens.
Safety behavior
- Profit protection does not remove the original stop loss.
- Profit protection does not increase lot size or risk.
- Profit protection does not force trades open.
- Profit protection only manages existing EA-owned positions.
- Modify/close behavior remains subject to broker stop/freeze rules and throttling.
============================================================
3. MOST RECENT PATCH: V3 BOUNDED LEARNING / EXIT INTELLIGENCE
============================================================
Base file patched
- Uploaded CAPM Multi-Asset Intelligence EA V2 source.
New output
- CAPM_MultiAsset_Intelligence_EA_V3_Learning.mq5
Purpose
- Improve the EA without turning it into an overfitted, self-mutating strategy.
- Keep the CAPM entry logic mostly stable.
- Add bounded learning around trade management, profit protection, direction bias, and loss asymmetry.
Main inputs added / supported
- InpUseBoundedLearningMemory
- InpLearningMinClosedTrades
- InpLearningMaxExitTightenPercent
- InpLearningLossAsymmetryRatio
- InpLearningUseMFEProtection
- InpLearningMFEActivateR
- InpLearningMFEGivebackPercent
- InpLearningMinLockR
- InpUseDirectionBiasMonitor
- InpDirectionBiasMinTrades
- InpDirectionBiasMaxShare
- InpDirectionBiasPenalty
- InpLearningJournalCSV
- InpUseTickExitManagement
- InpTickExitManageSeconds
Main additions
1. Bounded learning memory
- Tracks total closed trades, net P/L, wins, losses, gross win, gross loss, and direction-specific performance.
- Uses MT5 Global Variables scoped by account/server/symbol/magic.
- Learning is intentionally bounded and cannot freely rewrite the strategy.
2. MFE / MAE tracking
- Tracks maximum favorable excursion and maximum adverse excursion per position.
- Also tracks peak floating money and worst floating money.
- Uses this data to understand whether trades move into profit before reversing.
3. Adaptive profit-giveback protection
- If enough closed trades show larger average losses than wins or repeated profit giveback, exits tighten gradually.
- The tightening is capped by InpLearningMaxExitTightenPercent.
4. Learning-based MFE protection
- Adds an additional guard that can protect peak floating profit after the trade has achieved meaningful MFE.
- Can close a trade if the trade gives back too much of its favorable excursion.
5. Direction-bias monitor
- Detects when BUY or SELL trades dominate the sample and perform poorly.
- Applies a score penalty to weak overused direction behavior instead of permanently disabling one side.
6. Loss asymmetry control
- If average loss becomes too large relative to average win, exits become earlier/tighter.
- This directly targets the observed pattern of small gains turning into larger losses.
7. Closed-trade learning journal CSV
- Writes closed-trade learning records to the common files folder.
- Records symbol, magic, position id, direction, regime, profit, MFE, MAE, peak money, worst money, and tag.
8. Tick-level exit management
- New entries remain timer/new-bar driven to avoid hyperactivity.
- Open-position management can now run on ticks with throttling.
- This allows faster profit protection without making the entry engine hyperactive.
Important safety design
- Learning does not increase risk.
- Learning does not remove stop loss.
- Learning does not disable spread checks.
- Learning does not disable broker stop/freeze checks.
- Learning does not disable margin checks.
- Learning does not disable daily locks or prop-firm guards.
- Learning does not rewrite the CAPM entry strategy.
- Learning only adjusts exits, protective behavior, and direction confidence penalties within explicit limits.
============================================================
4. PRACTICAL IMPACT OF THE COMBINED PATCHES
============================================================
The combined patch set is intended to make the CAPM EA more suitable for controlled live/demo evaluation by addressing these observed weaknesses:
- Floating profit was not always protected early enough.
- Some trades moved into profit, reversed, and then closed as larger losses.
- The EA could show directional bias, such as taking too many BUY trades on assets where that behavior is unsuitable.
- Loss size could become larger than average win size.
- Prop-firm style limits needed optional hard guardrails.
- Open-position management needed faster reaction than entry logic.
The combined design now separates responsibilities:
- Entry logic: mostly stable CAPM/multi-asset signal logic.
- Trade management: smarter profit protection, TP confidence, health checks, and trailing refinement.
- Learning layer: bounded memory that improves exits and penalties without rewriting the strategy.
- Prop-firm layer: optional account/rule protection around daily loss, max loss, lots, trades, and weekend exposure.
1. PROP FIRM SAFETY / ACCOUNT PROTECTION PATCH
============================================================
Purpose
- Add prop-firm style risk controls around the EA without changing the core CAPM entry idea.
- Reduce the chance of breaching daily loss, maximum loss, lot-size, trade-count, and weekend-holding style rules.
- Keep these protections optional so the EA can still be used on normal broker/demo/live accounts.
Main inputs added / supported
- InpUsePropFirmGuard
- InpPropInitialBalance
- InpPropDailyLossPercent
- InpPropMaxLossPercent
- InpPropSafetyBufferPercent
- InpPropUseAccountWideEquity
- InpPropCloseOwnTradesNearBreach
- InpPropEmergencyBufferPercent
- InpPropStopAfterDailyProfit
- InpPropDailyProfitStopPercent
- InpPropMaxTradesPerDay
- InpPropMaxOpenPositions
- InpPropMaxTotalOpenLots
- InpPropMaxLotPerTrade
- InpPropBlockHighImpactNews
- InpPropCloseOwnBeforeNews
- InpPropNoWeekendHolding
- InpPropFridayFlatHour
- InpPropDailyResetHour
- InpPropUseConsistencyGuard
- InpPropProfitTargetPercent
- InpPropMaxBestDayPercentOfTarget
Functional changes
- Added daily prop-loss guard based on configured account/equity reference.
- Added maximum prop-loss guard to stop new trading when the account approaches the configured breach level.
- Added safety buffer logic so the EA can stop before the actual prop-firm limit is reached.
- Added emergency buffer logic for more urgent near-breach handling.
- Added optional close-own-trades behavior near breach conditions.
- Added optional account-wide equity mode versus own-EA/open-PnL scoped calculation.
- Added daily profit stop so the EA can stop trading after reaching a configured daily profit level.
- Added maximum trades per day control.
- Added maximum open positions control.
- Added maximum total open lots control.
- Added maximum lot per trade cap.
- Added no-weekend-holding protection with configurable Friday flat hour.
- Added prop daily reset-hour handling.
- Added optional consistency guard inputs to help avoid one unusually large day dominating a challenge target.
Safety behavior
- Prop-firm guard does not increase risk.
- Prop-firm guard does not override broker stop/freeze protections.
- Prop-firm guard does not remove normal EA daily loss, floating drawdown, margin, spread, or trade-mode checks.
- Prop-firm guard is optional and should be configured according to the specific prop-firm rule set.
============================================================
2. PROFIT PROTECTION / TRADE HEALTH PATCH
============================================================
Purpose
- Improve the EA's ability to protect floating profit before a winner turns into a larger loser.
- Reduce the pattern of small floating gains disappearing and later becoming full stop-loss trades.
- Add smarter exit behavior while keeping the original entry strategy intact.
Main inputs added / supported
- InpUseProfitGivebackGuard
- InpProfitGuardMinBars
- InpProfitGuardActivateR
- InpProfitGuardActivateMoney
- InpProfitGuardGivebackPercent
- InpProfitGuardMinLockR
- InpProfitGuardMinLockMoney
- InpProfitGuardCloseOnGiveback
- InpProfitGuardTightenSL
- InpUseTradeHealthExit
- InpHealthMinBarsOpen
- InpHealthAdverseR
- InpHealthMinFavorableR
- InpHealthScoreDropPoints
- InpHealthRequiredFailures
- InpHealthUseSignalDeterioration
- InpHealthUseCAPMFlip
- InpHealthUseShockExit
- InpUseTPConfidenceLayer
- InpTPExtendRequiresDirection
- InpTPExtendRequiresCAPM
- InpTPConfidenceBlockOnShock
- InpTPExtendScoreTolerancePoints
- InpTPTightenOnWeakness
- InpTPWeaknessTightenMinR
- InpTPWeaknessTrailDistanceATR
Functional changes
- Added profit-giveback guard.
- Tracks when an open trade has achieved meaningful floating profit.
- If the trade gives back too much of that profit, the EA can close the trade or tighten the stop.
- Added minimum profit-lock logic.
- Allows the EA to protect at least a small amount of profit once the trade has moved sufficiently in favor.
- Added trade-health exit logic.
- Evaluates whether an open trade is deteriorating after being open for a minimum number of bars.
- Can react to adverse movement after prior favorable movement.
- Can consider signal deterioration, CAPM direction flip, and volatility/shock conditions.
- Added TP confidence layer.
- Allows the EA to be more selective about extending or trusting take-profit behavior.
- Can tighten TP/trailing behavior when the current trade shows weakness.
- Can block aggressive TP extension during shock conditions.
- Added trailing/protection refinement.
- Keeps the normal trailing stop and trailing take-profit framework.
- Adds earlier protective behavior when trade quality weakens.
Safety behavior
- Profit protection does not remove the original stop loss.
- Profit protection does not increase lot size or risk.
- Profit protection does not force trades open.
- Profit protection only manages existing EA-owned positions.
- Modify/close behavior remains subject to broker stop/freeze rules and throttling.
============================================================
3. MOST RECENT PATCH: V3 BOUNDED LEARNING / EXIT INTELLIGENCE
============================================================
Base file patched
- Uploaded CAPM Multi-Asset Intelligence EA V2 source.
New output
- CAPM_MultiAsset_Intelligence_EA_V3_Learning.mq5
Purpose
- Improve the EA without turning it into an overfitted, self-mutating strategy.
- Keep the CAPM entry logic mostly stable.
- Add bounded learning around trade management, profit protection, direction bias, and loss asymmetry.
Main inputs added / supported
- InpUseBoundedLearningMemory
- InpLearningMinClosedTrades
- InpLearningMaxExitTightenPercent
- InpLearningLossAsymmetryRatio
- InpLearningUseMFEProtection
- InpLearningMFEActivateR
- InpLearningMFEGivebackPercent
- InpLearningMinLockR
- InpUseDirectionBiasMonitor
- InpDirectionBiasMinTrades
- InpDirectionBiasMaxShare
- InpDirectionBiasPenalty
- InpLearningJournalCSV
- InpUseTickExitManagement
- InpTickExitManageSeconds
Main additions
1. Bounded learning memory
- Tracks total closed trades, net P/L, wins, losses, gross win, gross loss, and direction-specific performance.
- Uses MT5 Global Variables scoped by account/server/symbol/magic.
- Learning is intentionally bounded and cannot freely rewrite the strategy.
2. MFE / MAE tracking
- Tracks maximum favorable excursion and maximum adverse excursion per position.
- Also tracks peak floating money and worst floating money.
- Uses this data to understand whether trades move into profit before reversing.
3. Adaptive profit-giveback protection
- If enough closed trades show larger average losses than wins or repeated profit giveback, exits tighten gradually.
- The tightening is capped by InpLearningMaxExitTightenPercent.
4. Learning-based MFE protection
- Adds an additional guard that can protect peak floating profit after the trade has achieved meaningful MFE.
- Can close a trade if the trade gives back too much of its favorable excursion.
5. Direction-bias monitor
- Detects when BUY or SELL trades dominate the sample and perform poorly.
- Applies a score penalty to weak overused direction behavior instead of permanently disabling one side.
6. Loss asymmetry control
- If average loss becomes too large relative to average win, exits become earlier/tighter.
- This directly targets the observed pattern of small gains turning into larger losses.
7. Closed-trade learning journal CSV
- Writes closed-trade learning records to the common files folder.
- Records symbol, magic, position id, direction, regime, profit, MFE, MAE, peak money, worst money, and tag.
8. Tick-level exit management
- New entries remain timer/new-bar driven to avoid hyperactivity.
- Open-position management can now run on ticks with throttling.
- This allows faster profit protection without making the entry engine hyperactive.
Important safety design
- Learning does not increase risk.
- Learning does not remove stop loss.
- Learning does not disable spread checks.
- Learning does not disable broker stop/freeze checks.
- Learning does not disable margin checks.
- Learning does not disable daily locks or prop-firm guards.
- Learning does not rewrite the CAPM entry strategy.
- Learning only adjusts exits, protective behavior, and direction confidence penalties within explicit limits.
============================================================
4. PRACTICAL IMPACT OF THE COMBINED PATCHES
============================================================
The combined patch set is intended to make the CAPM EA more suitable for controlled live/demo evaluation by addressing these observed weaknesses:
- Floating profit was not always protected early enough.
- Some trades moved into profit, reversed, and then closed as larger losses.
- The EA could show directional bias, such as taking too many BUY trades on assets where that behavior is unsuitable.
- Loss size could become larger than average win size.
- Prop-firm style limits needed optional hard guardrails.
- Open-position management needed faster reaction than entry logic.
The combined design now separates responsibilities:
- Entry logic: mostly stable CAPM/multi-asset signal logic.
- Trade management: smarter profit protection, TP confidence, health checks, and trailing refinement.
- Learning layer: bounded memory that improves exits and penalties without rewriting the strategy.
- Prop-firm layer: optional account/rule protection around daily loss, max loss, lots, trades, and weekend exposure.
Version 2.6
2026.05.09
EA: CAPMV2 V204 Market Validation
Purpose: Improve MQL5 Market validation compatibility without fundamentally changing the EA’s trading strategy.
1. Market Validation Hardening
Improved the EA so it handles common MQL5 Market validation checks more safely, especially around trade volume, margin, stops, freeze levels, and insufficient history.
2. Safer Trade Execution
The EA now performs stricter checks before sending Buy/Sell orders. It validates that the volume is allowed by the broker, that margin is sufficient, and that the trade request is not likely to be rejected by the server.
3. Strict Trade Retcode Validation
Trade actions are no longer treated as successful only because the function returned true. The EA now checks the broker/server return code after trade operations to confirm whether the action was actually accepted.
4. Better Stop-Loss and Take-Profit Safety
Stop-loss and take-profit prices are now rounded directionally to the correct tick size. This helps prevent invalid stop errors caused by rounding stops too close to the market price.
5. Freeze-Level and Stop-Level Protection
The EA now better respects broker stop-level and freeze-level rules before opening or modifying positions. This reduces modification failures such as “position close to market” or “invalid stops.”
6. Improved Risk and Lot Sizing
Lot sizing now uses broker-native profit/loss calculation through OrderCalcProfit() where possible. This makes risk calculation more reliable across forex, gold, indices, crypto, and CFD symbols.
7. Safer Volume Normalization
Volume is now checked against:
Minimum lot
Maximum lot
Lot step
User-defined maximum lot
Broker symbol volume limits
If the requested lot cannot be made valid, the EA blocks the trade instead of forcing an unsafe volume.
8. Symbol Volume Limit Protection
The EA now considers SYMBOL_VOLUME_LIMIT, helping avoid situations where the EA tries to exceed the broker’s allowed total exposure in one direction.
9. Partial-Close Safety
Partial closes are now validated more carefully. The EA checks whether the resulting partial-close volume is allowed by the broker before attempting the close. It also avoids unsafe native partial-close behavior on netting/exchange-style accounts.
10. More Reliable Closed-Trade Tracking
Closed-trade memory was improved so final win/loss classification is less likely to be missed due to MT5 event-timing issues. This helps the EA’s internal learning/truth layer stay more accurate.
11. CAPM Calculation Caching
CAPM calculations are now cached per CAPM timeframe bar. This reduces unnecessary repeated calculations and improves efficiency, especially when using timer-based operation.
12. Insufficient History Protection
The EA now checks that enough bars are available before attempting signal calculations. This helps avoid validation failures caused by missing historical data during Market testing.
13. No-Change Modification Protection
The EA avoids sending position modification requests when the SL/TP values have not meaningfully changed. This reduces unnecessary broker/server messages and prevents “no changes” modification errors.
14. Stronger Input Validation
More input parameters are checked during initialization. Bad or unsafe set-file values are now rejected earlier instead of causing runtime problems later.
15. Strategy Logic Preserved
The patch focuses on validation, execution safety, and broker compatibility. It does not fundamentally change the EA’s core trading strategy, signal structure, or CAPM concept.
Purpose: Improve MQL5 Market validation compatibility without fundamentally changing the EA’s trading strategy.
1. Market Validation Hardening
Improved the EA so it handles common MQL5 Market validation checks more safely, especially around trade volume, margin, stops, freeze levels, and insufficient history.
2. Safer Trade Execution
The EA now performs stricter checks before sending Buy/Sell orders. It validates that the volume is allowed by the broker, that margin is sufficient, and that the trade request is not likely to be rejected by the server.
3. Strict Trade Retcode Validation
Trade actions are no longer treated as successful only because the function returned true. The EA now checks the broker/server return code after trade operations to confirm whether the action was actually accepted.
4. Better Stop-Loss and Take-Profit Safety
Stop-loss and take-profit prices are now rounded directionally to the correct tick size. This helps prevent invalid stop errors caused by rounding stops too close to the market price.
5. Freeze-Level and Stop-Level Protection
The EA now better respects broker stop-level and freeze-level rules before opening or modifying positions. This reduces modification failures such as “position close to market” or “invalid stops.”
6. Improved Risk and Lot Sizing
Lot sizing now uses broker-native profit/loss calculation through OrderCalcProfit() where possible. This makes risk calculation more reliable across forex, gold, indices, crypto, and CFD symbols.
7. Safer Volume Normalization
Volume is now checked against:
Minimum lot
Maximum lot
Lot step
User-defined maximum lot
Broker symbol volume limits
If the requested lot cannot be made valid, the EA blocks the trade instead of forcing an unsafe volume.
8. Symbol Volume Limit Protection
The EA now considers SYMBOL_VOLUME_LIMIT, helping avoid situations where the EA tries to exceed the broker’s allowed total exposure in one direction.
9. Partial-Close Safety
Partial closes are now validated more carefully. The EA checks whether the resulting partial-close volume is allowed by the broker before attempting the close. It also avoids unsafe native partial-close behavior on netting/exchange-style accounts.
10. More Reliable Closed-Trade Tracking
Closed-trade memory was improved so final win/loss classification is less likely to be missed due to MT5 event-timing issues. This helps the EA’s internal learning/truth layer stay more accurate.
11. CAPM Calculation Caching
CAPM calculations are now cached per CAPM timeframe bar. This reduces unnecessary repeated calculations and improves efficiency, especially when using timer-based operation.
12. Insufficient History Protection
The EA now checks that enough bars are available before attempting signal calculations. This helps avoid validation failures caused by missing historical data during Market testing.
13. No-Change Modification Protection
The EA avoids sending position modification requests when the SL/TP values have not meaningfully changed. This reduces unnecessary broker/server messages and prevents “no changes” modification errors.
14. Stronger Input Validation
More input parameters are checked during initialization. Bad or unsafe set-file values are now rejected earlier instead of causing runtime problems later.
15. Strategy Logic Preserved
The patch focuses on validation, execution safety, and broker compatibility. It does not fundamentally change the EA’s core trading strategy, signal structure, or CAPM concept.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
