This commit is contained in:
2024-06-21 10:30:01 +03:30
parent e54a991b6d
commit 5e8df132d4
2 changed files with 57 additions and 119 deletions
+43 -107
View File
@@ -190,6 +190,12 @@ struct XTradeInfo
pivots //
);
tSignal.Clean();
int pivotsCount = ArraySize(pivots);
if (!IsValidSize(pivotsCount))
{
//
Print("Dangerous Position ...");
}
//
return result;
@@ -4243,13 +4249,6 @@ public:
mTradeHandler.Sync();
}
//
// Orders Changed ...
void OnOrdersChangedHandler(int count) override
{
EQMHandleSupportProtection(count);
}
//
void OnPositionClosed(
const XPosition &position,
@@ -4893,6 +4892,25 @@ private:
//
// TODO: Implement it ...
//
XSignal signals[];
//
if (isValid)
{
//
AddRef(
signal,
signals //
);
}
//
if (ArraySize(signals) > 0)
{
EQMExecuteSignals(signals);
}
}
//
@@ -4951,6 +4969,24 @@ private:
continue;
}
//
XPosition iParent;
bool hasParent = mTrader.GetPosition(
iParentTicket,
iParent //
);
if (!hasParent)
{
continue;
}
//
// Check Parent Has TP or SL ...
if (iParent.tp == 0 && iParent.sl == 0)
{
continue;
}
//
// Remove TP and SL of Supported Positions ...
string comment = "EQM Remove TPSL ...";
@@ -4970,106 +5006,6 @@ private:
}
}
//
void EQMHandleSupportProtection(int count)
{
// //
// if (IsValidSize(count))
// {
// return;
// }
// //
// // This means on order Executed ...
// ulong ticket = mTrader.GetLastOpenPositionTicket();
// //
// XPosition position;
// bool hasPosition = mTrader.GetPosition(
// ticket,
// position //
// );
// if (!hasPosition)
// {
// return;
// }
// //
// bool isSupport = IsSupport(position.comment);
// if (!isSupport)
// {
// return;
// }
// //
// bool isInDirectional = position.provider == XEQMSupportToken + XINDirectionalToken;
// if (!isInDirectional)
// {
// return;
// }
// //
// XPosition parent;
// ulong parentTicket = ExtractParentTicket(position.comment);
// bool hasParent = mTrader.GetPosition(
// parentTicket,
// parent //
// );
// //
// if (!hasParent)
// {
// return;
// }
// //
// // Remove Parent TP SL ...
// if (parent.tp > 0 || parent.sl > 0)
// {
// //
// string comment = XEQMSupportToken + " Remoove TP/SL due Protect ...";
// bool isModeified = mTrader.Modify(
// parentTicket,
// 0,
// 0,
// comment //
// );
// if (isModeified)
// {
// //
// string message = XEQMSupportToken + " Removes Position (" + ToString(parentTicket) + ")' TP/SL Due Start Supporting ...";
// //
// Alert(message);
// }
// }
// //
// XSignal signal;
// X121SignalGenerator signalGenerator;
// bool hasSupport = signalGenerator.PrepareDirectionalSupportSignals(
// position,
// parent,
// signal //
// );
// if (!hasSupport)
// {
// return;
// }
// //
// XSignal signals[];
// //
// AddRef(
// signal,
// signals //
// );
// //
// EQMExecuteSignals(signals);
}
//
};