Transcoding error in the platform header \MQL5\Include\Math\Stat\Math.mqh after converting the file from UTF-16 to UTF-8.
Line 5299:
//| Reference: |//| Hyndman, R. J. and Fan, Y. (1996) |//| "Sample quantiles in statistical packages", |//| American Statistician, vol.50, pp. 361–365. |
Pattern for real-time trailing drawdown enforcement in MQL5:
Prop firm EAs require a trailing maximum drawdown guard that tracks the highest equity peak and flattens all positions if current equity drops below a threshold from that peak. The subtlety most MQL5 developers miss: AccountInfoDouble(ACCOUNT_EQUITY) includes floating unrealized P&L, which is correct for this purpose — but the equity peak must be updated only on OnTick() , not on OnTradeTransaction() , to avoid phantom peaks from partially-filled orders:
Worth noting: initializing g_peakEquity to AccountInfoDouble(ACCOUNT_BALANCE) in OnInit() rather than 0 prevents a false drawdown trigger on the very first tick if floating loss already exists when the EA starts.
In the Tester, Balance/Equity chart data is written to a tst file.
//+------------------------------------------------------------------+//| Structure for the test plan |//+------------------------------------------------------------------+struct TesterTradeState
{
__int64 time; // current test timedouble balance; // current balancedouble equity; // current equitydouble value; // current calculated deposit load value
I ran a single pass of the expert advisor, which opens a single position at the start, and the Tester automatically closes it at the end of the pass. Here is the chart.
I don’t understand the algorithm used to decide when to make the next entry. I’ve highlighted two entries in colour, with 80 seconds between them. I looked at the price chart for those 80 seconds – there was no movement. Anyway, could you please explain? But I have a suggestion as well.
When putting together a portfolio of two trading systems, one tries to calculate the correlation between their results.
To do this, they take two equity vectors – the equity values from each backtest at identical time points (for example, at the start of every hour or at the start of every day).
After conversion, the correlation between them is calculated.
vector GetVector( constdouble &Array[] )
{
vector Vector;
Vector.Assign(Array);
return(Vector);
}
double GetCorr( constdouble &Array1[], constdouble &Array2[] )
{
return(GetVector(Array1).CorrCoef(GetVector(Array2)));
}
void ChangeEquity( double &Equity[] )
{
for (int i = ArraySize(Equity) - 1; i > 0; i--)
Equity[i] = Equity[i] / Equity[i - 1] - 1;
Equity[0] = 0; // ArrayRemove(Equity, 0, 1);
}
voidOnStart()
{
double Equity1[]; // Equity of the first trading system – recorded every hour.double Equity2[]; // Equity of the second trading system – recorded every hour.
ChangeEquity(Equity1);
ChangeEquity(Equity2);
Print(GetCorr(Equity1, Equity2)); // Correlation between two trading systems.
}
So, I’d like to ask you to consider the possibility of always recording the Equity/Balance value every hour in the TST file during a single run.
This would provide the data needed to calculate correlations between trading systems. We would also obtain an Equity/Balance graph, where the x-axis represents time. Thank you.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Transcoding error in the platform header \MQL5\Include\Math\Stat\Math.mqh after converting the file from UTF-16 to UTF-8.
Line 5299:
Transcoding error in the platform header \MQL5\Include\Math\Stat\Math.mqh after converting the file from UTF-16 to UTF-8.
Line 5299:
Seems something on your side ?
I also checked with B6090.
Seems something on your side ?
I also checked with B6090.
Pattern for real-time trailing drawdown enforcement in MQL5:
Prop firm EAs require a trailing maximum drawdown guard that tracks the highest equity peak and flattens all positions if current equity drops below a threshold from that peak. The subtlety most MQL5 developers miss: AccountInfoDouble(ACCOUNT_EQUITY) includes floating unrealized P&L, which is correct for this purpose — but the equity peak must be updated only on OnTick() , not on OnTradeTransaction() , to avoid phantom peaks from partially-filled orders:
Worth noting: initializing g_peakEquity to AccountInfoDouble(ACCOUNT_BALANCE) in OnInit() rather than 0 prevents a false drawdown trigger on the very first tick if floating loss already exists when the EA starts.
Zeroing is not guaranteed.
In the Tester, Balance/Equity chart data is written to a tst file.
I ran a single pass of the expert advisor, which opens a single position at the start, and the Tester automatically closes it at the end of the pass. Here is the chart.
The tabular data for this chart.
I don’t understand the algorithm used to decide when to make the next entry. I’ve highlighted two entries in colour, with 80 seconds between them. I looked at the price chart for those 80 seconds – there was no movement. Anyway, could you please explain? But I have a suggestion as well.
When putting together a portfolio of two trading systems, one tries to calculate the correlation between their results.
So, I’d like to ask you to consider the possibility of always recording the Equity/Balance value every hour in the TST file during a single run.
This would provide the data needed to calculate correlations between trading systems. We would also obtain an Equity/Balance graph, where the x-axis represents time. Thank you.
Search term: Improvement 165.