This commit is contained in:
2025-05-08 00:37:18 +03:30
parent 497840f56b
commit 6b95e10890
4 changed files with 59 additions and 32 deletions
+19 -18
View File
@@ -53,13 +53,16 @@ input double eaConstantBalance = 0.0; // Constant Ba
//
// Management ...
input group "Management";
input bool eaAllowTrade = true; // Allow Trade on Signals
input bool eaAllowLongs = true; // Allow Long Trades
input bool eaAllowShorts = true; // Allow Short Trades
input int eaMaxAllowedTradesPerDay = 3; // Max Allowed Trades per Day
input int eaMaxAllowedSLsPerDay = 2; // Max Allowed SL(s) per Day
input string eaSessionStartTime = ""; // Trade Start Time
input string eaSessionEndTime = ""; // Trade End Time
input bool eaAllowTrade = true; // Allow Trade on Signals
input bool eaAllowLongs = true; // Allow Long Trades
input bool eaAllowShorts = true; // Allow Short Trades
input int eaMaxAllowedTradesPerDay = 3; // Max Allowed Trades per Day
input int eaMaxAllowedSLsPerDay = 2; // Max Allowed SL(s) per Day
input string eaSessionStartTime = ""; // Trade Start Time
input string eaSessionEndTime = ""; // Trade End Time
input int eaMaxAllowedPositions = 5; // Max Allowed Same Time Trades
input double eaMaxAllowedSpread = 25; // Max Allowed Spread For Trade
input double eaMaxAllowedDrawdownFactor = 0.3; // Max Allowed DrawDown for Trade
//
// Alert ...
@@ -95,11 +98,6 @@ XCXCAEASignaller *eaSignaller;
XCXCAEATradeManager *eaTradeManager;
XCAEAStrategyConditions eaConditions;
//
int eaMaxAllowedPositions = 5;
double eaMaxAllowedSpread = 25;
double eaMaxAllowedDrawdownFactor = 0.3;
//
string eaTag = "";
@@ -184,6 +182,15 @@ void OnTick()
int count = 0;
bool has = false;
//
if (eaTimeTracker.IsNewDay())
{
eaTradeManager.HandleNewDay();
}
//
HandleTimeReport();
//
// Handle Position Management / Protections ...
eaTradeManager.Manage();
@@ -383,12 +390,6 @@ void OnTick()
eaSignal,
eaConditions //
);
if (has)
{
//
// Do What we Want on Successfully Execution Signal ...
Print("Signal Executed ...");
}
//
eaSignal.Clean();
+7 -3
View File
@@ -1137,7 +1137,7 @@ struct XSignal
//
// TP ...
double fullTPLevel; // Full TP ...
bool isPartiallyClosed; // Check Partially Closed Before or not ...
bool isPartiallyClosed; // Check Partially Closed Before or not ...
double partialCloseMultiplier; // Amount of Partial Close ...
double partialCloseOnTPLevel; // Do Partial Close on TP Level ...
@@ -2087,7 +2087,7 @@ struct XSignal
}
//
string GetMessage()
string GetMessage(string action = NULL)
{
//
string result = NULL;
@@ -2100,7 +2100,11 @@ struct XSignal
//
result = ToString(type) +
" Signal Provided by: " + provider +
" Signal" +
(!IsValid(action)
? ""
: " " + action) +
" by: " + provider +
" on (" + symbol + ")" +
" in: " + ToString(period);
+33 -2
View File
@@ -711,6 +711,15 @@ class XCXCAEATradeManager : public XCBaseAlert
//
// Do Partial Closing ...
double volume = iPosition.volume * volumeMultiplier;
//
// Normalizing Volume ...
volume = NormalizeVolume(
volume,
iPosition.symbol //
);
//
string comment = "PC On Target ...";
has = trader.ClosePartial(
iPosition.ticket,
@@ -772,7 +781,7 @@ class XCXCAEATradeManager : public XCBaseAlert
if (reportSignals)
{
//
string message = signal.GetMessage();
string message = signal.GetMessage("Provided");
Alert(message);
}
@@ -885,7 +894,20 @@ class XCXCAEATradeManager : public XCBaseAlert
{
//
string executionMessage = ToString(executionResult);
Alert(executionMessage);
//
string message = NULL;
if (result)
{
message = signal.GetMessage("Executed");
}
else
{
message = signal.GetMessage("Failed due (" + executionMessage + ")");
}
//
Alert(message);
}
//
@@ -1092,6 +1114,15 @@ class XCXCAEATradeManager : public XCBaseAlert
{
}
/**
* Handle New Day ...
*/
void HandleNewDay()
{
//
// Clean Managed SL(s) and TP(s) and Positions ...
}
/**
* Find Executed Trade by Providing Position Ticket ...
*
-9
View File
@@ -1505,9 +1505,6 @@ bool CanTriggerCond0(
dir = canTriggerLong
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
Print("Triggered ...");
}
//
@@ -1628,9 +1625,6 @@ bool CanTriggerCond1(
dir = canTriggerLong
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
Print("Triggered ...");
}
//
@@ -1731,9 +1725,6 @@ bool CanTriggerCond2(
dir = canTriggerLong
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
Print("Triggered ...");
}
//