Apply Fix on Signal Delays ...

This commit is contained in:
2024-09-23 07:48:38 +03:30
parent 8fc750a954
commit 64fc1fb319
4 changed files with 627 additions and 0 deletions
+21
View File
@@ -195,6 +195,7 @@ string mTag = "";
//
double eaR2R = 1.5;
datetime lastSignalOn = NULL;
bool eaUseFixedTPSLPoints = true;
//
@@ -1002,6 +1003,20 @@ void OnSignalRecieved(
)
: conditionsSummary;
//
// Check Signal Delay ...
datetime currentTime = TimeCurrent();
int delay = eaDelayBarBetweenTwoSameSignal;
bool isDelayPassed = delay <= 0
? true
: !IsValid(lastSignalOn)
? true
: MathAbs(TimeToSeconds(currentTime)) - MathAbs(TimeToSeconds(lastSignalOn)) >= ulong(delay * PeriodSeconds(_Period));
if (!isDelayPassed)
{
return;
}
//
// Execute Signal Using Trade Handler ...
ENUM_X_SIGNAL_EXECUTION_RESULT state;
@@ -1009,6 +1024,12 @@ void OnSignalRecieved(
signal,
state //
);
//
if (isExecuted)
{
lastSignalOn = currentTime;
}
}
//