last ...
This commit is contained in:
@@ -3266,6 +3266,46 @@ int FindMaxProfitIndex(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int FindMinProfitIndex(
|
||||
XPosition &positions[] // Position Collection
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
int positionsCount = ArraySize(positions);
|
||||
if (!IsValidSize(positionsCount))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double min = 0;
|
||||
for (int i = 0; i < positionsCount; i++)
|
||||
{
|
||||
//
|
||||
XPosition iPosition = positions[i];
|
||||
if (iPosition.profit <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
if (min == 0 ||
|
||||
min > iPosition.profit)
|
||||
{
|
||||
//
|
||||
result = i;
|
||||
min = iPosition.profit;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int ExtractInProfitPositions(
|
||||
XPosition &positions[], // Position Collection
|
||||
@@ -3324,6 +3364,46 @@ int FindMaxDrawdownIndex(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double max = 0;
|
||||
for (int i = 0; i < positionsCount; i++)
|
||||
{
|
||||
//
|
||||
XPosition iPosition = positions[i];
|
||||
if (iPosition.profit >= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
if (max == 0 ||
|
||||
max < iPosition.profit)
|
||||
{
|
||||
//
|
||||
result = i;
|
||||
max = iPosition.profit;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int FindMinDrawdownIndex(
|
||||
XPosition &positions[] // Position Collection
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
int positionsCount = ArraySize(positions);
|
||||
if (!IsValidSize(positionsCount))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double min = 0;
|
||||
for (int i = 0; i < positionsCount; i++)
|
||||
|
||||
Reference in New Issue
Block a user