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 // pivots //
); );
tSignal.Clean(); tSignal.Clean();
int pivotsCount = ArraySize(pivots);
if (!IsValidSize(pivotsCount))
{
//
Print("Dangerous Position ...");
}
// //
return result; return result;
@@ -4243,13 +4249,6 @@ public:
mTradeHandler.Sync(); mTradeHandler.Sync();
} }
//
// Orders Changed ...
void OnOrdersChangedHandler(int count) override
{
EQMHandleSupportProtection(count);
}
// //
void OnPositionClosed( void OnPositionClosed(
const XPosition &position, const XPosition &position,
@@ -4893,6 +4892,25 @@ private:
// //
// TODO: Implement it ... // TODO: Implement it ...
//
XSignal signals[];
//
if (isValid)
{
//
AddRef(
signal,
signals //
);
}
//
if (ArraySize(signals) > 0)
{
EQMExecuteSignals(signals);
}
} }
// //
@@ -4951,6 +4969,24 @@ private:
continue; 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 ... // Remove TP and SL of Supported Positions ...
string comment = "EQM Remove TPSL ..."; 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);
}
// //
}; };
+14 -12
View File
@@ -40,13 +40,13 @@ input int x121EASlippage = 10; // Slippgae
// EURUSDb,GBPUSDb,XAUUSDb,USDCHFb,USDJPYb // EURUSDb,GBPUSDb,XAUUSDb,USDCHFb,USDJPYb
input group "Signals"; input group "Signals";
// EURUSDb,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb,XAUUSDb,NZDUSDb,AUDUSDb,USDCADb,BTCUSD,ETHUSD // EURUSDb,USDCHFb,EURCHFb,USDJPYb,EURJPYb,GBPUSDb,XAUUSDb,NZDUSDb,AUDUSDb,USDCADb,BTCUSD,ETHUSD
input string x121EASymbols = ""; // Symbols input string x121EASymbols = "EURUSDb,USDCHFb,XAUUSDb,USDJPYb,GBPUSDb"; // Symbols
input bool x121EAUseAllSymbols = false; // Use All Available Symbols input bool x121EAUseAllSymbols = false; // Use All Available Symbols
input bool x121EAUseAllWatchListSymbols = false; // Use All WatchList Symbols input bool x121EAUseAllWatchListSymbols = false; // Use All WatchList Symbols
input bool x121EAAllowLong = true; // Allow Long Trades input bool x121EAAllowLong = true; // Allow Long Trades
input bool x121EAAllowShort = true; // Allow Short Trades input bool x121EAAllowShort = true; // Allow Short Trades
input int x121EAReuiredSignalVerifications = 5; // Required Verifications for Signals input int x121EAReuiredSignalVerifications = 2; // Required Verifications for Signals
input bool x121EAGetVerificationFromOtherTimeFrames = true; // Get Verifications from Other Time Frames input bool x121EAGetVerificationFromOtherTimeFrames = true; // Get Verifications from Other Time Frames
// //
// Risk Management ... // Risk Management ...
@@ -76,7 +76,7 @@ input double x121EANextTrailPoint = 20; // Next Trailling Step
// //
input group "Supporting"; input group "Supporting";
input bool x121EAAllowSupport = true; // Allow Support Signals input bool x121EAAllowSupport = false; // Allow Support Signals
double x121EASupportDistance = 50; // Supporting Distance double x121EASupportDistance = 50; // Supporting Distance
input int x121EAMaxNumberOfSupports = 1; // Max Number of Support Signals input int x121EAMaxNumberOfSupports = 1; // Max Number of Support Signals
input double x121EASupportVolumeMultiplier = 2.0; // Support Signals Volume Multiplier input double x121EASupportVolumeMultiplier = 2.0; // Support Signals Volume Multiplier
@@ -100,8 +100,8 @@ input double x121EAMaxAllowedRecoveryVolume = 0.08; // Max Allowed Recovery Sign
// //
input group "Hedging"; input group "Hedging";
input int x121EARestingAfterHedge = 1000; // Resting Seconds After Hedge input int x121EARestingAfterHedge = 0; // Resting Seconds After Hedge
input double x121EAMinRequiredProfitPerTrade = 0.4; // Minimum Required Profit for Hedging input double x121EAMinRequiredProfitPerTrade = 0.5; // Minimum Required Profit for Hedging
input double x121EAMinRequiredProfitPerVolumeFactor = 0.01; // Minimum Required Profit for Hedging Per Volume input double x121EAMinRequiredProfitPerVolumeFactor = 0.01; // Minimum Required Profit for Hedging Per Volume
input double x121EAForceCloseProfit = 20; // Close All Positions Regardless of Policies when Profit Reached input double x121EAForceCloseProfit = 20; // Close All Positions Regardless of Policies when Profit Reached
@@ -369,9 +369,11 @@ bool InitialEA()
} }
// //
void PreConfigureStyles(X121SetupInputs &inputs) { void PreConfigureStyles(X121SetupInputs &inputs)
{
// //
if (!inputs.IsValid()) { if (!inputs.IsValid())
{
return; return;
} }