This commit is contained in:
2025-05-19 15:13:49 +03:30
parent ebc437a2f2
commit 8451bcdd6e
5 changed files with 2794 additions and 200 deletions
+228
View File
@@ -2040,6 +2040,234 @@ class XCBarAnalyser : public XCBase
return result;
}
bool IsTrigger(
XOHCL &bar,
XBoxZone &box,
bool forceFVGBarType = false,
bool forceOBTwoBar = false, //
int loopback = 5 //
)
{
//
bool result = false;
//
// Normalize Args ...
box.Clean();
loopback = NormalizeInt(loopback, 5);
//
// Validate Args ...
result = bar.IsValid();
if (!result)
{
return result;
}
//
XOHCL pBar; // Previous of Provided Bar ...
XOHCL iBar;
XOHCL iPBar;
int barIndex;
int pBarIndex;
//
result = bar.GetPreviousBar(pBar);
if (!result)
{
//
box.Clean();
pBar.Clean();
iBar.Clean();
iPBar.Clean();
//
return result;
}
//
barIndex = bar.Index();
pBarIndex = pBar.Index();
//
// Loopback to Find a Block ...
for (int i = pBarIndex; i < pBarIndex + loopback; i++)
{
//
// Inital IBar ...
result = iBar.Init(
bar.symbol,
bar.period,
i //
);
if (!result)
{
break;
}
//
// Detect Block ...
result = IsOB(
iBar,
box,
forceFVGBarType,
forceOBTwoBar //
);
if (result)
{
break;
}
//
iBar.Clean();
}
iBar.Clean();
//
// Validate Block Detected ...
result = box.IsValid();
if (!result)
{
//
box.Clean();
pBar.Clean();
iBar.Clean();
iPBar.Clean();
//
return result;
}
//
int toIDX = box.ToIndex();
int fromIDX = box.FromIndex();
bool isBullish = box.IsBullish();
bool isBearish = box.IsBearish();
//
// Detect Swing Bar ...
XOHCL swingBar;
int swingBarIDX = -1;
int swingLoopback = fromIDX - barIndex;
if (isBullish)
{
//
// Looking for Swing Low ...
swingBarIDX = bar.FindLowestIndex(swingLoopback, MODE_LOW);
}
else if (isBearish)
{
//
// Looking for Swing High ...
swingBarIDX = bar.FindLowestIndex(swingLoopback, MODE_LOW);
}
result = IsValidIndex(swingBarIDX);
if (!result)
{
//
box.Clean();
iBar.Clean();
iPBar.Clean();
swingBar.Clean();
//
return result;
}
//
// Initialize Swing Bar ...
result = swingBar.Init(
bar.symbol,
bar.period,
swingBarIDX //
);
if (!result)
{
//
box.Clean();
iBar.Clean();
iPBar.Clean();
swingBar.Clean();
//
return result;
}
//
// Now we Have to Check Spike from Swing Bar Next till Current Bar ...
// To Validate Highs and Lows ...
for (int i = pBarIndex; i < pBarIndex + (swingBarIDX - pBarIndex) - 1; i++)
{
//
// Initialize iBar ...
result = iBar.Init(
bar.symbol,
bar.period,
i //
);
result =
result &&
iBar.GetPreviousBar(iPBar);
if (!result)
{
break;
}
//
// Since we Go Backward Bars from Current Bar ...
// for Bullish: each Bar Low Must over Prev Bar Low ...
// for Bearish: each Bar High Must Under Prev Bar High ...
if (isBullish)
{
result = iBar.low > iPBar.low;
}
else if (isBearish)
{
result = iBar.high < iPBar.high;
}
if (!result)
{
break;
}
//
iBar.Clean();
iPBar.Clean();
}
iBar.Clean();
iPBar.Clean();
//
// Ensure Spike Happens ...
if (!result)
{
//
box.Clean();
pBar.Clean();
iBar.Clean();
iPBar.Clean();
//
return result;
}
//
// Cleanup Resources ...
//
iBar.Clean();
swingBar.Clean();
//
if (!result)
{
box.Clean();
}
//
return result;
}
//
// Candlestick ...
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -16,7 +16,7 @@
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm X121 X3MA Indicator"
#property description "SaherElm X121 XCZone Indicator"
#property strict
//
@@ -1595,4 +1595,53 @@ bool DetectTriggerBlock(
return result;
};
bool DetectTriggerBlock1(
XBoxZone &triggerBlock,
XCAEAConditions &conditions,
XCXCAEAHelper *helper,
XCAEATriggerBlockConfiguration &config,
int bar_index = 0,
int loopback = 6 //
) {
//
bool result = false;
//
conditions.Clean();
triggerBlock.Clean();
//
// Normalize Args ...
loopback = NormalizeInt(loopback, 6);
bar_index = NormalizeInt(bar_index, 0);
//
// Validate Args ...
result = helper != NULL;
if (!result)
{
return result;
}
//
// Provide base Requirements ...
//
string symbol = helper.GetSymbol();
double points = GetPoints(symbol);
ENUM_TIMEFRAMES period = helper.GetPeriod();
//
// Conditions Reading Indexes ...
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
int p2IDX = pIDX + 1;
int p3IDX = p2IDX + 1;
int p4IDX = p3IDX + 1;
//
return result;
}
//
+228 -199
View File
@@ -288,10 +288,29 @@ class XCXCAEASignaller : XCBase
XBoxZone tmpZone;
XCAEATriggerBlockConfiguration config;
//
bool allowTwoFilters = false;
bool allowThreeFilters = false;
//
bool hasFullFiltered = false;
bool hasSarRsiAdxFiltered = false;
bool hasSarRsiTrendFiltered = false;
bool hasSarAdxTrendFiltered = false;
bool hasRsiAdxTrendFiltered = false;
//
bool hasSarRsiFiltered = false;
bool hasSarAdxFiltered = false;
bool hasRsiAdxFiltered = false;
bool hasSarTrendFiltered = false;
bool hasRsiTrendFiltered = false;
bool hasAdxTrendFiltered = false;
//
// Full Filteres ...
config.ConfigureFullFilter();
bool hasFullFiltered = DetectTriggerBlock(
hasFullFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
@@ -312,232 +331,242 @@ class XCXCAEASignaller : XCBase
}
//
tmpZone.Clean();
config.ConfigureSarRsiAdxFilter();
bool hasSarRsiAdxFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarRsiAdxFiltered)
// Check Three Filters ...
if (allowThreeFilters)
{
//
pushers++;
tmpZone.Clean();
config.ConfigureSarRsiAdxFilter();
hasSarRsiAdxFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarRsiAdxFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
if (!decisionZone.IsValid())
tmpZone.Clean();
config.ConfigureSarRsiTrendFilter();
hasSarRsiTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarRsiTrendFiltered)
{
decisionZone = tmpZone;
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureSarAdxTrendFilter();
hasSarAdxTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarAdxTrendFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
//
tmpZone.Clean();
config.ConfigureRsiAdxTrendFilter();
hasRsiAdxTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasRsiAdxTrendFiltered)
{
//
pushers++;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
}
//
tmpZone.Clean();
config.ConfigureSarRsiTrendFilter();
bool hasSarRsiTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarRsiTrendFiltered)
// Check two Filters ...
if (allowTwoFilters)
{
//
pushers++;
//
if (!decisionZone.IsValid())
tmpZone.Clean();
config.ConfigureSarRsiFilter();
hasSarRsiFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarRsiFiltered)
{
decisionZone = tmpZone;
//
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())
tmpZone.Clean();
config.ConfigureSarAdxFilter();
hasSarAdxFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarAdxFiltered)
{
decisionZone = tmpZone;
//
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())
tmpZone.Clean();
config.ConfigureSarTrendFilter();
hasSarTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasSarTrendFiltered)
{
decisionZone = tmpZone;
//
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())
tmpZone.Clean();
config.ConfigureRsiAdxFilter();
hasRsiAdxFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasRsiAdxFiltered)
{
decisionZone = tmpZone;
//
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())
tmpZone.Clean();
config.ConfigureRsiTrendFilter();
hasRsiTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasRsiTrendFiltered)
{
decisionZone = tmpZone;
//
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())
tmpZone.Clean();
config.ConfigureAdxTrendFilter();
hasAdxTrendFiltered = DetectTriggerBlock(
tmpZone,
conditions,
helper,
config,
zIndex,
loopback //
);
if (hasAdxTrendFiltered)
{
decisionZone = tmpZone;
}
}
//
pushers++;
//
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;
//
if (!decisionZone.IsValid())
{
decisionZone = tmpZone;
}
}
}
@@ -1214,7 +1243,7 @@ class XCXCAEASignaller : XCBase
inputs.x3maInputs.fastLength = 5;
//
inputs.x3maInputs.showFast = true;
inputs.x3maInputs.showFast = false;
inputs.x3maInputs.showSlow = false;
inputs.x3maInputs.showMedium = false;
@@ -1235,16 +1264,16 @@ class XCXCAEASignaller : XCBase
inputs.caInputs.showMAH = false;
inputs.caInputs.showMAL = false;
inputs.caInputs.showMAC = false;
inputs.caInputs.showSar = true;
inputs.caInputs.showSar = false;
inputs.caInputs.showVidya = false;
inputs.caInputs.showTrend = true;
inputs.caInputs.showSwings = true;
inputs.caInputs.showTrend = false;
inputs.caInputs.showSwings = false;
inputs.caInputs.showFiboLevel1 = false;
inputs.caInputs.showFiboLevel2 = false;
inputs.caInputs.showFiboLevel3 = false;
inputs.caInputs.showFiboLevel4 = false;
inputs.caInputs.showFiboLevel5 = false;
inputs.caInputs.showPeaksAndVales = true;
inputs.caInputs.showPeaksAndVales = false;
inputs.caInputs.showPeakAndValeGolden = false;
inputs.caInputs.showSupportAndResistance = false;