last ...
This commit is contained in:
@@ -3945,3 +3945,168 @@ string PrepareSLTrailTag(
|
||||
}
|
||||
|
||||
//
|
||||
// EQM Support Orders ...
|
||||
|
||||
//
|
||||
int GenerateEQMOrders(
|
||||
XSignal &orders[], // Result
|
||||
XPosition &position, // Supported Position
|
||||
XOHCLSupRes &supRes, // Data Source
|
||||
bool longs = true,
|
||||
bool shorts = true //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(orders);
|
||||
|
||||
//
|
||||
if (!supRes.IsValid() ||
|
||||
!position.IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (longs)
|
||||
{
|
||||
//
|
||||
double longLevels[];
|
||||
|
||||
//
|
||||
Copy(
|
||||
supRes.res,
|
||||
longLevels //
|
||||
);
|
||||
|
||||
//
|
||||
double minSup = GetMin(
|
||||
supRes.sup //
|
||||
);
|
||||
if (minSup > 0)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
minSup,
|
||||
longLevels //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
ArraySort(longLevels);
|
||||
|
||||
//
|
||||
if (ArraySize(longLevels) > 2)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < ArraySize(longLevels) - 2; i++)
|
||||
{
|
||||
//
|
||||
double iSL = longLevels[i];
|
||||
double iEntry = longLevels[i + 1];
|
||||
double iTP = longLevels[i + 2];
|
||||
|
||||
//
|
||||
XSignal iSignal;
|
||||
bool isPrepared = iSignal.PrepareStopLong(
|
||||
position.symbol,
|
||||
XEQMSupportToken,
|
||||
position.period,
|
||||
iEntry,
|
||||
position.volume,
|
||||
X_SIGNAL_USE_NOTHING,
|
||||
iSL,
|
||||
iTP //
|
||||
);
|
||||
if (isPrepared)
|
||||
{
|
||||
//
|
||||
string comment = GenerateSupportTag(position.ticket);
|
||||
iSignal.comment = comment;
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iSignal,
|
||||
orders //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (shorts)
|
||||
{
|
||||
//
|
||||
double shortLevels[];
|
||||
|
||||
//
|
||||
Copy(
|
||||
supRes.sup,
|
||||
shortLevels //
|
||||
);
|
||||
|
||||
//
|
||||
double maxRes = GetMax(
|
||||
supRes.res //
|
||||
);
|
||||
if (maxRes > 0)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
maxRes,
|
||||
shortLevels //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
ArraySort(shortLevels);
|
||||
ArrayReverse(shortLevels);
|
||||
|
||||
//
|
||||
if (ArraySize(shortLevels) > 2)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < ArraySize(shortLevels) - 2; i++)
|
||||
{
|
||||
//
|
||||
double iSL = shortLevels[i];
|
||||
double iEntry = shortLevels[i + 1];
|
||||
double iTP = shortLevels[i + 2];
|
||||
|
||||
//
|
||||
XSignal iSignal;
|
||||
bool isPrepared = iSignal.PrepareStopShort(
|
||||
position.symbol,
|
||||
XEQMSupportToken,
|
||||
position.period,
|
||||
iEntry,
|
||||
position.volume,
|
||||
X_SIGNAL_USE_NOTHING,
|
||||
iSL,
|
||||
iTP //
|
||||
);
|
||||
if (isPrepared)
|
||||
{
|
||||
//
|
||||
string comment = GenerateSupportTag(position.ticket);
|
||||
iSignal.comment = comment;
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iSignal,
|
||||
orders //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(orders);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user