This commit is contained in:
2025-03-27 17:47:02 +03:30
parent 8278d132dd
commit c00704b83b
11 changed files with 1530 additions and 559 deletions
@@ -3499,6 +3499,7 @@ struct X121SMCStrategyConditionParser
// XWPVZ ...
bool HasXWPVZConditions(
ENUM_X_CYCLES cycle,
ENUM_X_CYCLES vCycle,
XSignalBox &box,
ENUM_X_DIRECTION &dir,
X121SMCStrategySignalProviderData &provider,
@@ -3541,6 +3542,42 @@ struct X121SMCStrategyConditionParser
}
Parse(cXConditions);
//
// Fil Selected Data ...
XPOIState vState;
X121Conditions vXConditions;
XPOIStateEvents vStateEvents;
XC121SMCCycleHelper *vHelper;
X121SMCCycleConditions vConditions;
result = provider.SelectCycle(
vCycle,
vState,
vStateEvents,
vXConditions,
vHelper,
vConditions //
);
if (!result)
{
//
cState.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cXConditions.Clean();
cStateEvents.Clean();
//
vState.Clean();
ZeroMemory(vHelper);
cConditions.Clean();
vXConditions.Clean();
vStateEvents.Clean();
//
return result;
}
Parse(vXConditions);
//
// Normalize Args ...
@@ -3569,6 +3606,7 @@ struct X121SMCStrategyConditionParser
XOHCL zBar;
XOHCL cBar;
XOHCL pBar;
XOHCL pPBar;
//
// Initial Bars ...
@@ -3583,6 +3621,9 @@ struct X121SMCStrategyConditionParser
result =
result &&
cBar.GetPreviousBar(pBar);
result =
result &&
pBar.GetPreviousBar(pPBar);
if (!result)
{
//
@@ -3620,156 +3661,156 @@ struct X121SMCStrategyConditionParser
isBarValidForDir &&
IsBearish(iBarPosDir);
// //
// // Continuation Bullish ...
// bool isContinuationBullish =
// //
// isBarValidForBullish &&
// cXConditions.isSarBullish &&
// cXConditions.isStrBullish &&
// cXConditions.isNewPeakOverLast
// //
// ;
//
// Senkou Span A/B Rejections ...
// //
// // Continuation Bearish ...
// bool isContinuationBearish =
// //
// isBarValidForBearish &&
// cXConditions.isSarBearish &&
// cXConditions.isStrBearish &&
// cXConditions.isNewValeUnderLast
// //
// ;
//
bool forceType = false;
bool forcePressure = true;
//
bool isBullishRejectSenkouAB = cBar.IsRejected(
cXConditions.senkouMax,
X_DIRECTION_BULLISH,
forceType, // Force Type ...
forcePressure // Force Pressure ...
);
//
bool isBearishRejectSenkouAB = cBar.IsRejected(
cXConditions.senkouMin,
X_DIRECTION_BEARISH,
forceType, // Force Type ...
forcePressure // Force Pressure ...
);
//
// TenkanSen/KijunSen Rejections ...
//
bool isBullishRejectTenKij = cBar.IsRejected(
cXConditions.tenKijMax,
X_DIRECTION_BULLISH,
forceType, // Force Type ...
forcePressure // Force Pressure ...
);
//
bool isBearishRejectTenKij = cBar.IsRejected(
cXConditions.tenKijMin,
X_DIRECTION_BEARISH,
forceType, // Force Type ...
forcePressure // Force Pressure ...
);
//
// X3MaFast Rejections ...
//
bool isBullishRejectedFastMa = cBar.IsRejected(
cXConditions.x3maFastBuffer[cIDX],
X_DIRECTION_BULLISH,
forceType, // Force Type ...
forcePressure // Force Pressure ...
);
//
bool isBearishRejectedFastMa = cBar.IsRejected(
cXConditions.x3maFastBuffer[cIDX],
X_DIRECTION_BEARISH,
forceType, // Force Type ...
forcePressure // Force Pressure ...
);
//
bool isValidBullishRejectedFastMa =
isBullishRejectedFastMa &&
cBar.low > cXConditions.senkouMax;
//
bool isValidBearishRejectedFastMa =
isBearishRejectedFastMa &&
cBar.high < cXConditions.senkouMin;
//
// Bigger Cycle Verification ...
//
double vBullishScore = 0;
double vBearishScore = 0;
vXConditions.GenerateScore(
vBullishScore,
vBearishScore //
);
//
bool isVBUllishPassed =
cBar.low > vXConditions.senkouMax &&
vBullishScore > (vBearishScore * 1.5);
//
bool isVBearishPassed =
cBar.high < vXConditions.senkouMin &&
vBearishScore > (vBullishScore * 1.5);
//
// Bullish Conditions ...
isBullish =
//
isVBUllishPassed &&
isBullishRejectSenkouAB
//
;
//
// Bearish Conditions ...
isBearish =
//
isVBearishPassed &&
isBearishRejectSenkouAB
//
;
//
result = isBullish ||
isBearish;
if (result)
{
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
}
//
// Detecting a Zone and Validate it ...
//
XBoxZone tmpBoxes[];
//
XBoxZone obBox;
XBoxZone fvgBox;
XBoxZone supResBox;
XBoxZone tmpBoxes[];
bool isBullishFVGRejected = false;
bool isBearishFVGRejected = false;
bool isFVGLowerBullishRejected = false;
bool isFVGUpperBullishRejected = false;
bool isFVGLowerBearishRejected = false;
bool isFVGUpperBearishRejected = false;
has = cState.HasFairValueGaps();
if (has)
bool hasOB = false;
bool hasFVG = false;
bool hasSupRes = false;
//
// Select Support and Resistance ...
if (result)
{
//
// Converts FairValueGaps to Box ...
ToBox(
cState.fairValueGaps,
tmpBoxes //
);
//
// Select FVG ...
while (HasChild(tmpBoxes))
if (!hasSupRes)
{
//
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
cState.OrderBlocksAsBox(tmpBoxes);
cState.FairValueGapsAsBox(tmpBoxes);
cState.SupplyDemandsAsBox(tmpBoxes);
cState.SupportResistancesAsBox(tmpBoxes);
//
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
isFVGLowerBullishRejected =
//
cBar.low < iBox.lower &&
cBar.GetDown() > iBox.lower
//
;
//
isFVGUpperBullishRejected =
//
cBar.low < iBox.upper &&
cBar.GetDown() > iBox.upper
//
;
//
isFVGLowerBearishRejected =
//
cBar.high > iBox.lower &&
cBar.GetUp() < iBox.lower
//
;
//
isFVGUpperBearishRejected =
//
cBar.high > iBox.upper &&
cBar.GetUp() < iBox.upper
//
;
//
//
//
isBullishFVGRejected =
//
iBox.IsBullish() &&
cBar.IsBullish() &&
(isFVGLowerBullishRejected
// || isFVGUpperBullishRejected
)
//
;
//
isBearishFVGRejected =
//
iBox.IsBearish() &&
cBar.IsBearish() &&
( // isFVGLowerBearishRejected ||
isFVGUpperBearishRejected)
//
;
//
has = isBullishFVGRejected ||
isBearishFVGRejected;
if (has)
{
//
iBox.to = TimeCurrent();
fvgBox = iBox;
iBox.Clean();
break;
}
//
iBox.Clean();
}
Clean(tmpBoxes);
//
// Select Order Block which FVG is Inside it ...
has = fvgBox.IsValid();
if (has)
{
//
// Converts Order Blocks to Box ...
ToBox(
cState.orderBlocks,
tmpBoxes //
);
//
// Select Order Blocks ...
has = HasChild(tmpBoxes);
if (has)
{
@@ -3777,7 +3818,7 @@ struct X121SMCStrategyConditionParser
while (HasChild(tmpBoxes))
{
//
idx = GetYoungest(tmpBoxes);
idx = GetOldest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
@@ -3791,133 +3832,43 @@ struct X121SMCStrategyConditionParser
idx,
1 //
);
iBox.to = TimeCurrent();
//
// Validate Order Blocks ...
bool isSameDir = iBox.dir == fvgBox.dir;
bool isFVGInsideOB = IsBoxInsideOr(
fvgBox,
iBox //
// Try to Validate Support and Resistance ...
int retests = CountBoxRetest(
iBox,
dir,
cBar.period //
);
bool isTyped =
isBullish
? iBox.IsBullish()
: iBox.IsBearish();
bool isRetested = retests >= 1;
bool isPlaced =
isBullish
? (
//
(cBar.low < iBox.upper &&
cBar.low > iBox.lower)
//
)
: (
//
(cBar.high < iBox.upper &&
cBar.high > iBox.lower)
//
);
//
has =
isSameDir &&
isFVGInsideOB;
isTyped &&
isPlaced &&
isRetested;
if (has)
{
//
iBox.to = TimeCurrent();
obBox = iBox;
iBox.Clean();
break;
}
//
iBox.Clean();
}
}
}
//
has = obBox.IsValid();
if (!has)
{
//
obBox.Clean();
fvgBox.Clean();
//
isBullishFVGRejected = false;
isBearishFVGRejected = false;
isFVGLowerBullishRejected = false;
isFVGUpperBullishRejected = false;
isFVGLowerBearishRejected = false;
isFVGUpperBearishRejected = false;
}
Clean(tmpBoxes);
//
// Checking Support nad Resistance ...
bool isDirBullish =
obBox.IsBullish() &&
fvgBox.IsBullish();
has =
obBox.IsValid() &&
fvgBox.IsValid();
if (has)
{
//
// Converts Support or Resistance to Boxes ...
if (isDirBullish)
{
//
ToBox(
cState.supportZones,
tmpBoxes //
);
}
else
{
//
ToBox(
cState.resistanceZones,
tmpBoxes //
);
}
//
// Selecting Support nad Resistance ...
has = HasChild(tmpBoxes);
if (has)
{
//
while (HasChild(tmpBoxes))
{
//
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
// Validate Support and Resistane ...
bool isDirPassed = iBox.dir == obBox.dir;
bool isPlacePassed =
IsBoxAbove(
iBox,
fvgBox //
) ||
IsBoxAbove(
fvgBox,
iBox //
) ||
IsBoxInside(
iBox,
fvgBox //
) ||
IsBoxInside(
fvgBox,
iBox //
);
has =
isDirPassed &&
isPlacePassed;
if (has)
{
//
iBox.to = TimeCurrent();
supResBox = iBox;
iBox.Clean();
break;
@@ -3929,95 +3880,20 @@ struct X121SMCStrategyConditionParser
}
//
has = obBox.IsValid() &&
fvgBox.IsValid() &&
supResBox.IsValid();
if (!has)
{
//
obBox.Clean();
fvgBox.Clean();
supResBox.Clean();
//
isBullishFVGRejected = false;
isBearishFVGRejected = false;
isFVGLowerBullishRejected = false;
isFVGUpperBullishRejected = false;
isFVGLowerBearishRejected = false;
isFVGUpperBearishRejected = false;
}
hasSupRes = supResBox.IsValid();
Clean(tmpBoxes);
}
}
Clean(tmpBoxes);
//
// Checking OB and FVG Validation ...
has = obBox.IsValid() &&
fvgBox.IsValid() &&
supResBox.IsValid();
if (has)
{
//
// Draw OB ...
if (obBox.IsValid())
{
//
XCBoxObject *iObj;
has = drawer.DrawBox(
obBox,
iObj //
);
if (has)
{
iObj.BoxStyle(STYLE_DASH);
}
}
//
// Draw FVG ...
if (fvgBox.IsValid())
{
//
XCBoxObject *iObj;
has = drawer.DrawBox(
fvgBox,
iObj //
);
if (has)
{
iObj.BoxStyle(STYLE_SOLID);
}
}
//
// Draw Sup/Res Box ...
if (supResBox.IsValid())
{
//
XCBoxObject *iObj;
has = drawer.DrawBox(
supResBox,
iObj //
);
if (has)
{
iObj.BoxStyle(STYLE_DOT);
}
}
}
Clean(tmpBoxes);
//
// Bullish Conditions ...
isBullish =
//
// Base Condition ...
(
//
// false
isBullishFVGRejected
//
)
isBullish &&
hasSupRes
//
;
@@ -4025,13 +3901,8 @@ struct X121SMCStrategyConditionParser
// Bearish Conditions ...
isBearish =
//
// Base Condition ...
(
//
// false
isBearishFVGRejected
//
)
isBearish &&
hasSupRes
//
;
@@ -4043,14 +3914,36 @@ struct X121SMCStrategyConditionParser
if (result)
{
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
bool drawBoxes = true;
if (drawBoxes)
{
//
if (hasSupRes)
{
//
supResBox.to = TimeCurrent();
//
XCBoxObject *iObj;
has = drawer.DrawBox(
supResBox,
iObj //
);
//
if (has)
{
iObj.BoxWidth(2);
iObj.BoxStyle(STYLE_DOT);
}
}
}
//
result = false;
Print("Signal ...");
result = false;
isBearish = false;
isBullish = false;
}
//
@@ -4066,11 +3959,17 @@ struct X121SMCStrategyConditionParser
zBar.Clean();
cBar.Clean();
pBar.Clean();
pPBar.Clean();
cState.Clean();
ZeroMemory(cHelper);
vState.Clean();
cConditions.Clean();
cConditions.Clean();
ZeroMemory(cHelper);
ZeroMemory(vHelper);
cStateEvents.Clean();
cXConditions.Clean();
vXConditions.Clean();
vStateEvents.Clean();
//
return result;
@@ -118,12 +118,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
result = provider.Prepare(
zIndex,
loopback,
false, // Trigger ...
true, // Decision ...
true, // Analyse ...
true, // Verification ...
true, // Consolidation ...
true // Vision ...
true, // Trigger ...
true, // Decision ...
true, // Analyse ...
true, // Verification ...
true, // Consolidation ...
true // Vision ...
);
if (!result)
{
@@ -516,6 +516,33 @@ class XCX121SMCXWZSignalDetector : public XCBase
// Fix rf Reward ...
rfRewar = 2;
}
else if (signalProvider == X121SMC_XWZ_PROVIDER_XWPVZ)
{
//
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
//
Clean(sls);
//
// Prepare Box fro SL ...
double risk = pivot - point;
iSL = risk <= (100 * points)
? pivot
: isBullish
? NormalizePrice(entry - (50 * points), signalBox.ob.symbol)
: NormalizePrice(entry + (50 * points), signalBox.ob.symbol);
Add(
iSL,
sls //
);
//
// Fix rf Reward ...
rfRewar = 2;
}
//
Print("XWZ ", ToString(signalBoxDir), " Signal Provided: ", EnumToString(signalProvider));
@@ -2102,6 +2102,7 @@ struct X121SMCStrategyXWZWorkingZone
//
isSenario5Happend = cParser.HasXWPVZConditions(
X_CYCLE_DECISION,
X_CYCLE_CONSOLIDATION,
box,
dir,
provider,
@@ -734,9 +734,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
bool showAll = false;
//
x121Inputs.showRSI = showAll || false;
//
// XPV ...
@@ -769,7 +766,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
x121Inputs.x3maInputs.x3maSlowMALength = 200;
//
x121Inputs.xichInputs.shiftKumo = false;
x121Inputs.xichInputs.shiftKumo = true;
//
x121Inputs.showRSI = showAll || false;
//
// x121Inputs.xcheInputs.cheLength = 14;
@@ -800,8 +800,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// XPV ...
x121Inputs.xpvInputs.showSar = showAll || false;
x121Inputs.xpvInputs.showPeaks = showAll || false;
x121Inputs.xpvInputs.showVales = showAll || false;
x121Inputs.xpvInputs.showPeaks = showAll || true;
x121Inputs.xpvInputs.showVales = showAll || true;
x121Inputs.xpvInputs.showSupports = showAll || false;
x121Inputs.xpvInputs.showResistances = showAll || false;
x121Inputs.xpvInputs.showGoldenZones = showAll || false;
@@ -854,7 +854,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// X3MA ...
x121Inputs.x3maInputs.showX3MaFast = showAll || false;
x121Inputs.x3maInputs.showX3MaFast = showAll || true;
x121Inputs.x3maInputs.showX3MaMid = showAll || false;
x121Inputs.x3maInputs.showX3MaSlow = showAll || false;
@@ -862,7 +862,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// XICH ...
x121Inputs.xichInputs.showTenkanSen = showAll || true;
x121Inputs.xichInputs.showKijunSen = showAll || true;
x121Inputs.xichInputs.showChikouSpan = showAll || false;
x121Inputs.xichInputs.showChikouSpan = showAll || true;
x121Inputs.xichInputs.showSenkouSpanA = showAll || true;
x121Inputs.xichInputs.showSenkouSpanB = showAll || true;
x121Inputs.xichInputs.showKumo = showAll || false;