This commit is contained in:
2025-01-30 03:12:21 +03:30
parent 5b58753ab1
commit ea90e5f6c0
3 changed files with 267 additions and 23 deletions
+198
View File
@@ -801,6 +801,204 @@ struct X121SMCCycleState
return IsValidSize(CountBearishFVGs());
}
//
bool GetOldestOB(
XCOrderBlock *&orderBlock //
)
{
//
bool result = false;
//
orderBlock = NULL;
//
bool hasBullishOB = HasBullishOBs();
bool hasBearishOB = HasBearishOBs();
result = hasBullishOB ||
hasBearishOB;
if (!result)
{
return result;
}
//
int iBullOBIDX = -1;
bool iHasBullOB = false;
XCOrderBlock *iBullOB = NULL;
if (hasBullishOB)
{
//
XCZone* iZones[];
ToZone(
bullishOBs,
iZones //
);
//
iBullOBIDX = GetOldest(
iZones //
);
//
iHasBullOB = IsValidIndex(iBullOBIDX);
if (iHasBullOB)
{
iBullOB = bullishOBs[iBullOBIDX];
}
}
//
int iBearOBIDX = -1;
bool iHasBearOB = false;
XCOrderBlock *iBearOB = NULL;
if (hasBearishOB)
{
//
XCZone* iZones[];
ToZone(
bearishOBs,
iZones //
);
//
iBearOBIDX = GetOldest(
iZones //
);
//
iHasBearOB = IsValidIndex(iBearOBIDX);
if (iHasBearOB)
{
iBearOB = bearishOBs[iBearOBIDX];
}
}
//
if (iHasBullOB)
{
orderBlock = iBullOB;
}
//
if (iHasBearOB)
{
//
bool canSet = orderBlock == NULL ||
orderBlock.From() > iBearOB.From();
if (canSet)
{
orderBlock = iBearOB;
}
}
//
result = orderBlock != NULL &&
orderBlock.IsValid();
//
return result;
}
//
bool GetYoungestOB(
XCOrderBlock *&orderBlock //
)
{
//
bool result = false;
//
orderBlock = NULL;
//
bool hasBullishOB = HasBullishOBs();
bool hasBearishOB = HasBearishOBs();
result = hasBullishOB ||
hasBearishOB;
if (!result)
{
return result;
}
//
int iBullOBIDX = -1;
bool iHasBullOB = false;
XCOrderBlock *iBullOB = NULL;
if (hasBullishOB)
{
//
XCZone* iZones[];
ToZone(
bullishOBs,
iZones //
);
//
iBullOBIDX = GetYoungest(
iZones //
);
//
iHasBullOB = IsValidIndex(iBullOBIDX);
if (iHasBullOB)
{
iBullOB = bullishOBs[iBullOBIDX];
}
}
//
int iBearOBIDX = -1;
bool iHasBearOB = false;
XCOrderBlock *iBearOB = NULL;
if (hasBearishOB)
{
//
XCZone* iZones[];
ToZone(
bearishOBs,
iZones //
);
//
iBearOBIDX = GetYoungest(
iZones //
);
//
iHasBearOB = IsValidIndex(iBearOBIDX);
if (iHasBearOB)
{
iBearOB = bearishOBs[iBearOBIDX];
}
}
//
if (iHasBullOB)
{
orderBlock = iBullOB;
}
//
if (iHasBearOB)
{
//
bool canSet = orderBlock == NULL ||
orderBlock.From() < iBearOB.From();
if (canSet)
{
orderBlock = iBearOB;
}
}
//
result = orderBlock != NULL &&
orderBlock.IsValid();
//
return result;
}
//
};
@@ -700,9 +700,11 @@ bool DetectX121SMCXHKPVSignalSetup(
//
double upper = 0;
double lower = 0;
bool hasYoungestOB = false;
bool isPriceOBValid = false;
bool isBullishHappens = false;
bool isBearishHappens = false;
XCOrderBlock *youngestOB = NULL;
bool hasPriceBox = conditions.priceBox.IsValid();
bool hasState = visionCycleHelper.GetCycleState(conditions.state);
@@ -730,10 +732,21 @@ bool DetectX121SMCXHKPVSignalSetup(
upper = conditions.priceOB.Upper();
lower = conditions.priceOB.Lower();
//
hasYoungestOB = conditions.state.GetYoungestOB(youngestOB);
//
// Here We Can Validate Box by Same Cycles Peaks and Vales ...
bool isBullish = IsBullish(conditions.priceBox.dir);
//
bool isPriceBoxSameAsOB =
//
conditions.priceBox.upper <= conditions.priceOB.Upper() &&
conditions.priceBox.lower >= conditions.priceOB.Lower()
//
;
//
int cIDX = 1;
@@ -760,6 +773,7 @@ bool DetectX121SMCXHKPVSignalSetup(
isPriceOBValid =
//
hasPriceBox &&
isPriceBoxSameAsOB &&
(isBullish
? isSameCycleVales
: isSameCyclePeaks)
@@ -1369,29 +1383,61 @@ bool DetectX121SMCXHKPVSignalSetup(
if (!result)
{
//
bool canReset =
//
hasPriceBox &&
conditions.isPriceOBActed &&
conditions.isPriceOBBreaked &&
//
(
//
IsBullish(conditions.priceBox.dir)
? pBar.high < lower &&
cBar.high < lower
: pBar.low > upper &&
cBar.low > upper
//
)
//
;
if (canReset)
if (hasPriceBox && hasYoungestOB)
{
//
Print("canReset");
X121SMCCycleState iState;
bool iHasState = visionCycleHelper.GetCycleState(iState);
if (iHasState)
{
//
// Retrieve Youngest Order Blocks ...
XCOrderBlock *iYOB;
bool iHasYoungestOB = iState.GetYoungestOB(iYOB);
if (iHasYoungestOB)
{
//
// Compare it with current Condition PriceOB ...
bool isSame =
//
conditions.priceOB.Upper() == iYOB.Upper() &&
conditions.priceOB.Lower() == iYOB.Lower() &&
conditions.priceOB.From() == iYOB.From() &&
conditions.priceOB.Type() == iYOB.Type()
//
;
if (!isSame)
{
conditions.Clean();
}
}
}
}
//
// bool canReset =
// //
// hasPriceBox &&
// conditions.isPriceOBActed &&
// conditions.isPriceOBBreaked &&
// //
// (
// //
// IsBullish(conditions.priceBox.dir)
// ? pBar.high < lower &&
// cBar.high < lower
// : pBar.low > upper &&
// cBar.low > upper
// //
// )
// //
// ;
// if (canReset)
// {
// //
// Print("canReset");
// }
//
// Cleanup Arrays ...
ArrayFree(triggerPoiEvents);
@@ -1251,10 +1251,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// XCHE ...
x121Inputs.xcheInputs.showLE1 = showAll || true;
x121Inputs.xcheInputs.showLE2 = showAll || true;
x121Inputs.xcheInputs.showSE1 = showAll || true;
x121Inputs.xcheInputs.showSE2 = showAll || true;
x121Inputs.xcheInputs.showLE1 = showAll || false;
x121Inputs.xcheInputs.showLE2 = showAll || false;
x121Inputs.xcheInputs.showSE1 = showAll || false;
x121Inputs.xcheInputs.showSE2 = showAll || false;
//
// XDON ...