This commit is contained in:
2025-01-07 21:48:52 +03:30
parent 3d95220cc7
commit 73f39629fb
5 changed files with 1308 additions and 106 deletions
+81 -64
View File
@@ -719,13 +719,12 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
//
bool TestPOIState(
XCPOIDrawer *drawer,
ENUM_X_DIRECTION &forDir, // Test For Specified Direction ...
XFVGOrderBlock &bullishOrderBlocks[], // Bullish Order Blocks ...
XFVGOrderBlock &bearishOrderBlocks[], // Bearish Order Blocks ...
XPOIState &orderBlockState, // Order Block Detection TF POI(s) ...
XPOIState &fairValueGapState, // Fair Value Gap Detection TF POI(s) ...
XPOIState &triggerState, // Trigger TF POI(s) ...
XPOIState &decisionState, // Decision TF POI(s) ...
int barIndex = 0 // Bar Index ...
)
{
@@ -744,10 +743,9 @@ bool TestPOIState(
//
// Validate Args ...
result =
drawer != NULL &&
orderBlockState.HasChild() &&
fairValueGapState.HasChild() &&
triggerState.HasChild();
decisionState.HasChild();
if (!result)
{
return result;
@@ -771,6 +769,20 @@ bool TestPOIState(
int count = 0;
datetime cTime = TimeCurrent();
//
XOHCL jBar;
result = jBar.Init(
fairValueGapState.symbol,
fairValueGapState.period,
barIndex //
);
if (!result)
{
return result;
}
double jBarLL = jBar.FindLowest(3, MODE_LOW);
double jBarHH = jBar.FindHighest(3, MODE_HIGH);
//
// Bullish ...
int bullishOrderBlocksCount = orderBlockState.CountBullishOrderBlocks();
@@ -782,6 +794,7 @@ bool TestPOIState(
{
//
XCFVG *iFVG = NULL;
XStateZones iStateZones;
XCOrderBlock *iOb = orderBlockState.bullishOrderBlocks[i];
iOb.To(cTime);
@@ -829,13 +842,14 @@ bool TestPOIState(
//
bool isValid =
//
jFVG.IsBullish()
// &&
// jFVG.From() > iOb.From() &&
// ((jFVG.Upper() > iOb.Upper() &&
// jFVG.Lower() <= iOb.Upper()) ||
// (jFVG.Upper() <= iOb.Upper() &&
// jFVG.Lower() >= iOb.Lower()))
jFVG.IsBullish() &&
jBarLL > jFVG.Upper() &&
jBar.low > jFVG.Upper() &&
jFVG.From() >= iOb.From() &&
((jFVG.Upper() > iOb.Upper() &&
jFVG.Lower() <= iOb.Upper()) ||
(jFVG.Upper() <= iOb.Upper() &&
jFVG.Lower() >= iOb.Lower()))
//
;
if (isValid)
@@ -852,40 +866,41 @@ bool TestPOIState(
result = hasFVG;
if (!result)
{
return result;
continue;
}
// //
// double upper = MathMax(iOb.Upper(), iFVG.Upper());
// double lower = MathMin(iOb.Lower(), iFVG.Lower());
// datetime from = iFVG.From();
// //
// // Detect Price Zones ...
// // Based On Decision State ...
// bool hasStateZones = CalculateStateZones(
// iStateZones,
// decisionState,
// upper,
// lower,
// from //
// );
// result = hasStateZones;
// if (!result)
// {
// continue;
// }
//
XFVGOrderBlock iModel;
iModel.orderBlock = iOb;
iModel.fairValueGap = iFVG;
// iModel.stateZones = iStateZones;
//
AddRef(
iModel,
bullishOrderBlocks //
);
//
XCBullishOrderBlockObject *iOBObject;
bool isInited = drawer.CreateBullishOrderBlock(
iOb,
iOBObject //
);
if (isInited)
{
}
//
XCOHCLObject *iBarObj;
isInited = drawer.CreateBar(
breakerBar,
iBarObj,
cTime //
);
if (isInited)
{
}
}
}
@@ -900,6 +915,7 @@ bool TestPOIState(
{
//
XCFVG *iFVG = NULL;
XStateZones iStateZones;
XCOrderBlock *iOb = orderBlockState.bearishOrderBlocks[i];
iOb.To(cTime);
@@ -947,11 +963,14 @@ bool TestPOIState(
//
bool isValid =
//
jFVG.IsBearish()
// &&
// jFVG.From() > iOb.From() &&
// jFVG.Upper() > iOb.Lower() &&
// jFVG.Lower() <= iOb.Lower()
jFVG.IsBearish() &&
jBarHH < jFVG.Lower() &&
jBar.high < jFVG.Lower() &&
jFVG.From() >= iOb.From() &&
((jFVG.Upper() > iOb.Lower() &&
jFVG.Lower() <= iOb.Lower()) ||
(jFVG.Upper() <= iOb.Upper() &&
jFVG.Lower() >= iOb.Lower()))
//
;
if (isValid)
@@ -968,40 +987,41 @@ bool TestPOIState(
result = hasFVG;
if (!result)
{
return result;
continue;
}
//
double upper = MathMax(iOb.Upper(), iFVG.Upper());
double lower = MathMin(iOb.Lower(), iFVG.Lower());
datetime from = iFVG.From();
// //
// // Detect Price Zones ...
// // Based On Decision State ...
// bool hasStateZones = CalculateStateZones(
// iStateZones,
// decisionState,
// upper,
// lower,
// from //
// );
// result = hasStateZones;
// if (!result)
// {
// continue;
// }
//
XFVGOrderBlock iModel;
iModel.orderBlock = iOb;
iModel.fairValueGap = iFVG;
// iModel.stateZones = iStateZones;
//
AddRef(
iModel,
bullishOrderBlocks //
bearishOrderBlocks //
);
//
XCBearishOrderBlockObject *iOBObject;
bool isInited = drawer.CreateBearishOrderBlock(
iOb,
iOBObject //
);
if (isInited)
{
}
//
XCOHCLObject *iBarObj;
isInited = drawer.CreateBar(
breakerBar,
iBarObj,
cTime //
);
if (isInited)
{
}
}
}
@@ -1030,7 +1050,6 @@ bool TestPOIState(
//
bool isBullish = hasBullishOrderBlocks && !hasBearishOrderBlocks;
bool isBearish = hasBearishOrderBlocks && !hasBullishOrderBlocks;
bool isAll = hasBullishOrderBlocks && hasBearishOrderBlocks;
//
forDir =
@@ -1038,8 +1057,6 @@ bool TestPOIState(
? X_DIRECTION_BULLISH
: isBearish
? X_DIRECTION_BEARISH
: isAll
? X_DIRECTION_ALL
: X_DIRECTION_NONE;
//
+149 -18
View File
@@ -49,9 +49,8 @@ struct X121SMCStrategyXTWPVSignalConditions
datetime triggerTime;
//
// ENUM_X_DIRECTION orderBlockDir;
// XCOrderBlock *bullishOrderBlocks[];
// XCOrderBlock *bearishOrderBlocks[];
XFVGOrderBlock bullishOrderBlocks[];
XFVGOrderBlock bearishOrderBlocks[];
//
// Constructor ...
@@ -168,9 +167,39 @@ struct X121SMCStrategyXTWPVSignalConditions
void ExtensionClean()
{
//
// Clean(bullishOrderBlocks);
// Clean(bearishOrderBlocks);
// orderBlockDir = X_DIRECTION_NONE;
Clean(bullishOrderBlocks);
Clean(bearishOrderBlocks);
}
/**
* Update Order Blocks Date ...
*/
void UpdateOrderBlocks() {
//
int count = 0;
datetime cTime = TimeCurrent();
//
count = ArraySize(bullishOrderBlocks);
if (IsValidSize(count)) {
//
for (int i = 0; i < count; i++) {
//
bullishOrderBlocks[i].orderBlock.To(cTime);
bullishOrderBlocks[i].fairValueGap.To(cTime);
}
}
//
count = ArraySize(bearishOrderBlocks);
if (IsValidSize(count)) {
//
for (int i = 0; i < count; i++) {
//
bearishOrderBlocks[i].orderBlock.To(cTime);
bearishOrderBlocks[i].fairValueGap.To(cTime);
}
}
}
//
@@ -192,9 +221,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
XC121SMCCycleHelper *analyseCycleHelper,
XC121SMCCycleHelper *verificationCycleHelper,
XC121SMCCycleHelper *consolidationCycleHelper,
XC121SMCCycleHelper *visionCycleHelper,
//
XCPOIDrawer *drawer //
XC121SMCCycleHelper *visionCycleHelper
//
)
{
@@ -393,7 +420,6 @@ bool DetectX121SMCXTWPVSiganlSetup(
XFVGOrderBlock bullishOrderBlocks[];
XFVGOrderBlock bearishOrderBlocks[];
bool isTested = TestPOIState(
drawer,
forDir,
bullishOrderBlocks,
bearishOrderBlocks,
@@ -402,6 +428,15 @@ bool DetectX121SMCXTWPVSiganlSetup(
decisionState //
);
//
isBullish =
isTested &&
IsBullish(forDir);
//
isBearish =
isTested &&
IsBearish(forDir);
//
result = isBullish ||
isBearish;
@@ -410,6 +445,17 @@ bool DetectX121SMCXTWPVSiganlSetup(
return result;
}
//
conditions.dir = forDir;
Copy(
bullishOrderBlocks,
conditions.bullishOrderBlocks //
);
Copy(
bearishOrderBlocks,
conditions.bearishOrderBlocks //
);
//
conditions.setupTime = cTime;
conditions.dir =
@@ -437,7 +483,7 @@ bool DetectX121SMCXTWPVSiganlTrigger(
XC121SMCCycleHelper *consolidationCycleHelper,
XC121SMCCycleHelper *visionCycleHelper,
//
int maxAllowedSetupAge = 60 //
int maxAllowedSetupAge = 0 //
//
)
{
@@ -638,6 +684,91 @@ bool DetectX121SMCXTWPVSiganlTrigger(
//
// Trigger Conditions ...
//
// Waits For Price to Go Inside FVG ...
XFVGOrderBlock fvgOrderBlock;
bool isPriceInsideOB = false;
bool isPriceInsideFVG = false;
if (isBullish)
{
//
int count = ArraySize(conditions.bullishOrderBlocks);
for (int i = 0; i < count; i++)
{
//
XFVGOrderBlock iModel = conditions.bullishOrderBlocks[i];
//
isPriceInsideOB = IsPriceInsideZone(
cBar,
iModel.orderBlock //
);
//
isPriceInsideFVG = IsPriceInsideZone(
cBar,
iModel.fairValueGap //
);
//
if (isPriceInsideOB &&
isPriceInsideFVG)
{
//
fvgOrderBlock = iModel;
break;
}
//
isPriceInsideOB = false;
isPriceInsideFVG = false;
}
}
else
{
//
int count = ArraySize(conditions.bearishOrderBlocks);
for (int i = 0; i < count; i++)
{
//
XFVGOrderBlock iModel = conditions.bearishOrderBlocks[i];
//
isPriceInsideOB = IsPriceInsideZone(
cBar,
iModel.orderBlock //
);
//
isPriceInsideFVG = IsPriceInsideZone(
cBar,
iModel.fairValueGap //
);
//
if (isPriceInsideOB &&
isPriceInsideFVG)
{
//
fvgOrderBlock = iModel;
break;
}
//
isPriceInsideOB = false;
isPriceInsideFVG = false;
}
}
//
result = isPriceInsideOB &&
isPriceInsideFVG &&
fvgOrderBlock.IsValid();
if (!result)
{
return result;
}
//
// Detect Bullish Conditions ...
isBullish =
@@ -657,13 +788,13 @@ bool DetectX121SMCXTWPVSiganlTrigger(
{
//
// Cleanup Setup Conditions ...
int setupAge = conditions.GetSetupAge();
if (IsValidSize(setupAge) &&
IsValidSize(maxAllowedSetupAge) &&
setupAge >= maxAllowedSetupAge)
{
conditions.Clean();
}
// int setupAge = conditions.GetSetupAge();
// if (IsValidSize(setupAge) &&
// IsValidSize(maxAllowedSetupAge) &&
// setupAge >= maxAllowedSetupAge)
// {
// conditions.Clean();
// }
//
return result;
+35 -21
View File
@@ -518,8 +518,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper,
mPOIDrawer //
mVisionCycleHelper //
);
//
@@ -528,18 +527,33 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
}
//
// if (mXTWPVConditions.HasPriceZone())
// {
// //
// XCBaseObject *objects[];
// mPOIDrawer.DrawPriceZone(
// mXTWPVConditions.priceZone,
// objects //
// );
if (isSetuped)
{
//
mXTWPVConditions.UpdateOrderBlocks();
// //
// Print("");
// }
//
XCBaseObject *bullDrawnObjects[];
int bullDrawnObjectsCount = mPOIDrawer.DrawFVGOrderBlock(
mXTWPVConditions.bullishOrderBlocks,
bullDrawnObjects //
);
if (IsValidSize(bullDrawnObjectsCount))
{
AddObjectsIfNotExists(bullDrawnObjects);
}
//
XCBaseObject *bearDrawnObjects[];
int bearDrwanObjectsCount = mPOIDrawer.DrawFVGOrderBlock(
mXTWPVConditions.bearishOrderBlocks,
bearDrawnObjects //
);
if (IsValidSize(bearDrwanObjectsCount))
{
AddObjectsIfNotExists(bearDrawnObjects);
}
}
//
result = isSetuped;
@@ -690,20 +704,20 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
x121Inputs.xpvInputs.hcPeriod = hcPeriod;
//
x121Inputs.xpvInputs.showSar = false;
x121Inputs.xpvInputs.showPeaks = false;
x121Inputs.xpvInputs.showVales = false;
x121Inputs.xpvInputs.showSar = true;
x121Inputs.xpvInputs.showPeaks = true;
x121Inputs.xpvInputs.showVales = true;
//
// XATR ...
x121Inputs.xatrInputs.showATRUpper = false;
x121Inputs.xatrInputs.showATRLower = false;
x121Inputs.xatrInputs.showATRUpper = true;
x121Inputs.xatrInputs.showATRLower = true;
//
// XSTR ...
x121Inputs.xstrInputs.showStr = false;
x121Inputs.xstrInputs.showStrUpper = false;
x121Inputs.xstrInputs.showStrLower = false;
x121Inputs.xstrInputs.showStr = true;
x121Inputs.xstrInputs.showStrUpper = true;
x121Inputs.xstrInputs.showStrLower = true;
//
// XDON ...