This commit is contained in:
2025-03-05 01:17:39 +03:30
parent 52856ff815
commit 17c6704104
8 changed files with 8633 additions and 2555 deletions
+11 -10
View File
@@ -4584,11 +4584,7 @@ class XCPOIDrawer : public XCBase
XCBaseObject *&objects[], XCBaseObject *&objects[],
// //
bool drawOrderBlock = true, bool drawOrderBlock = true,
bool drawFairValueGap = true, bool drawFairValueGaps = true,
bool drawSupplyZones = true,
bool drawDemandZones = true,
bool drawSupportZones = true,
bool drawResistanceZones = true,
// //
bool drawOBStartedBar = true, bool drawOBStartedBar = true,
bool drawOBActivatedBar = true, bool drawOBActivatedBar = true,
@@ -4699,14 +4695,18 @@ class XCPOIDrawer : public XCBase
// //
// Fair Value Gap ... // Fair Value Gap ...
has = item.HasFVG(); has = item.HasFVGs();
if (has && if (has &&
drawFairValueGap) drawFairValueGaps)
{
//
count = item.CountFVGs();
for (int i = 0; i < count; i++)
{ {
// //
Clean(tmpObjects); Clean(tmpObjects);
count = DrawFairValueGap( int fvgsCount = DrawFairValueGap(
item.fvg, item.fvgs[i],
tmpObjects, tmpObjects,
drawFVGStartedBar, drawFVGStartedBar,
drawFVGActivatedBar, drawFVGActivatedBar,
@@ -4725,7 +4725,7 @@ class XCPOIDrawer : public XCBase
clrFVGWorkedBar, clrFVGWorkedBar,
styleFVGWorkedBar // styleFVGWorkedBar //
); );
has = IsValidSize(count); has = IsValidSize(fvgsCount);
if (has) if (has)
{ {
// //
@@ -4736,6 +4736,7 @@ class XCPOIDrawer : public XCBase
); );
} }
} }
}
// //
Clean(tmpObjects); Clean(tmpObjects);
+2695
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+52 -228
View File
@@ -95,7 +95,7 @@ struct XOBFVG
{ {
// //
// Props ... // Props ...
XCFVG *fvg; XCFVG *fvgs[];
XCOrderBlock *ob; XCOrderBlock *ob;
// //
@@ -112,8 +112,8 @@ struct XOBFVG
void Clean() void Clean()
{ {
// //
Clean(fvgs);
ZeroMemory(ob); ZeroMemory(ob);
ZeroMemory(fvg);
// //
ZeroMemory(this); ZeroMemory(this);
@@ -123,7 +123,7 @@ struct XOBFVG
bool IsValid() bool IsValid()
{ {
return HasOB() && return HasOB() &&
HasFVG(); HasFVGs();
} }
// //
@@ -134,10 +134,15 @@ struct XOBFVG
} }
// //
bool HasFVG() bool HasFVGs()
{ {
return fvg != NULL && return HasChild(fvgs);
fvg.IsValid(); }
//
int CountFVGs()
{
return ArraySize(fvgs);
} }
// //
@@ -300,6 +305,39 @@ struct XOBFVG
return result; return result;
} }
//
void AddFVG(XCFVG *fvg)
{
//
int idx = -1;
bool has = false;
//
has = fvg != NULL &&
fvg.IsValid();
if (!has)
{
return;
}
//
idx = FindIndex(
fvg,
fvgs //
);
has = !IsValidIndex(idx);
if (!has)
{
return;
}
//
Add(
fvg,
fvgs //
);
}
// //
bool IsSameAs(XOBFVG &item) bool IsSameAs(XOBFVG &item)
{ {
@@ -308,8 +346,7 @@ struct XOBFVG
// //
result = IsValid() && result = IsValid() &&
IsSame(ob, item.ob) && IsSame(ob, item.ob);
IsSame(fvg, item.fvg);
// //
return result; return result;
@@ -333,10 +370,15 @@ struct XOBFVG
} }
// //
has = HasFVG(); has = HasFVGs();
if (has) if (has)
{ {
fvg.To(value); //
count = CountFVGs();
for (int i = 0; i < count; i++)
{
fvgs[i].To(value);
}
} }
} }
}; };
@@ -3639,224 +3681,6 @@ struct XPOIState
// //
}; };
//
int ExtractOBFVGs(
XOBFVG &dest[],
XPOIState &obState,
XPOIState &fvgState,
//
ENUM_X_OBFVG_FVG_FILTERS filterFVGs = X_OBFVG_FVG_FILTER_INSIDE_OR,
ENUM_X_OBFVG_FVG_SELECTION selectFVG = X_OBFVG_FVG_SELECT_OLDEST,
//
ENUM_TIMEFRAMES forPeriod = NULL,
//
// Start ...
ENUM_XZONE_STATE startState = XZONE_STATE_PASSED,
bool forceStartedBodyOut = false,
//
// Activation ...
ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED,
bool forceActivatedBodyIn = false,
//
// Breaktion ...
ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED,
bool forceBreakedBodyOut = false,
//
// Works ...
ENUM_XZONE_STATE workState = XZONE_STATE_IGNORED,
bool forceWorkedBodyOut = false //
)
{
//
int result = 0;
//
bool has = false;
//
Clean(dest);
//
has = obState.IsValid() &&
fvgState.IsValid() &&
obState.HasChild() &&
fvgState.HasChild() &&
selectFVG != X_OBFVG_FVG_SELECT_NONE &&
filterFVGs != X_OBFVG_FVG_FILTER_NONE;
if (!has)
{
return result;
}
//
XCOrderBlock *obs[];
int obsCount = obState.FilterOrderBlocks(
obs,
forPeriod,
startState,
forceStartedBodyOut,
activeState,
forceActivatedBodyIn,
breakState,
forceBreakedBodyOut,
workState,
forceWorkedBodyOut //
);
has = IsValidSize(obsCount);
if (!has)
{
return result;
}
//
XCFVG *fvgs[];
int fvgsCount = fvgState.FilterFairValueGaps(
fvgs,
forPeriod,
startState,
forceStartedBodyOut,
activeState,
forceActivatedBodyIn,
breakState,
forceBreakedBodyOut,
workState,
forceWorkedBodyOut //
);
has = IsValidSize(fvgsCount);
if (!has)
{
return result;
}
//
for (int i = 0; i < obsCount; i++)
{
//
XCOrderBlock *iOB = obs[i];
XCFVG *iFVG = NULL;
//
ENUM_X_DIRECTION iOBDir = iOB.GetDirection();
bool isIOBBullish = IsBullish(iOBDir);
//
XCFVG *iFVGs[];
for (int j = 0; j < fvgsCount; j++)
{
//
XCFVG *jFVG = fvgs[j];
ENUM_X_DIRECTION jFVGDir = jFVG.GetDirection();
//
bool isSameDir = iOBDir == jFVGDir;
bool isFromPassed = jFVG.From() >= iOB.From();
bool isInsideOr = IsInsideOrDiff(
jFVG,
iOB //
);
bool isAbove = IsAboveDiff(
jFVG,
iOB,
true //
);
bool isBelow = IsBelowDiff(
jFVG,
iOB,
true //
);
//
bool isFilterPassed =
filterFVGs == X_OBFVG_FVG_FILTER_ABOVE_BELOW
? isIOBBullish
? isAbove
: isBelow
: filterFVGs == X_OBFVG_FVG_FILTER_INSIDE_OR
? isInsideOr
: false;
//
has =
isSameDir &&
isFromPassed &&
isFilterPassed;
if (has)
{
//
Add(
jFVG,
iFVGs //
);
}
}
has = HasChild(iFVGs);
if (!has)
{
continue;
}
//
int idx = -1;
idx = selectFVG == X_OBFVG_FVG_SELECT_OLDEST
? GetOldest(iFVGs)
: selectFVG == X_OBFVG_FVG_SELECT_YOUNGEST
? GetYoungest(iFVGs)
: selectFVG == X_OBFVG_FVG_SELECT_HIGHEST_LOWEST
? isIOBBullish
? GetHighest(iFVGs)
: GetLowest(iFVGs)
: selectFVG == X_OBFVG_FVG_SELECT_LOWEST_HIGHEST
? isIOBBullish
? GetLowest(iFVGs)
: GetHighest(iFVGs)
: selectFVG == X_OBFVG_FVG_SELECT_LOWEST
? GetLowest(iFVGs)
: selectFVG == X_OBFVG_FVG_SELECT_HIGHEST
? GetHighest(iFVGs)
: -1;
//
has = IsValidIndex(idx);
if (!has)
{
continue;
}
//
iFVG = iFVGs[idx];
Clean(iFVGs);
//
XOBFVG iOBFVG;
iOBFVG.ob = iOB;
iOBFVG.fvg = iFVG;
//
has = iOBFVG.IsValid();
if (!has)
{
//
iOBFVG.Clean();
continue;
}
//
AddRef(
iOBFVG,
dest //
);
//
iOBFVG.Clean();
}
//
result = ArraySize(dest);
//
return result;
}
// //
// Extensions Functions ... // Extensions Functions ...
// //
+33 -303
View File
@@ -301,6 +301,10 @@ class XCX121SMCXWZSignalDetector : public XCBase
X121Conditions consolidationXConditions = consolidationConditions.x121Conditions; X121Conditions consolidationXConditions = consolidationConditions.x121Conditions;
X121Conditions visionXConditions = visionConditions.x121Conditions; X121Conditions visionXConditions = visionConditions.x121Conditions;
//
// Select Drawer Class ...
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
// //
// Scores ... // Scores ...
@@ -323,8 +327,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
); );
// //
// Select Drawer Class ... //
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer; //
// //
// Setup Conditions ... // Setup Conditions ...
@@ -338,6 +342,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
double amountPercent = 0; double amountPercent = 0;
bool hasPriority = false; bool hasPriority = false;
bool hasSignalBox = false; bool hasSignalBox = false;
bool hasWaitingZones = false;
bool hasRewardAmount = false; bool hasRewardAmount = false;
bool isSignalBoxReversal = false; bool isSignalBoxReversal = false;
bool hasWorkingZoneOveralDirection = false; bool hasWorkingZoneOveralDirection = false;
@@ -385,21 +390,22 @@ class XCX121SMCXWZSignalDetector : public XCBase
decisionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578); decisionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
consolidationCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578); consolidationCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
//
// Update Working Zone ...
workingZone.Update(
zIndex,
visionState,
consolidationState,
analyseState,
decisionState //
);
// //
// Check Working Zone Overal Direction ... // Check Working Zone Overal Direction ...
hasWorkingZoneOveralDirection = workingZone hasWorkingZoneOveralDirection = workingZone
.DetectOveralDirection(wzOveralDir); .DetectOveralDirection(wzOveralDir);
//
hasWaitingZones = workingZone.DetectZone(
drawer,
analysePoiEvents,
consolidationPoiEvents,
consolidationPoiEvents,
consolidationState,
analyseState,
consolidationState //
);
// //
// Checking Working Zone Destory or not ... // Checking Working Zone Destory or not ...
bool isWorkingZoneDestroyed = workingZone.IsDestroyed( bool isWorkingZoneDestroyed = workingZone.IsDestroyed(
@@ -460,225 +466,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
// //
// //
//
// Waiting Box Detected ...
bool hasWaitingBoxes = hasWorkingZone &&
workingZone.HasWaitingBoxes();
if (hasWaitingBoxes)
{
//
XOHCL zBar;
XOHCL cBar;
XOHCL pBar;
int count = 0;
int idx = -1;
bool has = false;
//
bool isInited = zBar.Init(
symbol,
period,
zIndex //
);
isInited =
isInited &&
zBar.GetPreviousBar(cBar);
isInited =
isInited &&
cBar.GetPreviousBar(pBar);
//
count = workingZone.CountWaitingBoxes();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = workingZone.waitingBoxes[i];
ENUM_X_DIRECTION iDir = iBox.dir;
bool isBullish = IsBullish(iDir);
//
// Check Price Rejection ...
//
bool hasBullishFiboPressure =
decisionCycleHelper
.mBarAnalyser
.HasFiboPressure(
cBar,
X_DIRECTION_BULLISH,
X_FIBO_LEVEL_382 //
);
//
bool hasBearishFiboPressure =
decisionCycleHelper
.mBarAnalyser
.HasFiboPressure(
cBar,
X_DIRECTION_BEARISH,
X_FIBO_LEVEL_382 //
);
//
// Bullish Rejection ...
bool isBullishRejected =
//
isInited &&
isBullish &&
cBar.low < pBar.low &&
zBar.low > iBox.upper &&
cBar.low <= iBox.upper &&
zBar.open > iBox.upper &&
hasBullishFiboPressure &&
cBar.GetLowShadow() > pBar.GetLowShadow()
//
;
//
// Bearish Rejection ...
bool isBearishhRejected =
//
isInited &&
!isBullish &&
cBar.high > pBar.high &&
zBar.open < iBox.lower &&
zBar.high < iBox.lower &&
hasBearishFiboPressure &&
cBar.high >= iBox.lower &&
cBar.GetHighShadow() > pBar.GetHighShadow()
//
;
//
has = isBullishRejected ||
isBearishhRejected;
if (has)
{
//
idx = i;
signalBox = iBox;
hasSignalBox = has;
signalBox.to = cTime;
signalBoxDir = iBox.dir;
isSignalBoxReversal = false;
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
}
//
iBox.Clean();
}
//
// Remove Signal Box from Waiting Boxes of
// Working Zone ...
if (hasSignalBox)
{
//
if (IsValidIndex(idx))
{
//
ArrayRemove(
workingZone.waitingBoxes,
idx,
1 //
);
}
}
//
// Ignore Zone's Signals ...
hasSignalBox = false;
//
// Cleanup Resources ...
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
}
//
// Check Conditions if Has Inside Boxes ...
bool hasInsideBoxes = hasWorkingZone &&
workingZone.HasInsideBoxes();
if (hasInsideBoxes)
{
}
//
// Check Conditions if has Breaked Boxes ...
bool hasBreakedBoxes = hasWorkingZone &&
workingZone.HasBreakedBoxes();
if (hasBreakedBoxes)
{
}
//
// Checking Other Conditions ...
if (!hasSignalBox)
{
//
// Senari A ...
hasSignalBox = hasWorkingZone &&
workingZone.DetectSenarioASignalBox(
signalBox,
signalBoxDir,
decisionXConditions,
analyseXConditions,
decisionCycleHelper,
drawer,
zIndex //
);
if (hasSignalBox)
{
//
signalBox.to = cTime;
isSignalBoxReversal = false;
provider = X121SMC_XWZ_PROVIDER_PV_ZONE;
}
//
// Validating Signal Box if Exists ...
if (hasSignalBox)
{
//
// Validate Signal Boxes using Inside Box ...
if (hasInsideBoxes)
{
//
int idx = -1;
bool has = false;
//
idx =
IsBullish(signalBoxDir)
? GetLowest(workingZone.insideBoxes)
: GetHighest(workingZone.insideBoxes);
has = IsValidIndex(idx);
if (has)
{
//
hasSignalBox =
signalBoxDir == workingZone.insideBoxes[idx].dir;
}
}
//
// Validate Signal Box Using Overal Trend ...
if (hasWorkingZoneOveralDirection)
{
//
hasSignalBox =
signalBoxDir == wzOveralDir;
}
}
}
//
//
//
// //
// Cleanup Signal if UnApproved ... // Cleanup Signal if UnApproved ...
if (!hasSignalBox) if (!hasSignalBox)
@@ -798,13 +585,13 @@ class XCX121SMCXWZSignalDetector : public XCBase
// Force Add TP 2 as Target ... // Force Add TP 2 as Target ...
double risk = MathAbs(entry - sl); double risk = MathAbs(entry - sl);
double reward2 = 2 * risk; double reward2 = 2 * risk;
double iTP2 = isBullish // double iTP2 = isBullish
? entry + reward2 // ? entry + reward2
: entry - reward2; // : entry - reward2;
Add( // Add(
iTP2, // iTP2,
targets // // targets //
); // );
// //
// Based On Priority ... // Based On Priority ...
@@ -1070,63 +857,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
break; break;
} }
} }
//
XBoxZone waitingBoxes[];
has = workingZone.HasWaitingBoxes();
if (has)
{
//
Copy(
workingZone.waitingBoxes,
waitingBoxes //
);
//
while (HasChild(waitingBoxes))
{
//
XBoxZone iBox;
idx = GetYoungest(waitingBoxes);
has = IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
iBox = waitingBoxes[idx];
ArrayRemove(
waitingBoxes,
idx,
1 //
);
//
bool hasInside = workingZone.HasInsideBox(iBox);
if (!hasInside)
{
continue;
}
//
double iTarget =
IsBullish(signalBoxDir)
? iBox.lower
: iBox.upper;
//
Add(
iTarget,
targets //
);
//
iBox.Clean();
}
}
} }
// //
@@ -1172,17 +902,17 @@ class XCX121SMCXWZSignalDetector : public XCBase
workingZone.Draw( workingZone.Draw(
drawer, drawer,
// //
true, // Draw Waiting Boxes ...
true, // Draw Inside Boxes ...
true, // Draw Breaked Boxes ...
//
true, // Draw Supply Zone ... true, // Draw Supply Zone ...
true, // Draw Demand Zone ... true, // Draw Demand Zone ...
true, // Draw Supply Zones ... true // Draw Waiting Zones ...
true, // Draw Demand Zones ... //
true, // Draw Support Zones ...
true // Draw Resistance Zones ...
); );
//
if (hasWaitingZones)
{
Print("Has Waiting Zones ...");
}
} }
// //
File diff suppressed because it is too large Load Diff
@@ -768,8 +768,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// //
// XPV ... // XPV ...
x121Inputs.xpvInputs.showSar = showAll || false; x121Inputs.xpvInputs.showSar = showAll || false;
x121Inputs.xpvInputs.showPeaks = showAll || false; x121Inputs.xpvInputs.showPeaks = showAll || true;
x121Inputs.xpvInputs.showVales = showAll || false; x121Inputs.xpvInputs.showVales = showAll || true;
// //
// XHK ... // XHK ...