This commit is contained in:
2025-05-06 21:22:41 +03:30
parent 50a6c60b9f
commit 8258c7a7ef
3 changed files with 339 additions and 44 deletions
+76 -43
View File
@@ -122,8 +122,8 @@ class XCXCAEASignaller : XCBase
//
inputs.x3maInputs.showFast = true;
inputs.x3maInputs.showSlow = false;
inputs.x3maInputs.showMedium = false;
inputs.x3maInputs.showSlow = true;
inputs.x3maInputs.showMedium = true;
//
inputs.caInputs.showMAH = true;
@@ -141,8 +141,8 @@ class XCXCAEASignaller : XCBase
//
inputs.caInputs.showKI = false;
inputs.caInputs.showTKI = false;
inputs.caInputs.showVidya = false;
inputs.caInputs.showTrend = false;
inputs.caInputs.showVidya = true;
inputs.caInputs.showTrend = true;
inputs.caInputs.showPeakAndValeGolden = false;
inputs.caInputs.showSupportAndResistance = false;
@@ -520,6 +520,7 @@ class XCXCAEASignaller : XCBase
// Prepare Conditions ...
mConditions.symbol = symbol;
mConditions.period = period;
mConditions.time = zBar.time;
//
double spread = GetSpread(symbol);
@@ -568,6 +569,7 @@ class XCXCAEASignaller : XCBase
// Filling ...
mConditions.sl = sl;
mConditions.tp = tp;
mConditions.reward = tpReward;
mConditions.pivot =
isBullish
? sl
@@ -659,12 +661,16 @@ class XCXCAEASignaller : XCBase
*/
bool DetectSignalTrigger(
XCAEAStrategyConditions &conditions,
int maxAllowedSetupAge = 60 //
int barIndex = 0,
int maxAllowedSetupAge = 200 //
)
{
//
bool result = false;
//
barIndex = NormalizeInt(barIndex, 0);
//
result = conditions.IsSetuped();
if (!result)
@@ -709,51 +715,66 @@ class XCXCAEASignaller : XCBase
}
//
// Checking Breakeout or Rejection ...
//
XOHCL cBar;
result = cBar.Init(
conditions.symbol,
conditions.period,
cIndex //
// Checking Trigger Conditions ...
double sls[];
ENUM_X_DIRECTION triggerDir;
bool canTriggerCond1 = CanTriggerCond1(
helper,
conditions.signalBox,
triggerDir,
sls,
barIndex //
);
if (!result)
{
//
cBar.Clean();
//
return result;
}
//
// Retrieving Conditions ...
XCAEAConditions helperConditions;
result = helper.GetConditions(
helperConditions,
cIndex,
5 //
// Update Signal Box To ...
conditions.signalBox.to = cTime;
//
isBullish = IsBullish(triggerDir);
isBearish = IsBearish(triggerDir);
//
// Try To Draw Signal Box ...
XCBoxObject *iObj;
helper.poiDrawer.DrawBox(
conditions.signalBox,
iObj //
);
if (!result)
{
//
cBar.Clean();
conditions.Clean();
//
return result;
}
//
// Checking Breakeout or Rejection ...
// TODO: Handle this ...
bool isBreakeout = false;
ZeroMemory(iObj);
//
result = canTriggerCond1;
if (result)
{
//
// Reconfigure Position TP/SL Entry and etc ...
//
double entry = GetEntry(
conditions.symbol,
triggerDir //
);
conditions.entry = entry;
//
double slsMax = GetMax(sls);
double slsMin = GetMin(sls);
double sl = isBullish
? slsMin
: slsMax;
//
double risk = MathAbs(entry - sl);
double tp =
isBullish
? entry + (risk * conditions.reward)
: entry - (risk * conditions.reward);
//
conditions.sl = sl;
conditions.tp = tp;
conditions.dir = triggerDir;
conditions.triggerTime = cTime;
conditions.type = isBullish
? X_POSITION_TYPE_LONG
@@ -762,12 +783,24 @@ class XCXCAEASignaller : XCBase
//
}
//
// Validating Conditions if not Triggered ...
if (!result)
{
//
int age = conditions.GetSetupAge();
bool has = age <= maxAllowedSetupAge;
if (!has)
{
conditions.Clean();
}
}
//
// Cleanup ...
//
cBar.Clean();
conditions.Clean();
Clean(sls);
//
return result;