Version 2.0 2026.05.08
```text
CHANGES MADE — Fibonacci Scalp Adaptive Prop Firm Version

The existing Fibonacci Scalp v2 structure was preserved and extended with adaptive risk management, market regime detection, dynamic risk/reward logic, cooldown protection, manual news filters, model memory, and session memory.

The goal of these changes is to improve risk control, reduce unnecessary drawdown, increase trade quality, and make the Expert Advisor more suitable for prop-firm style trading.

No profit guarantee is provided or implied. The EA must be tested carefully through backtesting, forward testing, demo testing, and broker-specific validation before any live usage.


1. INPUT GROUPS WERE REORGANIZED

The input structure was cleaned and renamed to look more professional and easier to understand inside the MetaTrader Strategy Tester.

Updated input groups:

--- 01. Core Trade Settings ---
--- 02. Fibonacci Setup Settings ---
--- 03. Entry Model Selection ---
--- 04. Market Quality Filters ---
--- 05. Trading Session Filter ---
--- 06. Prop Firm Risk Protection ---
--- 07. Stop Loss & Take Profit Engine ---
--- 08. Active Trade Management ---
--- 09. Adaptive Risk Engine ---
--- 10. Market Regime Engine ---
--- 11. Dynamic RR Engine ---
--- 12. Smart Exit & Cooldown Engine ---
--- 13. News & Weekday Protection ---
--- 14. Model & Session Memory ---


2. ADAPTIVE RISK ENGINE WAS ADDED

The EA no longer has to use a fixed risk percentage for every trade. It can now adjust the risk dynamically based on recent trading performance.

Added inputs:

InpUseAdaptiveRiskThrottle
InpEquityLookbackDeals
InpMinAdaptiveRiskPercent
InpMaxAdaptiveRiskPercent
InpLossPhaseRiskFactor
InpWinningPhaseRiskFactor
InpUseRecoveryMode
InpRecoveryRiskPercent
InpRecoveryAfterLosses
InpRecoveryOnlyConservative

Added functions:

GetAdaptiveRiskPercent()
IsRecoveryMode()

Logic:

- If recent performance is negative, the EA reduces risk automatically.
- If recent performance is positive, the EA can slightly increase risk within a controlled limit.
- If consecutive losses occur, Recovery Mode can be activated.
- In Recovery Mode, the risk is reduced.
- In Recovery Mode, the EA can optionally trade only the Conservative entry model.


3. MARKET REGIME ENGINE WAS ADDED

The EA can now classify the current market condition instead of treating all market environments the same.

Added enum:

ENUM_MARKET_REGIME

Market regimes:

REGIME_RANGE
REGIME_NORMAL
REGIME_TREND
REGIME_HIGH_VOLATILITY
REGIME_LOW_VOLATILITY

Added inputs:

InpUseRegimeDetection
InpTrendADXThreshold
InpRangeADXThreshold
InpHighVolatilityATRPoints
InpLowVolatilityATRPoints
InpDisableAggressiveInRange
InpReduceRiskInHighVolatility
InpHighVolatilityRiskFactor

Added functions:

DetectMarketRegime()
RegimeToString()

Logic:

- If ADX is high, the market is classified as a trend regime.
- If ADX is low, the market is classified as a range regime.
- If ATR is too high, the market is classified as high volatility.
- If ATR is too low, the market is classified as low volatility.
- The Aggressive model can be disabled automatically in range markets.
- Risk can be reduced automatically in high-volatility conditions.


4. DYNAMIC RR ENGINE WAS ADDED

The take-profit target is no longer limited to a fixed risk/reward value. The EA can now adjust RR based on the detected market regime.

Added inputs:

InpUseDynamicRR
InpTrendRR
InpNormalRR
InpRangeRR
InpRecoveryRR

Added function:

GetDynamicRR()

Logic:

- Strong trend conditions can use a higher RR target.
- Normal market conditions use the standard RR target.
- Range or weak-momentum conditions can use a smaller RR target.
- Recovery Mode can use a more conservative RR target.

Example structure:

Trend market: 2.50R
Normal market: 2.00R
Range market: 1.30R
Recovery Mode: 1.20R


5. LOT SIZE CALCULATION WAS UPDATED

Old function:

double CalculateLotSize(double sl_distance_points)

New function:

double CalculateLotSize(double sl_distance_points, double riskPercent)

Reason for change:

The lot calculation now uses the adaptive risk percentage generated by the Adaptive Risk Engine instead of always using the base risk input.

The EA now calculates lot size using:

adaptiveRiskPercent

instead of relying only on:

InpRiskPercentage


6. BUILD TRADE LEVELS FUNCTION WAS UPDATED

Old structure:

BuildTradeLevels(..., double atrPrice, double &entry, double &sl, double &tp)

New structure:

BuildTradeLevels(..., double atrPrice, double dynamicRR, double &entry, double &sl, double &tp)

Reason for change:

The Dynamic RR Engine now passes the active RR value into the SL/TP calculation.

Old TP logic:

tp = entry + risk * InpRiskRewardRatio

New TP logic:

tp = entry + risk * dynamicRR

The same logic was applied to sell trades in the opposite direction.


7. SMART COOLDOWN ENGINE WAS ADDED

The EA can now pause after a losing trade instead of immediately entering again.

Added inputs:

InpUseSmartCooldown
InpCooldownBarsAfterLoss
InpDirectionPauseBars
InpMaxSameDirectionLosses

Added functions:

GetLastLossInfo()
CountRecentDirectionLosses()
IsCooldownAllowingDirection()

Logic:

- After a losing trade, the EA waits for a defined number of bars before opening a new trade.
- If the EA has multiple losses in the same direction, that direction can be temporarily paused.
- This helps reduce repeated entries after failed signals.


8. TIME-BASED EXIT WAS ADDED

The EA can now close trades that do not progress within a reasonable number of bars.

Added inputs:

InpUseTimeBasedExit
InpMaxBarsInTrade
InpMinRAtMaxBars

Integrated into:

ManageOpenPositions()

Logic:

- If a trade stays open for too many bars without reaching a minimum R progress, it can be closed.
- This is designed to reduce inactive or low-quality positions.

Example:

InpMaxBarsInTrade = 30
InpMinRAtMaxBars = 0.20

Meaning:

If the trade remains open for 30 bars and has not reached at least 0.20R, it can be closed.


9. NEWS & WEEKDAY PROTECTION WAS ADDED

Manual time-blocking was added to help avoid risky trading windows.

Added inputs:

InpUseWeekdayProtection
InpMondayBlockBeforeHour
InpFridayBlockAfterHour
InpUseManualNewsBlock1
InpNewsBlock1StartHour
InpNewsBlock1EndHour
InpUseManualNewsBlock2
InpNewsBlock2StartHour
InpNewsBlock2EndHour

Added function:

IsWeekdayAndNewsAllowed()

Logic:

- Monday early trading hours can be blocked.
- Late Friday trading hours can be blocked.
- Two manual news-block windows can be configured.
- The EA will not open new trades during blocked time periods.


10. MODEL PERFORMANCE MEMORY WAS ADDED

The EA can now evaluate the recent performance of each entry model.

Added inputs:

InpUseModelPerformanceFilter
InpModelLookbackDeals
InpMinModelNetProfitToAllow

Added function:

IsModelAllowedByMemory()

Logic:

- The EA checks the recent net result of each model.
- If a model performs below the defined threshold, it can be temporarily filtered.
- Conservative, Balanced, and Aggressive models can be evaluated separately.


11. SESSION PERFORMANCE MEMORY WAS ADDED

The EA can now evaluate the recent performance of the London and New York sessions.

Added inputs:

InpUseSessionPerformanceFilter
InpSessionLookbackDeals
InpMinSessionNetProfitToAllow

Added functions:

CurrentSessionName()
IsSessionAllowedByMemory()

Logic:

- The EA detects whether the current trade window is London, New York, or Other.
- If a session has recently performed poorly, new trades in that session can be filtered.
- This helps avoid repeatedly trading during a weak session environment.


12. HISTORY / DEAL ANALYSIS FUNCTIONS WERE ADDED

Several helper functions were added to read closed trade history and support the adaptive logic.

Added functions:

IsOurClosedDeal()
ClosedDealProfit()
GetRecentClosedNetProfit()
GetRecentClosedWins()
GetLastLossInfo()
CountRecentDirectionLosses()

These functions support:

- Adaptive risk calculation
- Recovery Mode
- Model performance filtering
- Session performance filtering
- Smart cooldown logic
- Consecutive loss detection


13. FIB ENTRY CONDITION WAS UPDATED

The Fibonacci entry condition function was extended to work with the adaptive engine.

Old structure:

FibEntryCondition(..., string &modelName)

New structure:

FibEntryCondition(..., ENUM_MARKET_REGIME regime, bool recoveryMode, string &modelName)

Added logic:

- Recovery Mode can force the EA to use only the Conservative model.
- Range regime can disable the Aggressive model.
- Each model is checked through the model performance memory filter.

Conservative model:

- 50 / 61.8 Fibonacci area
- Strong confirmation
- Reaction close
- Model memory check

Balanced model:

- 38.2 / 50 / 61.8 Fibonacci area
- Soft confirmation
- Reaction close
- Model memory check

Aggressive model:

- 38.2 / 50 / 61.8 / 78.6 Fibonacci area
- Soft confirmation
- Can be disabled in range markets
- Model memory check


14. ONTICK FLOW WAS UPDATED

The main OnTick() logic now includes the new adaptive checks before opening a trade.

Added checks and calculations:

IsWeekdayAndNewsAllowed()
IsSessionAllowedByMemory()
DetectMarketRegime()
IsRecoveryMode()
GetDynamicRR()
GetAdaptiveRiskPercent()
IsCooldownAllowingDirection()

The new entry flow:

- Open position check
- Prop firm risk guard
- Session filter
- Spread filter
- News / weekday protection
- Session performance memory
- ATR filter
- ADX filter
- Market regime detection
- Recovery Mode detection
- Dynamic RR calculation
- Adaptive risk calculation
- Smart cooldown check
- Fibonacci entry model check
- SL / TP calculation
- Lot size calculation
- Trade execution


15. ADAPTIVE ENTRY LOG WAS ADDED

A log message was added before trade execution to show the active adaptive state.

Example log:

Adaptive entry info:
Model=Balanced
Regime=Trend
Recovery=false
Risk=1.20
RR=2.50
Session=London

This helps during backtesting and debugging by showing why the EA opened a trade under specific conditions.


16. PARAMETER COUNT ERROR WAS FIXED

After updating CalculateLotSize() to require two parameters, some old one-parameter calls caused a compilation error.

Error:

wrong parameters count, 1 passed, but 2 requires

Old call:

CalculateLotSize(slDistancePoints);

Fixed call:

CalculateLotSize(slDistancePoints, adaptiveRiskPercent);

All relevant calls were updated.


GENERAL RESULT

The EA was upgraded from a basic Fibonacci retracement scalping system into a more advanced adaptive trading engine.

The updated EA now includes:

- Prop-firm style risk protection
- Adaptive risk adjustment
- Recovery Mode
- Market regime detection
- Dynamic RR targeting
- Smart cooldown after losses
- Time-based exit
- Manual news and weekday protection
- Model performance memory
- Session performance memory
- More detailed trade logging


IMPORTANT RISK DISCLAIMER

This Expert Advisor does not guarantee profit.

Past backtest performance does not guarantee future results. Market conditions can change, spreads can widen, execution can differ between brokers, and prop-firm rules may vary. The EA should be tested with high-quality historical data, realistic spread/slippage settings, forward testing, and demo validation before any live or funded-account use.

The purpose of these changes is to improve structure, risk control, and adaptability, not to guarantee profitable results.
```