last working ...

This commit is contained in:
2025-06-04 00:04:32 +03:30
parent 043c635812
commit a7ea212ada
8 changed files with 1784 additions and 288 deletions
+12 -1
View File
@@ -107,6 +107,12 @@ class XCXCATBEAExpert : public XCBase
bool eaAllowSignallingBasedOnTriggerBlocksInsideOther; // Signalling Based on Trigger Blocks Seccond inputs
bool eaSecondsTriggersSLUsingFirstTriggerBlock; // Use First Trigger Block for SL of Seconds Trigger Block Signalss
bool eaApplyValidateAndFilterOnSelectInsideOthers; // Select Trigger Blocks by Applying Validations and Filterss
bool eaAllowSignallingConditions1; // Allow Market Conditions Signaller to Using Sar Starter Signals
bool eaAllowSignallingConditions2; // Allow Market Conditions Signaller to Using Trend Starter Signals
bool eaAllowSignallingConditions3; // Allow Market Conditions Signaller to Using Delta Starter Signals
bool eaAllowSignallingConditions4; // Allow Market Conditions Signaller to Using Volume Starter Signals
bool eaAllowSignallingConditions5; // Allow Market Conditions Signaller to Using Signal Bar Starter Signals
bool eaAllowSignallingConditions6; // Allow Market Conditions Signaller to Using HK Signal Bar Starter Signals
//
// Volume ...
@@ -494,7 +500,12 @@ class XCXCATBEAExpert : public XCBase
iSignallerInputs.signallerConfigs.secondsTriggersSLUsingFirstTriggerBlock = eaSecondsTriggersSLUsingFirstTriggerBlock;
iSignallerInputs.signallerConfigs.applyValidateAndFilterOnSelectInsideOthers = eaApplyValidateAndFilterOnSelectInsideOthers;
iSignallerInputs.signallerConfigs.allowSignallingBasedOnTriggerBlocksInsideOther = eaAllowSignallingBasedOnTriggerBlocksInsideOther;
iSignallerInputs.signallerConfigs.allowSignallingConditions1 = eaAllowSignallingConditions1;
iSignallerInputs.signallerConfigs.allowSignallingConditions2 = eaAllowSignallingConditions2;
iSignallerInputs.signallerConfigs.allowSignallingConditions3 = eaAllowSignallingConditions3;
iSignallerInputs.signallerConfigs.allowSignallingConditions4 = eaAllowSignallingConditions4;
iSignallerInputs.signallerConfigs.allowSignallingConditions5 = eaAllowSignallingConditions5;
iSignallerInputs.signallerConfigs.allowSignallingConditions6 = eaAllowSignallingConditions6;
//
// Prepare Trigger Block Validations ...
@@ -49,6 +49,15 @@ struct XCATBEASignallingConfigs
bool applyValidateAndFilterOnSelectInsideOthers; // Select Trigger Blocks by Applying Validations and Filterss
bool secondsTriggersSLUsingFirstTriggerBlock; // Use First Trigger Block for SL of Seconds Trigger Block Signalss
//
// Market Conditions Signall Providers ...
bool allowSignallingConditions1; // Allow Market Conditions Signaller to Using Sar Starter Signals
bool allowSignallingConditions2; // Allow Market Conditions Signaller to Using Trend Starter Signals
bool allowSignallingConditions3; // Allow Market Conditions Signaller to Using Delta Starter Signals
bool allowSignallingConditions4; // Allow Market Conditions Signaller to Using Volume Starter Signals
bool allowSignallingConditions5; // Allow Market Conditions Signaller to Using Signal Bar Starter Signals
bool allowSignallingConditions6; // Allow Market Conditions Signaller to Using HK Signal Bar Starter Signals
//
// Constructor ...
XCATBEASignallingConfigs()
@@ -71,6 +80,14 @@ struct XCATBEASignallingConfigs
//
secondsTriggersSLUsingFirstTriggerBlock = false;
applyValidateAndFilterOnSelectInsideOthers = false;
//
allowSignallingConditions1 = false;
allowSignallingConditions2 = false;
allowSignallingConditions3 = false;
allowSignallingConditions4 = false;
allowSignallingConditions5 = false;
allowSignallingConditions6 = false;
}
};
@@ -163,6 +180,15 @@ class XCXCATBEASignaller : XCBase
bool secondsTriggersSLUsingFirstTriggerBlock; // Use First Trigger Block for SL of Seconds Trigger Block Signalss
bool applyValidateAndFilterOnSelectInsideOthers; // Select Trigger Blocks by Applying Validations and Filterss
//
// Market Conditions Signall Providers ...
bool allowSignallingConditions1; // Allow Market Conditions Signaller to Using Sar Starter Signals
bool allowSignallingConditions2; // Allow Market Conditions Signaller to Using Trend Starter Signals
bool allowSignallingConditions3; // Allow Market Conditions Signaller to Using Delta Starter Signals
bool allowSignallingConditions4; // Allow Market Conditions Signaller to Using Volume Starter Signals
bool allowSignallingConditions5; // Allow Market Conditions Signaller to Using Signal Bar Starter Signals
bool allowSignallingConditions6; // Allow Market Conditions Signaller to Using HK Signal Bar Starter Signals
//
bool allowDraws; // Allow Draws or not ...
bool allowGuards; // Allow Guards or not ...
@@ -708,6 +734,12 @@ class XCXCATBEASignaller : XCBase
barAnalyser,
mConditions.conditions,
mConditions.pivotZone,
allowSignallingConditions1,
allowSignallingConditions2,
allowSignallingConditions3,
allowSignallingConditions4,
allowSignallingConditions5,
allowSignallingConditions6,
barIndex,
10 // Loopback ...
);
@@ -1494,6 +1526,14 @@ class XCXCATBEASignaller : XCBase
secondsTriggersSLUsingFirstTriggerBlock = inputs.signallerConfigs.secondsTriggersSLUsingFirstTriggerBlock;
applyValidateAndFilterOnSelectInsideOthers = inputs.signallerConfigs.applyValidateAndFilterOnSelectInsideOthers;
//
allowSignallingConditions1 = inputs.signallerConfigs.allowSignallingConditions1;
allowSignallingConditions2 = inputs.signallerConfigs.allowSignallingConditions2;
allowSignallingConditions3 = inputs.signallerConfigs.allowSignallingConditions3;
allowSignallingConditions4 = inputs.signallerConfigs.allowSignallingConditions4;
allowSignallingConditions5 = inputs.signallerConfigs.allowSignallingConditions5;
allowSignallingConditions6 = inputs.signallerConfigs.allowSignallingConditions6;
//
bool has = inputs.IsValid();
if (!has)
+430 -287
View File
@@ -358,6 +358,12 @@ bool DetectSignalZone(
XCBarAnalyser *barAnalyser,
X121XCatbConditions &conditions,
XBoxZone &signalZone,
bool allowSignallingConditions1 = false,
bool allowSignallingConditions2 = false,
bool allowSignallingConditions3 = false,
bool allowSignallingConditions4 = false,
bool allowSignallingConditions5 = false,
bool allowSignallingConditions6 = false,
int barIndex = 0,
int loopback = 10 //
)
@@ -403,12 +409,6 @@ bool DetectSignalZone(
//
int idx = -1;
XBoxZone iPeak;
XBoxZone iVale;
XBoxZone iOBBull;
XBoxZone iOBBear;
XBoxZone iMTBull;
XBoxZone iMTBear;
bool has = false;
bool isBullish = false;
bool isBearish = false;
@@ -425,154 +425,6 @@ bool DetectSignalZone(
ENUM_TIMEFRAMES iPeriod = NULL;
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
//
// Select MT Block ...
if (result)
{
//
// New MT Pivot Detected ...
if (detector.newMTBullishPivotDetected)
{
//
idx = GetYoungest(detector.mtBullishPivots);
if (IsValidIndex(idx))
{
iMTBull = detector.mtBullishPivots[idx];
}
}
else if (detector.newMTBearishPivotDetected)
{
//
idx = GetYoungest(detector.mtBearishPivots);
if (IsValidIndex(idx))
{
iMTBear = detector.mtBearishPivots[idx];
}
}
//
// Draw MT ...
//
// Bullish ...
has = iMTBull.IsValid();
if (has)
{
//
iMTBull.to = conditions.bars[zIDX].time;
//
XCBoxObject *iObj;
has = drawer
.drawer
.DrawBox(
iMTBull,
iObj //
);
if (has)
{
drawer.ApplyMTBullishPivotStyle(iObj);
}
}
//
// Bearish ...
has = iMTBear.IsValid();
if (has)
{
//
iMTBear.to = conditions.bars[zIDX].time;
//
XCBoxObject *iObj;
has = drawer
.drawer
.DrawBox(
iMTBear,
iObj //
);
if (has)
{
drawer.ApplyMTBearishPivotStyle(iObj);
}
}
}
//
// Select Peak and Vale ...
// this used to Signalling Better ...
if (result)
{
//
// Select Peak ...
idx = GetLowest(
conditions.bars[cIDX],
detector.peakPivots //
);
if (IsValidIndex(idx))
{
//
iPeak = detector.peakPivots[idx];
iPeak.to = conditions.bars[zIDX].time;
}
//
// Select Vale ...
idx = GetHighest(
conditions.bars[cIDX],
detector.valePivots //
);
if (IsValidIndex(idx))
{
//
iVale = detector.valePivots[idx];
iVale.to = conditions.bars[zIDX].time;
}
//
// Checkig Result ...
result =
iPeak.IsValid() &&
iVale.IsValid();
//
// Draw Peak and Vales ...
if (result)
{
//
// Object Definitions ...
XCBoxObject *iObj;
//
// Draw Peak ...
has = drawer
.drawer
.DrawBox(
iPeak,
iObj //
);
if (has)
{
drawer.ApplyPeakPivotStyle(iObj);
}
ZeroMemory(iObj);
//
// Draw Vale ...
has = drawer
.drawer
.DrawBox(
iVale,
iObj //
);
if (has)
{
drawer.ApplyValePivotStyle(iObj);
}
ZeroMemory(iObj);
}
}
//
// Signalling ...
if (result)
@@ -959,7 +811,7 @@ bool DetectSignalZone(
// Detect Bar Verifications ...
//
ENUM_X_DIRECTION iDir;
ENUM_X_DIRECTION iBDir;
//
// Rejected ...
@@ -967,14 +819,14 @@ bool DetectSignalZone(
barAnalyser
.IsRejected(
conditions.bars[cIDX],
iDir //
iBDir //
);
bool isBullishRejected =
isRejected &&
IsBullish(iDir);
IsBullish(iBDir);
bool isBearishRejected =
isRejected &&
IsBearish(iDir);
IsBearish(iBDir);
//
// Engulfed ...
@@ -982,14 +834,14 @@ bool DetectSignalZone(
barAnalyser
.IsEngulfed(
conditions.bars[cIDX],
iDir //
iBDir //
);
bool isBullishEngulfed =
isEngulfed &&
IsBullish(iDir);
IsBullish(iBDir);
bool isBearishEngulfed =
isEngulfed &&
IsBearish(iDir);
IsBearish(iBDir);
//
// Momentum ...
@@ -997,14 +849,14 @@ bool DetectSignalZone(
barAnalyser
.IsMomentum(
conditions.bars[cIDX],
iDir //
iBDir //
);
bool isBullishMomentum =
isMomentum &&
IsBullish(iDir);
IsBullish(iBDir);
bool isBearishMomentum =
isMomentum &&
IsBearish(iDir);
IsBearish(iBDir);
//
bool isBarBullishPressured =
@@ -1026,61 +878,69 @@ bool DetectSignalZone(
// Conditions 1:
// --------------
// Descriptions:
// - [] Detect Parabolic Sar Start ...
// - [] Convert is to Box ...
// - [] Detect Parabolic Sar Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond1Bullish =
bool isCond1Bullish = false;
bool isCond1Bearish = false;
if (allowSignallingConditions1)
{
//
// Start ...
(isSarBullishStart &&
!isSarBearishStart) &&
//
// SCORE ...
isScoreBullish &&
//
// BAR ...
isBarBullishPressured &&
//
// KI ...
// conditions.isKIUp &&
conditions.isKIBullish &&
//
// ATR ...
conditions.isATRUp &&
//
// TREND ...
conditions.isTrendUp // &&
// conditions.isTrendBullish
//
;
isCond1Bullish =
//
// Start ...
(isSarBullishStart &&
!isSarBearishStart) &&
//
// SCORE ...
isScoreBullish &&
//
// BAR ...
isBarBullishPressured &&
//
// KI ...
// conditions.isKIUp &&
conditions.isKIBullish &&
//
// ATR ...
conditions.isATRUp &&
//
// TREND ...
conditions.isTrendUp // &&
// conditions.isTrendBullish
//
;
//
bool isCond1Bearish =
//
// Start ...
(isSarBearishStart &&
!isSarBullishStart) &&
//
// SCORE ...
isScoreBearish &&
//
// BAR ...
isBarBearishPressured &&
//
// KI ...
// conditions.isKIDown &&
conditions.isKIBearish &&
//
// ATR ...
conditions.isATRDown &&
//
// TREND ...
conditions.isTrendDown // &&
// conditions.isTrendBearish
//
;
isCond1Bearish =
//
// Start ...
(isSarBearishStart &&
!isSarBullishStart) &&
//
// SCORE ...
isScoreBearish &&
//
// BAR ...
isBarBearishPressured &&
//
// KI ...
// conditions.isKIDown &&
conditions.isKIBearish &&
//
// ATR ...
conditions.isATRDown &&
//
// TREND ...
conditions.isTrendDown // &&
// conditions.isTrendBearish
//
;
}
//
bool isCond1 =
@@ -1089,89 +949,360 @@ bool DetectSignalZone(
if (isCond1)
{
//
// Validate Some Other Requirements ...
// //
// // We Have to Detect Youngest Order Block ...
// // or Mitigation Block ...
// if (isCond1Bullish)
// {
// // //
// // // OB ...
// // idx = GetYoungest(detector.obBullishPivots);
// // has = IsValidIndex(idx);
// // if (has)
// // {
// // iOB = detector.obBullishPivots[idx];
// // }
// //
// // MT ...
// idx = GetYoungest(detector.mtBullishPivots);
// has = IsValidIndex(idx);
// if (has)
// {
// iOB = detector.mtBullishPivots[idx];
// }
// }
// else if (isCond1Bearish)
// {
// //
// // OB
// // idx = GetYoungest(detector.obBearishPivots);
// // has = IsValidIndex(idx);
// // if (has)
// // {
// // iOB = detector.obBearishPivots[idx];
// // }
// //
// // MT
// idx = GetYoungest(detector.mtBearishPivots);
// has = IsValidIndex(idx);
// if (has)
// {
// iMT = detector.mtBearishPivots[idx];
// }
// }
// //
// // Now we can Do some Verifications Using these ...
// result =
// isCond1Bullish
// ? iMT.IsBullish()
// : iMT.IsBearish();
// if (!result)
// {
// //
// isCond1Bullish = false;
// isCond1Bearish = false;
// }
//
// All Requirements based on Cond 1 ...
// Generate Direction Shift Zone ...
has = GenerateSarDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ----------------------------------
//
// Summarizing Result ...
// --------------
// Conditions 2:
// --------------
// Descriptions:
// - [] Detect Trend Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond2Bullish = false;
bool isCond2Bearish = false;
if (allowSignallingConditions2)
{
//
isCond2Bullish =
//
// Start ...
(isTrendBullishStart &&
!isTrendBearishStart)
//
;
//
isCond2Bearish =
//
// Start ...
(isTrendBearishStart &&
!isTrendBullishStart)
//
;
}
//
bool isCond2 =
isCond2Bullish ||
isCond2Bearish;
if (isCond2)
{
//
// Generate Direction Shift Zone ...
has = GenerateTrendDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// --------------
// Conditions 3:
// --------------
// Descriptions:
// - [] Detect Delta Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond3Bullish = false;
bool isCond3Bearish = false;
if (allowSignallingConditions3)
{
//
isCond3Bullish =
//
// Start ...
(isDeltaBullishStart &&
!isDeltaBearishStart)
//
;
//
isCond3Bearish =
//
// Start ...
(isDeltaBearishStart &&
!isDeltaBullishStart)
//
;
}
//
bool isCond3 =
isCond3Bullish ||
isCond3Bearish;
if (isCond3)
{
//
// Generate Direction Shift Zone ...
has = GenerateDeltaDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// --------------
// Conditions 4:
// --------------
// Descriptions:
// - [] Detect Volume Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond4Bullish = false;
bool isCond4Bearish = false;
if (allowSignallingConditions4)
{
//
isCond4Bullish =
//
// Start ...
(isVolumeBullishStart &&
!isVolumeBearishStart)
//
;
//
isCond4Bearish =
//
// Start ...
(isVolumeBearishStart &&
!isVolumeBullishStart)
//
;
}
//
bool isCond4 =
isCond4Bullish ||
isCond4Bearish;
if (isCond4)
{
//
// Generate Direction Shift Zone ...
has = GenerateVolumeDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// --------------
// Conditions 5:
// --------------
// Descriptions:
// - [] Detect Signal Bar Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond5Bullish = false;
bool isCond5Bearish = false;
if (allowSignallingConditions5)
{
//
isCond5Bullish =
//
// Start ...
(isSBarBullishStart &&
!isSBarBearishStart)
//
;
//
isCond5Bearish =
//
// Start ...
(isSBarBearishStart &&
!isSBarBullishStart)
//
;
}
//
bool isCond5 =
isCond5Bullish ||
isCond5Bearish;
if (isCond5)
{
//
// Generate Direction Shift Zone ...
has = GenerateSignalBarDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// --------------
// Conditions 6:
// --------------
// Descriptions:
// - [] Detect HK Signal Bar Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond6Bullish = false;
bool isCond6Bearish = false;
if (allowSignallingConditions6)
{
//
isCond6Bullish =
//
// Start ...
(isHKSBarBullishStart &&
!isHKSBarBearishStart)
//
;
//
isCond6Bearish =
//
// Start ...
(isHKSBarBearishStart &&
!isHKSBarBullishStart)
//
;
}
//
bool isCond6 =
isCond6Bullish ||
isCond6Bearish;
if (isCond6)
{
//
// Generate Direction Shift Zone ...
has = GenerateHKSignalBarDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// Summarizing Signalling Results ...
//
isBullish =
//
isCond1Bullish
isCond1Bullish ||
isCond2Bullish ||
isCond3Bullish ||
isCond4Bullish ||
isCond5Bullish ||
isCond6Bullish
//
;
//
isBearish =
//
isCond1Bearish
isCond1Bearish ||
isCond2Bearish ||
isCond3Bearish ||
isCond4Bearish ||
isCond5Bearish ||
isCond6Bearish
//
;
}
//
// Summarize Result ...
result =
isBullish ||
isBearish;
@@ -1203,7 +1334,7 @@ bool DetectSignalZone(
isBullish
? clrAqua
: clrMagenta;
string iName = "Conditions_" + ToString(iDir) + "_" + ToString(((int)conditions.time));
string iName = signalZone.type + "_Conditions_" + ToString(iDir) + "_" + ToString(((int)conditions.time));
//
CChartObjectVLine *iObj = new CChartObjectVLine();
@@ -1224,11 +1355,31 @@ bool DetectSignalZone(
has = signalZone.IsValid();
if (has)
{
drawer.DrawBox(signalZone);
//
XCATBPivotStyle iStyle;
iStyle.width = 2;
iStyle.clr = isBullish
? clrYellow
: clrOrange;
iStyle.style = STYLE_SOLID;
//
XCBoxObject *iObj;
has = drawer
.drawer
.DrawBox(
signalZone,
iObj //
);
if (has)
{
drawer.ApplyPivotStyle(iObj, iStyle);
}
}
//
Print("Conditions ...");
signalZone.Clean();
}
//
@@ -1238,14 +1389,6 @@ bool DetectSignalZone(
//
// Cleanup Resources ...
//
iPeak.Clean();
iVale.Clean();
iOBBull.Clean();
iOBBear.Clean();
iMTBull.Clean();
iMTBear.Clean();
//
if (!result)
{