transfer important area and its related methods and Properties to XStrategy class ...

This commit is contained in:
2024-07-30 04:08:56 +03:30
parent 3b91398e2d
commit 87c0487022
3 changed files with 737 additions and 760 deletions
+25 -4
View File
@@ -307,12 +307,12 @@ bool InitialEA()
eaSlippage,
eaMagicNumber,
true, // Ignore Signal Execution
true, // Use TP SL Point
false, // Use TP SL Point
false, // Use Max
eaTPPoint, // TP
eaSLPoint, // SL
eaIgnoreTP,
true, // eaIgnoreSL,
false, // eaIgnoreSL,
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
@@ -447,6 +447,23 @@ void HandleTradeState()
// Analyzing ...
void OnSignalRecieved(XSignal &signal)
{
//
if (!signal.IsValid())
{
return;
}
//
bool isLong = IsLong(signal.type);
//
// Check Allow Trade Type ...
if ((isLong && !eaAllowLong) ||
(!isLong && !eaAllowShort))
{
return;
}
//
// Check Max Allowed ...
if (eaMaxAllowedLongs > 0 || eaMaxAllowedShorts > 0)
@@ -480,8 +497,12 @@ void OnSignalRecieved(XSignal &signal)
int shortsCount = ArraySize(shorts);
//
if ((eaMaxAllowedLongs > 0 && longsCount >= eaMaxAllowedLongs) ||
(eaMaxAllowedShorts > 0 && shortsCount >= eaMaxAllowedShorts))
if ((isLong &&
eaMaxAllowedLongs > 0 &&
longsCount >= eaMaxAllowedLongs) ||
(!isLong &&
eaMaxAllowedShorts > 0 &&
shortsCount >= eaMaxAllowedShorts))
{
return;
}