This commit is contained in:
2025-03-11 01:42:32 +03:30
parent d00dcf9ca0
commit f952cd1d93
6 changed files with 1311 additions and 124 deletions
+408 -3
View File
@@ -1261,11 +1261,416 @@ if (useSenario1)
//
;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//
isSenario2Happend = cParser.HasSenario2Conditions(
X_CYCLE_DECISION, // TFT Cycle ...
X_CYCLE_ANALYSE, // MTF Cycle ...
X_CYCLE_CONSOLIDATION, // HTF Cycle ...
box,
holderBox,
dir,
provider,
barIndex //
);
////////////////////////////////////////////////////////////////////////
//
isSenario2Bullish =
isSenario2Happend &&
IsBullish(dir);
//
isSenario2Bearish =
isSenario2Happend &&
IsBearish(dir);
//
if (isSenario2Happend)
{
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
////////////////////////////////////////////////////////////////////////
//
// Extract Cycles ...
//
// TTF Cycle ...
XPOIState ttfState;
X121Conditions ttfXConditions;
XC121SMCCycleHelper *ttfHelper;
X121SMCCycleConditions ttfConditions;
result = provider.SelectCycle(
ttfCycle,
ttfState,
ttfXConditions,
ttfHelper,
ttfConditions //
);
if (!result)
{
//
ttfState.Clean();
ZeroMemory(ttfHelper);
ttfConditions.Clean();
ttfXConditions.Clean();
//
return result;
}
Parse(ttfXConditions);
//
// MTF Cycle ...
XPOIState mtfState;
X121Conditions mtfXConditions;
XC121SMCCycleHelper *mtfHelper;
X121SMCCycleConditions mtfConditions;
result = provider.SelectCycle(
mtfCycle,
mtfState,
mtfXConditions,
mtfHelper,
mtfConditions //
);
if (!result)
{
//
ttfState.Clean();
mtfState.Clean();
ZeroMemory(ttfHelper);
ttfConditions.Clean();
ZeroMemory(mtfHelper);
mtfConditions.Clean();
ttfXConditions.Clean();
mtfXConditions.Clean();
//
return result;
}
Parse(mtfXConditions);
//
// HTF Cycle ...
XPOIState htfState;
X121Conditions htfXConditions;
XC121SMCCycleHelper *htfHelper;
X121SMCCycleConditions htfConditions;
result = provider.SelectCycle(
htfCycle,
htfState,
htfXConditions,
htfHelper,
htfConditions //
);
if (!result)
{
//
ttfState.Clean();
mtfState.Clean();
htfState.Clean();
ZeroMemory(ttfHelper);
ZeroMemory(mtfHelper);
ZeroMemory(htfHelper);
ttfConditions.Clean();
mtfConditions.Clean();
htfConditions.Clean();
ttfXConditions.Clean();
mtfXConditions.Clean();
htfXConditions.Clean();
//
return result;
}
Parse(htfXConditions);
////////////////////////////////////////////////////////////////////////
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = ttfXConditions.symbol;
box.period = ttfXConditions.period;
//
int fromIDX = -1;
if (isBullish)
{
//
double vale = ttfXConditions.valesBuffer[cIDX];
box.lower = vale;
box.upper = ttfXConditions.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = ttfHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = ttfHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = ttfXConditions.peaksBuffer[cIDX];
box.upper = peak;
//
box.lower = ttfXConditions.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = ttfHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = ttfHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
//
if (IsValidIndex(fromIDX))
{
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
// Detect Holder Box ...
XBoxZone tmpBoxes[];
if (htfState.IsValid())
{
//
if (isBullish)
{
//
// Demand Zones ...
XBoxZone tmp[];
ToBox(
htfState.demandZones,
tmp //
);
Copy(
tmp,
tmpBoxes,
false //
);
Clean(tmp);
//
// Bullish Order Blocks ...
ToBox(
htfState.bullishOrderBlocks,
tmp //
);
Copy(
tmp,
tmpBoxes,
false //
);
Clean(tmp);
//
// Bullish Fair Value Gaps ...
ToBox(
htfState.bullishFairValueGaps,
tmp //
);
Copy(
tmp,
tmpBoxes,
false //
);
Clean(tmp);
}
else
{
//
// Supply Zones ...
XBoxZone tmp[];
ToBox(
htfState.supplyZones,
tmp //
);
Copy(
tmp,
tmpBoxes,
false //
);
Clean(tmp);
//
// Bearish Order Blocks ...
ToBox(
htfState.bearishOrderBlocks,
tmp //
);
Copy(
tmp,
tmpBoxes,
false //
);
Clean(tmp);
//
// Bearish Fair Value Gaps ...
ToBox(
htfState.bearishFairValueGaps,
tmp //
);
Copy(
tmp,
tmpBoxes,
false //
);
Clean(tmp);
}
}
//
has = HasChild(tmpBoxes);
if (has)
{
//
while (HasChild(tmpBoxes))
{
//
idx = GetOldest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
has = IsBoxInside(
box,
iBox //
);
if (has)
{
//
holderBox = iBox;
holderBox.to = TimeCurrent();
iBox.Clean();
break;
}
//
iBox.Clean();
}
}
//
Clean(tmpBoxes);
//
// Validate Conditions to Force Has Holder Box ...
result =
result &&
holderBox.IsValid();
if (!result)
{
//
isBullish = false;
isBearish = false;
}
////////////////////////////////////////////////////////////////////////