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
+77 -77
View File
@@ -4543,7 +4543,7 @@ public:
}
}
//
//
// Multiply Signal Volume ...
if (isSignalValid)
{
@@ -4585,6 +4585,9 @@ public:
multiplier++;
}
//
IncreaseNextSignalsVolume
//
// Ignore ...
iSignal.volume = iSignal.volume * multiplier;
@@ -4637,10 +4640,6 @@ public:
// Make State of Signalling to Force State for Recieving
// Signal and Clear their Tp and SL for allowing hedges ...
EQMHandleForceState(signals);
if (mForce)
{
result = true;
}
//
DoHedge();
@@ -4953,6 +4952,7 @@ private:
double mTPPoint; // TP Point
double mSLPoint; // SL Point
int mMaxAllowedTrades; // Max Alloed Positions
bool mIncreaseNextSignalsVolume; // Increase Next Signals Volume
bool mUseMaxAllowedPerDirection; // Use Max Allowed Positions Per Direction
bool mIgnoreTP; // Ignore Calculated TP
bool mIgnoreSL; // Ignore Calculated SL
@@ -5243,91 +5243,91 @@ private:
{
//
// Validate Force Marigin ...
double marigin = mTrader.mAccount.GetMargin();
double minFreeMarigin = MinFreeMargingForOpenTrades();
double forceMargin = 3 * minFreeMarigin; // TODO: Make It Configurable
// double marigin = mTrader.mAccount.GetMargin();
// double minFreeMarigin = MinFreeMargingForOpenTrades();
// double forceMargin = 3 * minFreeMarigin; // TODO: Make It Configurable
//
// Retrieving Positions ...
XPosition positions[];
int positionsCount = mTrader.GetPositions(positions);
if (!IsValidSize(positionsCount))
{
//
mForce = false;
// XPosition positions[];
// int positionsCount = mTrader.GetPositions(positions);
// if (!IsValidSize(positionsCount))
// {
// //
// mForce = false;
//
datetime cTime = TimeCurrent();
string message = "Exit From Force State: " + ToString(cTime);
// //
// datetime cTime = TimeCurrent();
// string message = "Exit From Force State: " + ToString(cTime);
//
// Log(message);
return;
}
// //
// // Log(message);
// return;
// }
//
XPosition oldest;
int oldestAge = GetOldest(
oldest,
positions //
);
// //
// XPosition oldest;
// int oldestAge = GetOldest(
// oldest,
// positions //
// );
//
// Check Force State ...
bool isForce = marigin >= forceMargin && oldestAge >= 288;
if (!isForce)
{
//
if (mForce)
{
//
mForce = false;
// //
// // Check Force State ...
// bool isForce = marigin >= forceMargin && oldestAge >= 288;
// if (!isForce)
// {
// //
// if (mForce)
// {
// //
// mForce = false;
//
datetime cTime = TimeCurrent();
string message = "Exit From Force State: " + ToString(cTime);
// //
// datetime cTime = TimeCurrent();
// string message = "Exit From Force State: " + ToString(cTime);
//
// Log(message);
}
return;
}
else
{
mForce = true;
}
// //
// // Log(message);
// }
// return;
// }
// else
// {
// mForce = true;
// }
//
// Prevent Moving Forward From Non Force State ...
if (!mForce)
{
return;
}
// //
// // Prevent Moving Forward From Non Force State ...
// if (!mForce)
// {
// return;
// }
//
double minProfitPerTrade = MinProfitPerTrade();
double minProfitPerVolumeFactor = MinProfitPerVolumeFactor();
// //
// double minProfitPerTrade = MinProfitPerTrade();
// double minProfitPerVolumeFactor = MinProfitPerVolumeFactor();
//
double profit = SpecifiedCalculatePositionsProfit(positions);
double requiredProfit = SpecifiedCalculateRequiredProfitForHedge(
positions,
minProfitPerTrade,
minProfitPerVolumeFactor //
);
// //
// double profit = SpecifiedCalculatePositionsProfit(positions);
// double requiredProfit = SpecifiedCalculateRequiredProfitForHedge(
// positions,
// minProfitPerTrade,
// minProfitPerVolumeFactor //
// );
//
XSymbolPositions symbolPositions[];
int symbolPositionsCount = ExtractSymbolPositions(
positions,
symbolPositions,
minProfitPerTrade,
minProfitPerVolumeFactor //
);
if (!IsValidSize(symbolPositionsCount))
{
return;
}
// //
// XSymbolPositions symbolPositions[];
// int symbolPositionsCount = ExtractSymbolPositions(
// positions,
// symbolPositions,
// minProfitPerTrade,
// minProfitPerVolumeFactor //
// );
// if (!IsValidSize(symbolPositionsCount))
// {
// return;
// }
//
// 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 x121EAExecuteSignalsOnBreakout = false; // Execute Signals On Breakouts
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
//
@@ -61,10 +61,11 @@ input double x121EAVolume = 0.01; // Static Volume
input double x121EATPPoint = 1000; // TP Point
input double x121EASLPoint = 1000; // SL Point
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 bool x121EAUseMaxAllowedPerDirection = true; // Use Max Allowed Positions Per Direction
input bool x121EAIgnoreSL = true; // Ignore Calculated SL
input bool x121EAIgnoreTP = true; // Ignore Calculated TP
input bool x121EAIgnoreSL = false; // Ignore Calculated SL
input bool x121EAIgnoreTP = false; // Ignore Calculated TP
//
// Protection ...
@@ -76,8 +77,8 @@ input bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
//
input group "Trailling";
input bool x121EAAllowTrailStop = false; // Enable Trailling Stop Losses
input bool x121EADisableTrailingWhenOpposit = false; // Disable Trailling When has Opposite In Drawdown
input bool x121EAAllowTrailStop = true; // Enable Trailling Stop Losses
input bool x121EADisableTrailingWhenOpposit = true; // Disable Trailling When has Opposite In Drawdown
input double x121EAFirstTrailDistance = 100; // Start Trailling Distance
input double x121EAFirstTrailPoint = 60; // First Stop Trail
input double x121EANextTrailDistance = 50; // Next Trailling Distance
@@ -325,6 +326,7 @@ bool InitialEA()
x121EA.IgnoreSL(x121EAIgnoreSL);
x121EA.IgnoreTP(x121EAIgnoreTP);
x121EA.MaxAllowedTrades(x121EAMaxAllowedTrades);
x121EA.IncreaseNextSignalsVolume(x121EAIncreaseNextSignalsVolume);
x121EA.UseMaxAllowedPerDirection(x121EAUseMaxAllowedPerDirection);
x121EA.MinFreeMargingForOpenTrades(x121EAMinFreeMargingForOpenTrades);