镜像自地址
https://github.com/A6-9V/MQL5-Google-Onedrive.git
已同步 2026-04-11 06:50:56 +00:00
💡 What: This change removes a dangerous recursive call in the `CalculateTP` function's error handling logic. Instead of calling itself, the function now uses a direct fallback calculation based on the Risk:Reward ratio. 🎯 Why: The original implementation created a risk of infinite recursion if the `CopyBuffer` call for the Donchian channel data failed repeatedly. This would lead to a stack overflow and crash the Expert Advisor—the ultimate performance failure. 📊 Impact: - Prevents EA crashes: Eliminates the risk of a fatal stack overflow error, ensuring the trading bot remains stable even when indicator data is unavailable. - Improves performance under failure: Replaces an infinite loop with a constant-time calculation, making the fallback logic instantaneous and efficient. 🔬 Measurement: The improvement can be verified by observing that the EA no longer crashes and logs errors related to stack overflow when the `CopyBuffer` call for the Donchian channel is forced to fail. The logic now correctly and immediately applies the `TP_RR` fallback. Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| Experts | ||
| Indicators | ||