MT5 terminal might accumulate ticks and call OnTick() only once, i.e. it is _not_ guaranteed to call OnTick() for each an every tick.
Please refer to https://www.mql5.com/en/docs/runtime/event_fire#newtick
Please refer to https://www.mql5.com/en/docs/runtime/event_fire#newtick
Documentation on MQL5: MQL5 programs / Client Terminal Events
- www.mql5.com
Immediately after the client terminal loads a program (an Expert Advisor or custom indicator) and starts the process of initialization of global...
no. mt4 and mt5 do NOT track equity or drawdown upon every tick. There are many threads on this very website where traders of all levels of experience say to only use backtesting when coding an ea. They do not prove the forward success of a strategy, let alone an ea.
If you want to prove that your backtest dd report is accurate, then, add an equity stop to your ea code. for example make the ea close all trades or stop trading, or use ExpertRemove, when equity hits 60% of your balance.
If you want to prove that your backtest dd report is accurate, then, add an equity stop to your ea code. for example make the ea close all trades or stop trading, or use ExpertRemove, when equity hits 60% of your balance.
b4640, I confirm.
#include <MT4Orders.mqh> // https://www.mql5.com/ru/code/16006 #define Ask SymbolInfoDouble(_Symbol, SYMBOL_ASK) double GetEquityDD() { static double MaxEquity = AccountInfoDouble(ACCOUNT_EQUITY); static double MaxDD = 0; const double Equity = AccountInfoDouble(ACCOUNT_EQUITY); if (Equity > MaxEquity) MaxEquity = Equity; else MaxDD = MathMin(MaxDD, Equity - MaxEquity); return(MaxDD); } void OnTick() { static const bool Init = !GetEquityDD() && OrderSend(_Symbol, OP_BUY, 1, Ask, 0, 0, 0); GetEquityDD(); } double OnTester() { // return(!NormalizeDouble(GetEquityDD() - TesterStatistics(STAT_EQUITY_DD), 2)); return(GetEquityDD()); }
Новая версия платформы MetaTrader 5 build 4620: исправления ошибок в MQL5 и новые методы OpenBLAS
- 2024.10.21
- Maxim Kuznetsov
- www.mql5.com
В пятницу 11 октября 2024 года будет выпущена обновленная версия платформы MetaTrader 5...
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
My EA measurng the max DD every tick, and saving the highest drawdown. But it is usually a bit higher than what the backtest reports claims. I am testing with Every Tick Real Ticks.
The MT5 backtest report claimed the Max DD is 969.58 USD, while my EA claimed that it was a bit above thousand.
To find out which was correct, I ran a visual backtest.
In the 1st pic you can see how the equity was 100738.58.
In the 2nd pic, later in the same test, the equity is 99720.69
So in that moment, the max DD was 1017.89
But still the backtest report claims it was only 969.58 (pic 3)
Does anyone know why this is? Is MT5 maybe not checking the DD every tick, and if so, when/how often is it checking the DD?
I would like to modify my code so that it measures in the same way as the Stategy Tester does.