Topic: Critical Error in Portfolio Test
Hi Miroslav,
have you a Idea for the attach Picture with error in Tester?
It comes after ~ 20.000 Trades.
Thanks, Marcus.
Create and Test Forex Strategies
You are not logged in. Please login or register.
Forex Software → Expert Advisor Studio → Critical Error in Portfolio Test
Hi Miroslav,
have you a Idea for the attach Picture with error in Tester?
It comes after ~ 20.000 Trades.
Thanks, Marcus.
It says that the error is on line 632. Please copy the near lines to see what is there. It is probably some indicator.
Ich have now 608 to 671 copy.
Thank you
// $(__MT4TRACKER)
#define MAX_WINS_LOSSES (2000)
char g_acWinsLosses[MAX_WINS_LOSSES];
int GetMagicStats(const int magicNumber, double& dWinRatio, int& iMaxConsecutiveLosses)
{
dWinRatio = 0;
iMaxConsecutiveLosses = 0;
int iCountTrades = 0;
for (int i = 0; i < MAX_WINS_LOSSES; i++)
{
g_acWinsLosses[i] = 0;
}
int total = OrdersHistoryTotal();
for(int pos=total-1; pos>=0; pos--)
{
if((true == OrderSelect(pos, SELECT_BY_POS,MODE_HISTORY)) && (OrderSymbol() == _Symbol) && (OrderMagicNumber() == magicNumber))
{
// The net profit value (without swaps or commissions) for the selected order.
// For open orders, it is the current unrealized profit. For closed orders, it is the fixed profit.
if (OrderProfit() >= 0)
g_acWinsLosses[iCountTrades++] = 1;
else
g_acWinsLosses[iCountTrades++] = 0;
}
}
int iCountWins = 0;
int iCountLosses = 0;
int iConsecutiveLosses = 0;
int iNRecentTrades = 99999;
if (Most_Recent_Trades > 0)
iNRecentTrades = Most_Recent_Trades;
if ((iCountTrades > 0) && (iCountTrades < iNRecentTrades))
{
for (int i = 0; i < iCountTrades; i++)
{
if (g_acWinsLosses[i] > 0)
{
iCountWins++;
iConsecutiveLosses = 0;
}
else
{
iCountLosses++;
iConsecutiveLosses++;
if (iConsecutiveLosses > iMaxConsecutiveLosses)
iMaxConsecutiveLosses = iConsecutiveLosses;
}
}
dWinRatio = (double)(iCountWins) / (double)(iCountTrades);
// Print("INFO1: GetMagicStats: MagicNumber: ", IntegerToString(magicNumber), ", CountTrades: ", IntegerToString(iCountTrades), ", CountWins: ", IntegerToString(iCountWins), ", CountLosses: ", IntegerToString(iCountLosses));
}
else if (iCountTrades > 0)
{
for (int i = (iCountTrades-iNRecentTrades); i < iCountTrades; i++)
{
if (g_acWinsLosses[i] > 0)
{
iCountWins++;
iConsecutiveLosses = 0;
}
If it is that one:
g_acWinsLosses[iCountTrades++] = 1;
It is not our code.
Check the array initialization if have enough space.
If it is that one:
g_acWinsLosses[iCountTrades++] = 1;
It is not our code.
Check the array initialization if have enough space.
Yes, this the Code from Sleytus, from MT4-Tracker. I have thinked, you ok with this?
I dont understand, how i can do. But i see i must under 30.000 Trades.
Thanks
Forex Software → Expert Advisor Studio → Critical Error in Portfolio Test
Powered by PunBB, supported by Informer Technologies, Inc.