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
+34 -33
View File
@@ -4584,11 +4584,7 @@ class XCPOIDrawer : public XCBase
XCBaseObject *&objects[],
//
bool drawOrderBlock = true,
bool drawFairValueGap = true,
bool drawSupplyZones = true,
bool drawDemandZones = true,
bool drawSupportZones = true,
bool drawResistanceZones = true,
bool drawFairValueGaps = true,
//
bool drawOBStartedBar = true,
bool drawOBActivatedBar = true,
@@ -4699,41 +4695,46 @@ class XCPOIDrawer : public XCBase
//
// Fair Value Gap ...
has = item.HasFVG();
has = item.HasFVGs();
if (has &&
drawFairValueGap)
drawFairValueGaps)
{
//
Clean(tmpObjects);
count = DrawFairValueGap(
item.fvg,
tmpObjects,
drawFVGStartedBar,
drawFVGActivatedBar,
drawFVGBreakedBar,
drawFVGWorkedBar,
widthFVGStartedBar,
clrFVGStartedBar,
styleFVGStartedBar,
widthFVGActivatedBar,
clrFVGActivatedBar,
styleFVGActivatedBar,
widthFVGBreakedBar,
clrFVGBreakedBar,
styleFVGBreakedBar,
widthFVGWorkedBar,
clrFVGWorkedBar,
styleFVGWorkedBar //
);
has = IsValidSize(count);
if (has)
count = item.CountFVGs();
for (int i = 0; i < count; i++)
{
//
Copy(
Clean(tmpObjects);
int fvgsCount = DrawFairValueGap(
item.fvgs[i],
tmpObjects,
objects,
false //
drawFVGStartedBar,
drawFVGActivatedBar,
drawFVGBreakedBar,
drawFVGWorkedBar,
widthFVGStartedBar,
clrFVGStartedBar,
styleFVGStartedBar,
widthFVGActivatedBar,
clrFVGActivatedBar,
styleFVGActivatedBar,
widthFVGBreakedBar,
clrFVGBreakedBar,
styleFVGBreakedBar,
widthFVGWorkedBar,
clrFVGWorkedBar,
styleFVGWorkedBar //
);
has = IsValidSize(fvgsCount);
if (has)
{
//
Copy(
tmpObjects,
objects,
false //
);
}
}
}
+2696 -1
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 ...
XCFVG *fvg;
XCFVG *fvgs[];
XCOrderBlock *ob;
//
@@ -112,8 +112,8 @@ struct XOBFVG
void Clean()
{
//
Clean(fvgs);
ZeroMemory(ob);
ZeroMemory(fvg);
//
ZeroMemory(this);
@@ -123,7 +123,7 @@ struct XOBFVG
bool IsValid()
{
return HasOB() &&
HasFVG();
HasFVGs();
}
//
@@ -134,10 +134,15 @@ struct XOBFVG
}
//
bool HasFVG()
bool HasFVGs()
{
return fvg != NULL &&
fvg.IsValid();
return HasChild(fvgs);
}
//
int CountFVGs()
{
return ArraySize(fvgs);
}
//
@@ -300,6 +305,39 @@ struct XOBFVG
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)
{
@@ -308,8 +346,7 @@ struct XOBFVG
//
result = IsValid() &&
IsSame(ob, item.ob) &&
IsSame(fvg, item.fvg);
IsSame(ob, item.ob);
//
return result;
@@ -333,10 +370,15 @@ struct XOBFVG
}
//
has = HasFVG();
has = HasFVGs();
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 ...
//
+33 -303
View File
@@ -301,6 +301,10 @@ class XCX121SMCXWZSignalDetector : public XCBase
X121Conditions consolidationXConditions = consolidationConditions.x121Conditions;
X121Conditions visionXConditions = visionConditions.x121Conditions;
//
// Select Drawer Class ...
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
//
// Scores ...
@@ -323,8 +327,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
);
//
// Select Drawer Class ...
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
//
//
//
// Setup Conditions ...
@@ -338,6 +342,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
double amountPercent = 0;
bool hasPriority = false;
bool hasSignalBox = false;
bool hasWaitingZones = false;
bool hasRewardAmount = false;
bool isSignalBoxReversal = false;
bool hasWorkingZoneOveralDirection = false;
@@ -385,21 +390,22 @@ class XCX121SMCXWZSignalDetector : public XCBase
decisionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
consolidationCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
//
// Update Working Zone ...
workingZone.Update(
zIndex,
visionState,
consolidationState,
analyseState,
decisionState //
);
//
// Check Working Zone Overal Direction ...
hasWorkingZoneOveralDirection = workingZone
.DetectOveralDirection(wzOveralDir);
//
hasWaitingZones = workingZone.DetectZone(
drawer,
analysePoiEvents,
consolidationPoiEvents,
consolidationPoiEvents,
consolidationState,
analyseState,
consolidationState //
);
//
// Checking Working Zone Destory or not ...
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 ...
if (!hasSignalBox)
@@ -798,13 +585,13 @@ class XCX121SMCXWZSignalDetector : public XCBase
// Force Add TP 2 as Target ...
double risk = MathAbs(entry - sl);
double reward2 = 2 * risk;
double iTP2 = isBullish
? entry + reward2
: entry - reward2;
Add(
iTP2,
targets //
);
// double iTP2 = isBullish
// ? entry + reward2
// : entry - reward2;
// Add(
// iTP2,
// targets //
// );
//
// Based On Priority ...
@@ -1070,63 +857,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
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(
drawer,
//
true, // Draw Waiting Boxes ...
true, // Draw Inside Boxes ...
true, // Draw Breaked Boxes ...
//
true, // Draw Supply Zone ...
true, // Draw Demand Zone ...
true, // Draw Supply Zones ...
true, // Draw Demand Zones ...
true, // Draw Support Zones ...
true // Draw Resistance Zones ...
true // Draw Waiting 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 ...
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;
//
// XHK ...