This commit is contained in:
2025-05-18 22:24:56 +03:30
parent 1c6a60cf1a
commit d07575cf8f
2 changed files with 602 additions and 148 deletions
+468 -128
View File
@@ -196,6 +196,7 @@ class XCXCAEASignaller : XCBase
int zIndex = 0;
bool has = false;
int loopback = 10;
int cIndex = zIndex + 1;
bool isBullish = false;
bool isBearish = false;
@@ -244,7 +245,7 @@ class XCXCAEASignaller : XCBase
//
// Check Decision Zone Detection Based On Several Signalling ...
//
// Analyse DecisionZone ...
// In this Used Case we fond an Analyse TF OB
@@ -277,7 +278,297 @@ class XCXCAEASignaller : XCBase
// In this Used Case we found a Tigger Block and use it
// for Triggering ...
if (!hasDecisionZone &&
allowTriggerBlockDecisionZoneSignalling) {
allowTriggerBlockDecisionZoneSignalling)
{
//
int pushers = 0;
//
// We Can Detect Multiple Decision Zones ...
XBoxZone tmpZone;
XCAEATriggerBlockConfiguration config;
//
// Full Filteres ...
config.ConfigureFullFilter();
bool hasFullFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasFullFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureSarRsiAdxFilter();
bool hasSarRsiAdxFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarRsiAdxFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureSarRsiTrendFilter();
bool hasSarRsiTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarRsiTrendFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureSarAdxTrendFilter();
bool hasSarAdxTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarAdxTrendFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureRsiAdxTrendFilter();
bool hasRsiAdxTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasRsiAdxTrendFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureSarRsiFilter();
bool hasSarRsiFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarRsiFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureSarAdxFilter();
bool hasSarAdxFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarAdxFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureSarTrendFilter();
bool hasSarTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarTrendFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureRsiAdxFilter();
bool hasRsiAdxFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasRsiAdxFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureRsiTrendFilter();
bool hasRsiTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasRsiTrendFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureAdxTrendFilter();
bool hasAdxTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasAdxTrendFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
hasDecisionZone =
hasSarRsiFiltered ||
hasSarAdxFiltered ||
hasRsiAdxFiltered ||
hasSarTrendFiltered ||
hasRsiTrendFiltered ||
hasAdxTrendFiltered ||
hasSarRsiAdxFiltered ||
hasSarRsiTrendFiltered ||
hasSarAdxTrendFiltered ||
hasRsiAdxTrendFiltered;
//
if (hasDecisionZone)
{
//
drawer.DrawBox(
decisionZone,
cTime,
false, // Draw Middle ...
true // Ignore Type ...
);
//
Print(ToString(decisionZone.dir) + " Trigger Block Detected (" + ToString(pushers) + ") ...");
}
//
}
@@ -285,6 +576,9 @@ class XCXCAEASignaller : XCBase
// Make Signal Box UnAvailable ...
if (hasDecisionZone)
{
//
decisionZoneDir = decisionZone.dir;
//
AddRef(
decisionZone,
@@ -428,152 +722,185 @@ class XCXCAEASignaller : XCBase
int fromIDX = conditions.decisionZone.FromIndex();
//
// Check Box Size ...
double maxAllowedBoxRange = 400;
double range = conditions.decisionZone.GetRange();
bool isTooLarge = range > (maxAllowedBoxRange * points);
double decisionMiddlePrice = conditions.decisionZone.GetMid();
bool isAnalyseSignalled =
conditions.decisionZone.period == analyseHelper.GetPeriod();
//
// Draw Decision Zone ...
if (allowDraws)
{
//
drawer.DrawBox(
conditions.decisionZone,
cTime,
true, // Draw Middle Line ...
true // Ignore Type ...
);
}
ENUM_XCAEA_TIGGER_TYPE decisionZoneType = GetType(conditions.decisionZone.type);
bool isTriggerBlockSignalled = IsValid(decisionZoneType);
//
// Detect Required Pivots ...
XBoxZone decisionPivots[];
ENUM_XCA_PIVOTS allowedTypes[];
if (isBullish)
// Looking for Analyse Helper Triggers ...
if (isAnalyseSignalled &&
allowAnalyseDecisionZoneSignalling)
{
//
Add(
XCA_OB_BULL,
allowedTypes //
);
}
else
{
//
Add(
XCA_OB_BEAR,
allowedTypes //
);
}
Add(
XCA_PEAK,
allowedTypes //
);
Add(
XCA_VALE,
allowedTypes //
);
int decisionPivotsCount = detector.FillPivots(
conditions.decisionZone,
decisionPivots,
unavailables,
allowedTypes,
cTime //
);
// Trigger Analyse Signal ...
//
// Draw Pivots of Decision Zone only when
// it's Too Large ...
if (false &&
allowDraws &&
isTooLarge &&
HasChild(decisionPivots))
{
//
for (int i = 0; i < decisionPivotsCount; i++)
// Check Box Size ...
double maxAllowedBoxRange = 400;
double range = conditions.decisionZone.GetRange();
bool isTooLarge = range > (maxAllowedBoxRange * points);
double decisionMiddlePrice = conditions.decisionZone.GetMid();
//
// Detect Required Pivots ...
XBoxZone decisionPivots[];
ENUM_XCA_PIVOTS allowedTypes[];
if (isBullish)
{
//
drawer.DrawBox(
decisionPivots[i],
cTime,
false, // Draw Middle ...
true // Ignore Type ...
Add(
XCA_OB_BULL,
allowedTypes //
);
}
}
//
// Define a Temparory Objects
// Array instance for Holding Drawn Objects ...
CArrayObj *iObjects;
iObjects = new CArrayObj();
//
// Check Different Trigger Conditions ...
//
// Checking Trigger Cond 0 ...
bool canTriggerCond0 = false;
//
// Checking Trigger Cond 1 ...
bool canTriggerCond1 = false;
if (isTooLarge)
{
//
canTriggerCond1 = CanTriggerCond1(
helper,
else
{
//
Add(
XCA_OB_BEAR,
allowedTypes //
);
}
Add(
XCA_PEAK,
allowedTypes //
);
Add(
XCA_VALE,
allowedTypes //
);
int decisionPivotsCount = detector.FillPivots(
conditions.decisionZone,
decisionPivots,
triggerDir,
sl,
targets,
allowDraws,
iObjects,
barIndex //
unavailables,
allowedTypes,
cTime //
);
}
//
// Checking Trigger Cond 2 ...
bool canTriggerCond2 = false;
if (!isTooLarge)
//
// Draw Pivots of Decision Zone only when
// it's Too Large ...
if (false &&
allowDraws &&
isTooLarge &&
HasChild(decisionPivots))
{
//
for (int i = 0; i < decisionPivotsCount; i++)
{
//
drawer.DrawBox(
decisionPivots[i],
cTime,
false, // Draw Middle ...
true // Ignore Type ...
);
}
}
//
// Define a Temparory Objects
// Array instance for Holding Drawn Objects ...
CArrayObj *iObjects;
iObjects = new CArrayObj();
//
// Check Different Trigger Conditions ...
//
// Checking Trigger Cond 0 ...
bool canTriggerCond0 = false;
//
// Checking Trigger Cond 1 ...
bool canTriggerCond1 = false;
if (isTooLarge)
{
//
canTriggerCond1 = CanTriggerCond1(
helper,
conditions.decisionZone,
decisionPivots,
triggerDir,
sl,
targets,
allowDraws,
iObjects,
barIndex //
);
}
//
// Checking Trigger Cond 2 ...
bool canTriggerCond2 = false;
if (!isTooLarge)
{
//
canTriggerCond2 = CanTriggerCond2(
helper,
conditions.decisionZone,
decisionPivots,
triggerDir,
sl,
targets,
allowDraws,
iObjects,
barIndex //
);
}
//
// Checking Trigger Cond 3 ...
bool canTriggerCond3 = false;
//
// Adding Drawn Objects to Drawn Stores ...
for (int i = 0; i < iObjects.Total(); i++)
{
mObjects.Add(iObjects.At(i));
}
//
// Summarizing Result ...
result =
canTriggerCond0 ||
canTriggerCond1 ||
canTriggerCond2 ||
canTriggerCond3;
}
else if (isTriggerBlockSignalled &&
allowTriggerBlockDecisionZoneSignalling)
{
//
canTriggerCond2 = CanTriggerCond2(
helper,
conditions.decisionZone,
decisionPivots,
triggerDir,
sl,
targets,
allowDraws,
iObjects,
barIndex //
);
// Trigger TRIGGER Block Signal ...
//
// since we have to Trigger all TRIGGER Block's Signals
// exactly on Setting ups ...
result = isBullish ||
isBearish;
if (result)
{
//
triggerDir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
sl =
isBullish
? conditions.decisionZone.lower
: conditions.decisionZone.upper;
//
conditions.reward = 2;
}
}
//
// Checking Trigger Cond 3 ...
bool canTriggerCond3 = false;
//
// Adding Drawn Objects to Drawn Stores ...
for (int i = 0; i < iObjects.Total(); i++)
{
mObjects.Add(iObjects.At(i));
}
//
// Summarizing Result ...
result =
canTriggerCond0 ||
canTriggerCond1 ||
canTriggerCond2 ||
canTriggerCond3;
//
isBullish = result &&
IsBullish(triggerDir);
@@ -584,6 +911,19 @@ class XCXCAEASignaller : XCBase
// Configure Conditions for Preparing Signal ...
if (result)
{
//
// Draw Decision Zone ...
if (allowDraws)
{
//
drawer.DrawBox(
conditions.decisionZone,
cTime,
true, // Draw Middle Line ...
true // Ignore Type ...
);
}
//
// Reconfigure Position TP/SL Entry and etc ...