This commit is contained in:
2024-06-28 15:52:58 +03:30
parent a0437ad09b
commit 313e75988e
2 changed files with 84 additions and 82 deletions
+76 -76
View File
@@ -4585,6 +4585,9 @@ public:
multiplier++; multiplier++;
} }
//
IncreaseNextSignalsVolume
// //
// Ignore ... // Ignore ...
iSignal.volume = iSignal.volume * multiplier; iSignal.volume = iSignal.volume * multiplier;
@@ -4637,10 +4640,6 @@ public:
// Make State of Signalling to Force State for Recieving // Make State of Signalling to Force State for Recieving
// Signal and Clear their Tp and SL for allowing hedges ... // Signal and Clear their Tp and SL for allowing hedges ...
EQMHandleForceState(signals); EQMHandleForceState(signals);
if (mForce)
{
result = true;
}
// //
DoHedge(); DoHedge();
@@ -4953,6 +4952,7 @@ private:
double mTPPoint; // TP Point double mTPPoint; // TP Point
double mSLPoint; // SL Point double mSLPoint; // SL Point
int mMaxAllowedTrades; // Max Alloed Positions int mMaxAllowedTrades; // Max Alloed Positions
bool mIncreaseNextSignalsVolume; // Increase Next Signals Volume
bool mUseMaxAllowedPerDirection; // Use Max Allowed Positions Per Direction bool mUseMaxAllowedPerDirection; // Use Max Allowed Positions Per Direction
bool mIgnoreTP; // Ignore Calculated TP bool mIgnoreTP; // Ignore Calculated TP
bool mIgnoreSL; // Ignore Calculated SL bool mIgnoreSL; // Ignore Calculated SL
@@ -5243,91 +5243,91 @@ private:
{ {
// //
// Validate Force Marigin ... // Validate Force Marigin ...
double marigin = mTrader.mAccount.GetMargin(); // double marigin = mTrader.mAccount.GetMargin();
double minFreeMarigin = MinFreeMargingForOpenTrades(); // double minFreeMarigin = MinFreeMargingForOpenTrades();
double forceMargin = 3 * minFreeMarigin; // TODO: Make It Configurable // double forceMargin = 3 * minFreeMarigin; // TODO: Make It Configurable
// //
// Retrieving Positions ... // Retrieving Positions ...
XPosition positions[]; // XPosition positions[];
int positionsCount = mTrader.GetPositions(positions); // int positionsCount = mTrader.GetPositions(positions);
if (!IsValidSize(positionsCount)) // if (!IsValidSize(positionsCount))
{ // {
// // //
mForce = false; // mForce = false;
// // //
datetime cTime = TimeCurrent(); // datetime cTime = TimeCurrent();
string message = "Exit From Force State: " + ToString(cTime); // string message = "Exit From Force State: " + ToString(cTime);
// // //
// Log(message); // // Log(message);
return; // return;
} // }
// // //
XPosition oldest; // XPosition oldest;
int oldestAge = GetOldest( // int oldestAge = GetOldest(
oldest, // oldest,
positions // // positions //
); // );
// // //
// Check Force State ... // // Check Force State ...
bool isForce = marigin >= forceMargin && oldestAge >= 288; // bool isForce = marigin >= forceMargin && oldestAge >= 288;
if (!isForce) // if (!isForce)
{ // {
// // //
if (mForce) // if (mForce)
{ // {
// // //
mForce = false; // mForce = false;
// // //
datetime cTime = TimeCurrent(); // datetime cTime = TimeCurrent();
string message = "Exit From Force State: " + ToString(cTime); // string message = "Exit From Force State: " + ToString(cTime);
// // //
// Log(message); // // Log(message);
} // }
return; // return;
} // }
else // else
{ // {
mForce = true; // mForce = true;
} // }
// // //
// Prevent Moving Forward From Non Force State ... // // Prevent Moving Forward From Non Force State ...
if (!mForce) // if (!mForce)
{ // {
return; // return;
} // }
// // //
double minProfitPerTrade = MinProfitPerTrade(); // double minProfitPerTrade = MinProfitPerTrade();
double minProfitPerVolumeFactor = MinProfitPerVolumeFactor(); // double minProfitPerVolumeFactor = MinProfitPerVolumeFactor();
// // //
double profit = SpecifiedCalculatePositionsProfit(positions); // double profit = SpecifiedCalculatePositionsProfit(positions);
double requiredProfit = SpecifiedCalculateRequiredProfitForHedge( // double requiredProfit = SpecifiedCalculateRequiredProfitForHedge(
positions, // positions,
minProfitPerTrade, // minProfitPerTrade,
minProfitPerVolumeFactor // // minProfitPerVolumeFactor //
); // );
// // //
XSymbolPositions symbolPositions[]; // XSymbolPositions symbolPositions[];
int symbolPositionsCount = ExtractSymbolPositions( // int symbolPositionsCount = ExtractSymbolPositions(
positions, // positions,
symbolPositions, // symbolPositions,
minProfitPerTrade, // minProfitPerTrade,
minProfitPerVolumeFactor // // minProfitPerVolumeFactor //
); // );
if (!IsValidSize(symbolPositionsCount)) // if (!IsValidSize(symbolPositionsCount))
{ // {
return; // return;
} // }
// //
// Log("symbolPositionsCount: " + ToString(symbolPositionsCount)); // Log("symbolPositionsCount: " + ToString(symbolPositionsCount));
+7 -5
View File
@@ -51,7 +51,7 @@ input bool x121EAAllowLong = true;
input bool x121EAAllowShort = true; // Allow Short Trades input bool x121EAAllowShort = true; // Allow Short Trades
input bool x121EAExecuteSignalsOnBreakout = false; // Execute Signals On Breakouts input bool x121EAExecuteSignalsOnBreakout = false; // Execute Signals On Breakouts
input int x121EADelayBetweenTwoSignal = 10; // Delay Between two Same Signals input int x121EADelayBetweenTwoSignal = 10; // Delay Between two Same Signals
input int x121EAReuiredSignalVerifications = 3; // Required Verifications for Signals input int x121EAReuiredSignalVerifications = 4; // Required Verifications for Signals
input bool x121EAGetVerificationFromOtherTimeFrames = true; // Get Verifications from Other Time Frames input bool x121EAGetVerificationFromOtherTimeFrames = true; // Get Verifications from Other Time Frames
// //
@@ -61,10 +61,11 @@ input double x121EAVolume = 0.01; // Static Volume
input double x121EATPPoint = 1000; // TP Point input double x121EATPPoint = 1000; // TP Point
input double x121EASLPoint = 1000; // SL Point input double x121EASLPoint = 1000; // SL Point
input int x121EAMaxAllowedTrades = 0; // Max Allowed Positions Per Symbol input int x121EAMaxAllowedTrades = 0; // Max Allowed Positions Per Symbol
input bool x121EAIncreaseNextSignalsVolume = false; // Increase Next Signals Volume
input int x121EAMinFreeMargingForOpenTrades = 900; // Min Margin For Opening Trades input int x121EAMinFreeMargingForOpenTrades = 900; // Min Margin For Opening Trades
input bool x121EAUseMaxAllowedPerDirection = true; // Use Max Allowed Positions Per Direction input bool x121EAUseMaxAllowedPerDirection = true; // Use Max Allowed Positions Per Direction
input bool x121EAIgnoreSL = true; // Ignore Calculated SL input bool x121EAIgnoreSL = false; // Ignore Calculated SL
input bool x121EAIgnoreTP = true; // Ignore Calculated TP input bool x121EAIgnoreTP = false; // Ignore Calculated TP
// //
// Protection ... // Protection ...
@@ -76,8 +77,8 @@ input bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
// //
input group "Trailling"; input group "Trailling";
input bool x121EAAllowTrailStop = false; // Enable Trailling Stop Losses input bool x121EAAllowTrailStop = true; // Enable Trailling Stop Losses
input bool x121EADisableTrailingWhenOpposit = false; // Disable Trailling When has Opposite In Drawdown input bool x121EADisableTrailingWhenOpposit = true; // Disable Trailling When has Opposite In Drawdown
input double x121EAFirstTrailDistance = 100; // Start Trailling Distance input double x121EAFirstTrailDistance = 100; // Start Trailling Distance
input double x121EAFirstTrailPoint = 60; // First Stop Trail input double x121EAFirstTrailPoint = 60; // First Stop Trail
input double x121EANextTrailDistance = 50; // Next Trailling Distance input double x121EANextTrailDistance = 50; // Next Trailling Distance
@@ -325,6 +326,7 @@ bool InitialEA()
x121EA.IgnoreSL(x121EAIgnoreSL); x121EA.IgnoreSL(x121EAIgnoreSL);
x121EA.IgnoreTP(x121EAIgnoreTP); x121EA.IgnoreTP(x121EAIgnoreTP);
x121EA.MaxAllowedTrades(x121EAMaxAllowedTrades); x121EA.MaxAllowedTrades(x121EAMaxAllowedTrades);
x121EA.IncreaseNextSignalsVolume(x121EAIncreaseNextSignalsVolume);
x121EA.UseMaxAllowedPerDirection(x121EAUseMaxAllowedPerDirection); x121EA.UseMaxAllowedPerDirection(x121EAUseMaxAllowedPerDirection);
x121EA.MinFreeMargingForOpenTrades(x121EAMinFreeMargingForOpenTrades); x121EA.MinFreeMargingForOpenTrades(x121EAMinFreeMargingForOpenTrades);