last ...
This commit is contained in:
@@ -1699,6 +1699,692 @@ if (useSenario1)
|
||||
Print("Has Inside Box ...");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
XOBFVG waitingZones[];
|
||||
XOBFVG unavailableZones[];
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
bool DetectZone(
|
||||
X121SMCStrategySignalProviderData & provider //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid() &&
|
||||
provider.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int idx = -1;
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
XOBFVG obFVG;
|
||||
XBoxZone obBox;
|
||||
XBoxZone fvgBox;
|
||||
XBoxZone supplyBox;
|
||||
XBoxZone demandBox;
|
||||
|
||||
//
|
||||
XCFVG *fvg = NULL;
|
||||
XCOrderBlock *ob = NULL;
|
||||
XCSupplyZone *supply = NULL;
|
||||
XCDemandZone *demand = NULL;
|
||||
|
||||
//
|
||||
// Check New Supply Zone Detection ...
|
||||
bool hasNewSupply =
|
||||
Contains(
|
||||
X_SUPPLY_ZONE_DETECTED,
|
||||
provider.consolidationPoiEvents //
|
||||
);
|
||||
if (hasNewSupply)
|
||||
{
|
||||
//
|
||||
idx = GetYoungest(provider
|
||||
.consolidationState
|
||||
.supplyZones //
|
||||
);
|
||||
has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
supply = provider
|
||||
.consolidationState
|
||||
.supplyZones[idx];
|
||||
has = ToBox(
|
||||
supplyBox,
|
||||
supply //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
supply.To(cTime);
|
||||
supplyBox.to = cTime;
|
||||
hasNewSupply = supplyBox.IsValid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check New Demand Zone Detection ...
|
||||
bool hasNewDemand =
|
||||
Contains(
|
||||
X_DEMAND_ZONE_DETECTED,
|
||||
provider
|
||||
.consolidationPoiEvents //
|
||||
);
|
||||
if (hasNewDemand)
|
||||
{
|
||||
//
|
||||
idx = GetYoungest(provider
|
||||
.consolidationState
|
||||
.demandZones //
|
||||
);
|
||||
has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
demand = provider
|
||||
.consolidationState
|
||||
.demandZones[idx];
|
||||
has = ToBox(
|
||||
demandBox,
|
||||
demand //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
demand.To(cTime);
|
||||
demandBox.to = cTime;
|
||||
hasNewDemand = demandBox.IsValid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check New Fair Value Gap Detection ...
|
||||
bool hasNewFairValueGap =
|
||||
Contains(
|
||||
X_BULLISH_FVG_DETECTED,
|
||||
provider
|
||||
.analysePoiEvents //
|
||||
) ||
|
||||
Contains(
|
||||
X_BEARISH_FVG_DETECTED,
|
||||
provider
|
||||
.analysePoiEvents //
|
||||
);
|
||||
if (hasNewFairValueGap)
|
||||
{
|
||||
//
|
||||
idx = GetYoungest(provider
|
||||
.analyseState
|
||||
.fairValueGaps //
|
||||
);
|
||||
has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
fvg = provider
|
||||
.analyseState
|
||||
.fairValueGaps[idx];
|
||||
has = ToBox(
|
||||
fvgBox,
|
||||
fvg //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
fvg.To(cTime);
|
||||
fvgBox.to = cTime;
|
||||
hasNewFairValueGap = fvgBox.IsValid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check New Order Block Detection ...
|
||||
bool hasNewOrderBlock =
|
||||
Contains(
|
||||
X_BULLISH_ORDERBLOCK_DETECTED,
|
||||
provider
|
||||
.consolidationPoiEvents //
|
||||
) ||
|
||||
Contains(
|
||||
X_BEARISH_ORDERBLOCK_DETECTED,
|
||||
provider
|
||||
.consolidationPoiEvents //
|
||||
);
|
||||
if (hasNewOrderBlock)
|
||||
{
|
||||
//
|
||||
idx = GetYoungest(provider
|
||||
.consolidationState
|
||||
.orderBlocks //
|
||||
);
|
||||
has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ob = provider
|
||||
.consolidationState
|
||||
.orderBlocks[idx];
|
||||
has = ToBox(
|
||||
obBox,
|
||||
ob //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ob.To(cTime);
|
||||
obBox.to = cTime;
|
||||
hasNewOrderBlock = obBox.IsValid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Detect OB FVG ...
|
||||
if (hasNewOrderBlock)
|
||||
{
|
||||
//
|
||||
XOHCL obStartedBar;
|
||||
bool isOBStartedBodyOut = false;
|
||||
bool isOBStarted = ob.IsStarted(
|
||||
ob.GetDirection(),
|
||||
obStartedBar,
|
||||
isOBStartedBodyOut //
|
||||
);
|
||||
|
||||
//
|
||||
has = isOBStarted;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
obFVG.ob = ob;
|
||||
|
||||
//
|
||||
// Select FVGs ...
|
||||
count = provider
|
||||
.analyseState
|
||||
.CountFairValueGaps();
|
||||
has = IsValidSize(count);
|
||||
if (!has)
|
||||
{
|
||||
obFVG.Clean();
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Select FVG ...
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCFVG *iFVG = provider
|
||||
.analyseState
|
||||
.fairValueGaps[i];
|
||||
bool isBullish = iFVG.IsBullish();
|
||||
|
||||
//
|
||||
XOHCL iStartedBar;
|
||||
bool isBodyOut = false;
|
||||
bool isStarted = iFVG.IsStarted(
|
||||
iFVG.GetDirection(),
|
||||
iStartedBar,
|
||||
isBodyOut //
|
||||
);
|
||||
iStartedBar.Clean();
|
||||
|
||||
//
|
||||
bool isKindPassed = isStarted &&
|
||||
isBodyOut;
|
||||
bool isSameDir = iFVG.GetDirection() == ob.GetDirection();
|
||||
bool isFromPassed = iFVG.From() >= obStartedBar.time;
|
||||
bool isPlacePassed =
|
||||
//
|
||||
IsInsideOrDiff(
|
||||
iFVG,
|
||||
ob //
|
||||
)
|
||||
//
|
||||
// ||
|
||||
// //
|
||||
// (isBullish
|
||||
// ? IsAboveDiff(
|
||||
// iFVG,
|
||||
// ob,
|
||||
// true // Ignore Inside ...
|
||||
// )
|
||||
// : IsBelowDiff(
|
||||
// iFVG,
|
||||
// ob,
|
||||
// true // Ignore Inside ...
|
||||
// )
|
||||
// //
|
||||
// )
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
has = isSameDir &&
|
||||
isKindPassed &&
|
||||
isFromPassed &&
|
||||
isPlacePassed;
|
||||
if (has)
|
||||
{
|
||||
obFVG.AddFVG(iFVG);
|
||||
}
|
||||
|
||||
//
|
||||
ZeroMemory(iFVG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
has = obFVG.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
has = IsExists(obFVG);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
// New Waiting Zone ...
|
||||
AddRef(
|
||||
obFVG,
|
||||
waitingZones //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Check Item Is not Exists ...
|
||||
idx = FindIndex(
|
||||
obFVG,
|
||||
waitingZones //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
// Update Exists Waiting Zone ...
|
||||
waitingZones[idx].AddFVG(fvg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
obFVG.Clean();
|
||||
obStartedBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
bool lookingOthers = false;
|
||||
if (lookingOthers)
|
||||
{
|
||||
//
|
||||
// Check New Order Block Detection Analyse ...
|
||||
XBoxZone analyseOBBox;
|
||||
XCOrderBlock *analyseOB = NULL;
|
||||
bool hasNewAnalyseOrderBlock =
|
||||
Contains(
|
||||
X_BULLISH_ORDERBLOCK_DETECTED,
|
||||
provider
|
||||
.analysePoiEvents //
|
||||
) ||
|
||||
Contains(
|
||||
X_BEARISH_ORDERBLOCK_DETECTED,
|
||||
provider
|
||||
.analysePoiEvents //
|
||||
);
|
||||
if (hasNewAnalyseOrderBlock)
|
||||
{
|
||||
//
|
||||
idx = GetYoungest(provider
|
||||
.analyseState
|
||||
.orderBlocks //
|
||||
);
|
||||
has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
analyseOB = provider
|
||||
.analyseState
|
||||
.orderBlocks[idx];
|
||||
has = ToBox(
|
||||
analyseOBBox,
|
||||
analyseOB //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
analyseOB.To(cTime);
|
||||
analyseOBBox.to = cTime;
|
||||
hasNewAnalyseOrderBlock = analyseOBBox.IsValid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Analyse Order Block ...
|
||||
if (hasNewAnalyseOrderBlock)
|
||||
{
|
||||
//
|
||||
XOHCL obStartedBar;
|
||||
bool isOBStartedBodyOut = false;
|
||||
bool isOBStarted = analyseOB.IsStarted(
|
||||
analyseOB.GetDirection(),
|
||||
obStartedBar,
|
||||
isOBStartedBodyOut //
|
||||
);
|
||||
|
||||
//
|
||||
has = isOBStarted &&
|
||||
isOBStartedBodyOut;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
analyseOBBox.from =
|
||||
obStartedBar.NextAt();
|
||||
|
||||
//
|
||||
has = IsExists(analyseOBBox);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
analyseOBBox,
|
||||
waitingBoxes //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
analyseOBBox.Clean();
|
||||
ZeroMemory(analyseOB);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
result = HasWaitingZones();
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
obFVG.Clean();
|
||||
obBox.Clean();
|
||||
fvgBox.Clean();
|
||||
supplyBox.Clean();
|
||||
demandBox.Clean();
|
||||
|
||||
//
|
||||
ZeroMemory(ob);
|
||||
ZeroMemory(fvg);
|
||||
ZeroMemory(supply);
|
||||
ZeroMemory(demand);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
int ValidateWaitingZones(
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
if (barIndex == 0)
|
||||
{
|
||||
barIndex = 1;
|
||||
}
|
||||
|
||||
//
|
||||
has = IsValid() &&
|
||||
HasWaitingZones();
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int removeIDX[];
|
||||
result = CountWaitingZones();
|
||||
for (int i = 0; i < result; i++)
|
||||
{
|
||||
//
|
||||
has = waitingZones[i].IsValidZone(
|
||||
barIndex //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
i,
|
||||
removeIDX //
|
||||
);
|
||||
|
||||
//
|
||||
AddRef(
|
||||
waitingZones[i],
|
||||
unavailableZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
has = HasChild(removeIDX);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
CleanupArray(
|
||||
removeIDX,
|
||||
waitingZones //
|
||||
);
|
||||
}
|
||||
Clean(removeIDX);
|
||||
|
||||
//
|
||||
result = CountWaitingZones();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
bool IsExists(XOBFVG & zone)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Check Validation ...
|
||||
result = zone.IsValid() &&
|
||||
(HasWaitingZones() ||
|
||||
HasUnavailableZones());
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int idx = -1;
|
||||
|
||||
//
|
||||
// Check Index in Waiting Zones ...
|
||||
idx = FindIndex(
|
||||
zone,
|
||||
waitingZones //
|
||||
);
|
||||
result = IsValidIndex(idx);
|
||||
if (result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Index in Unavailable Zones ...
|
||||
idx = FindIndex(
|
||||
zone,
|
||||
unavailableZones //
|
||||
);
|
||||
result = IsValidIndex(idx);
|
||||
if (result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
Clean(waitingZones);
|
||||
Clean(unavailableZones);
|
||||
|
||||
//
|
||||
bool HasWaitingZones()
|
||||
{
|
||||
return HasChild(waitingZones);
|
||||
}
|
||||
|
||||
//
|
||||
int CountWaitingZones()
|
||||
{
|
||||
return ArraySize(waitingZones);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasUnavailableZones()
|
||||
{
|
||||
return HasChild(unavailableZones);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
has = HasWaitingZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = CountWaitingZones();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
waitingZones[i].UpdateTo(value);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
has = HasWaitingZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = CountWaitingZones();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCBaseObject *iObjects[];
|
||||
int iObjectsCount = drawer.DrawOBFVG(
|
||||
waitingZones[i],
|
||||
iObjects,
|
||||
true, // Draw Order Block ...
|
||||
true, // Draw Fair Value Gaps ...
|
||||
true, // Draw All Fair Value Gaps ...
|
||||
//
|
||||
true, // Draw OB StartedBar ...
|
||||
true, // Draw OB ActivatedBar ...
|
||||
true, // Draw OB BreakedBar ...
|
||||
true, // Draw OB WorkedBar ...
|
||||
//
|
||||
true, // Draw FVG StartedBar ...
|
||||
true, // Draw FVG ActivatedBar ...
|
||||
true, // Draw FVG BreakedBar ...
|
||||
true // Draw FVG WorkedBar ...
|
||||
//
|
||||
);
|
||||
has = IsValidSize(iObjectsCount);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int j = 0; j < iObjectsCount; j++)
|
||||
{
|
||||
mDrawnObjects.Add(iObjects[j]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// if (drawWaitingZonesBoxArea)
|
||||
// {
|
||||
// //
|
||||
// XBoxZone iBox;
|
||||
// has = waitingZones[i].ToZone(
|
||||
// iBox //
|
||||
// );
|
||||
// if (has)
|
||||
// {
|
||||
// //
|
||||
// XCBoxObject *iBoxObj;
|
||||
// has = drawer.DrawBox(
|
||||
// iBox,
|
||||
// iBoxObj //
|
||||
// );
|
||||
// if (has)
|
||||
// {
|
||||
// mDrawnObjects.Add(iBoxObj);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -61,9 +61,7 @@ bool IsValid(ENUM_X_CYCLES value)
|
||||
|
||||
//
|
||||
result =
|
||||
value != X_CYCLE_NONE ||
|
||||
value != X_CYCLE_TRIGGER ||
|
||||
value != X_CYCLE_VERIFICATION;
|
||||
value != X_CYCLE_NONE;
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -923,6 +921,17 @@ struct X121SMCStrategySignalProviderData
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Trigger ...
|
||||
XPOIState triggerState;
|
||||
double triggerBullishScore;
|
||||
double triggerBearishScore;
|
||||
X121Conditions triggerXConditions;
|
||||
ENUM_XPOI_EVENTS triggerPoiEvents[];
|
||||
XC121SMCCycleHelper *triggerCycleHelper;
|
||||
ENUM_X_CYCLE_EVENTS triggerCycleEvents[];
|
||||
X121SMCCycleConditions triggerConditions;
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
XPOIState decisionState;
|
||||
@@ -945,6 +954,17 @@ struct X121SMCStrategySignalProviderData
|
||||
ENUM_X_CYCLE_EVENTS analyseCycleEvents[];
|
||||
X121SMCCycleConditions analyseConditions;
|
||||
|
||||
//
|
||||
// Verification ...
|
||||
XPOIState verificationState;
|
||||
double verificationBullishScore;
|
||||
double verificationBearishScore;
|
||||
X121Conditions verificationXConditions;
|
||||
ENUM_XPOI_EVENTS verificationPoiEvents[];
|
||||
XC121SMCCycleHelper *verificationCycleHelper;
|
||||
ENUM_X_CYCLE_EVENTS verificationCycleEvents[];
|
||||
X121SMCCycleConditions verificationConditions;
|
||||
|
||||
//
|
||||
// Consolidation ...
|
||||
XPOIState consolidationState;
|
||||
@@ -981,6 +1001,16 @@ struct X121SMCStrategySignalProviderData
|
||||
// Cleanup ...
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Trigger ...
|
||||
triggerState.Clean();
|
||||
triggerBullishScore = 0;
|
||||
triggerBearishScore = 0;
|
||||
Clean(triggerPoiEvents);
|
||||
Clean(triggerCycleEvents);
|
||||
triggerConditions.Clean();
|
||||
triggerXConditions.Clean();
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
decisionState.Clean();
|
||||
@@ -1001,6 +1031,16 @@ struct X121SMCStrategySignalProviderData
|
||||
analyseConditions.Clean();
|
||||
analyseXConditions.Clean();
|
||||
|
||||
//
|
||||
// Verification ...
|
||||
verificationState.Clean();
|
||||
verificationBullishScore = 0;
|
||||
verificationBearishScore = 0;
|
||||
Clean(verificationPoiEvents);
|
||||
Clean(verificationCycleEvents);
|
||||
verificationConditions.Clean();
|
||||
verificationXConditions.Clean();
|
||||
|
||||
//
|
||||
// Consolidation ...
|
||||
consolidationState.Clean();
|
||||
@@ -1029,10 +1069,12 @@ struct X121SMCStrategySignalProviderData
|
||||
Clean();
|
||||
|
||||
//
|
||||
ZeroMemory(decisionCycleHelper);
|
||||
ZeroMemory(analyseCycleHelper);
|
||||
ZeroMemory(consolidationCycleHelper);
|
||||
ZeroMemory(visionCycleHelper);
|
||||
ZeroMemory(triggerCycleHelper);
|
||||
ZeroMemory(analyseCycleHelper);
|
||||
ZeroMemory(decisionCycleHelper);
|
||||
ZeroMemory(verificationCycleHelper);
|
||||
ZeroMemory(consolidationCycleHelper);
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
@@ -1047,8 +1089,10 @@ struct X121SMCStrategySignalProviderData
|
||||
//
|
||||
result =
|
||||
visionCycleHelper != NULL &&
|
||||
triggerCycleHelper != NULL &&
|
||||
analyseCycleHelper != NULL &&
|
||||
decisionCycleHelper != NULL &&
|
||||
verificationCycleHelper != NULL &&
|
||||
consolidationCycleHelper != NULL;
|
||||
|
||||
//
|
||||
@@ -1058,8 +1102,10 @@ struct X121SMCStrategySignalProviderData
|
||||
//
|
||||
// Initialize ...
|
||||
bool Init(
|
||||
XC121SMCCycleHelper *_triggerCycleHelper,
|
||||
XC121SMCCycleHelper *_decisionCycleHelper,
|
||||
XC121SMCCycleHelper *_analyseCycleHelper,
|
||||
XC121SMCCycleHelper *_verificationCycleHelper,
|
||||
XC121SMCCycleHelper *_consolidationCycleHelper,
|
||||
XC121SMCCycleHelper *_visionCycleHelper //
|
||||
)
|
||||
@@ -1072,8 +1118,10 @@ struct X121SMCStrategySignalProviderData
|
||||
result =
|
||||
//
|
||||
_visionCycleHelper != NULL &&
|
||||
_triggerCycleHelper != NULL &&
|
||||
_analyseCycleHelper != NULL &&
|
||||
_decisionCycleHelper != NULL &&
|
||||
_verificationCycleHelper != NULL &&
|
||||
_consolidationCycleHelper != NULL
|
||||
//
|
||||
;
|
||||
@@ -1084,8 +1132,10 @@ struct X121SMCStrategySignalProviderData
|
||||
|
||||
//
|
||||
visionCycleHelper = _visionCycleHelper;
|
||||
triggerCycleHelper = _triggerCycleHelper;
|
||||
analyseCycleHelper = _analyseCycleHelper;
|
||||
decisionCycleHelper = _decisionCycleHelper;
|
||||
verificationCycleHelper = _verificationCycleHelper;
|
||||
consolidationCycleHelper = _consolidationCycleHelper;
|
||||
|
||||
//
|
||||
@@ -1124,6 +1174,28 @@ struct X121SMCStrategySignalProviderData
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Trigger ...
|
||||
result = triggerCycleHelper.GetConditions(
|
||||
triggerCycleEvents,
|
||||
triggerPoiEvents,
|
||||
triggerConditions,
|
||||
barIndex,
|
||||
loopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Clean(triggerPoiEvents);
|
||||
Clean(triggerCycleEvents);
|
||||
|
||||
//
|
||||
triggerConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
result = decisionCycleHelper.GetConditions(
|
||||
@@ -1136,10 +1208,11 @@ struct X121SMCStrategySignalProviderData
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Clean(triggerPoiEvents);
|
||||
Clean(decisionPoiEvents);
|
||||
Clean(triggerCycleEvents);
|
||||
triggerConditions.Clean();
|
||||
Clean(decisionCycleEvents);
|
||||
|
||||
//
|
||||
decisionConditions.Clean();
|
||||
|
||||
//
|
||||
@@ -1158,16 +1231,44 @@ struct X121SMCStrategySignalProviderData
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Clean(triggerPoiEvents);
|
||||
Clean(analysePoiEvents);
|
||||
Clean(decisionPoiEvents);
|
||||
|
||||
//
|
||||
Clean(triggerCycleEvents);
|
||||
Clean(analyseCycleEvents);
|
||||
triggerConditions.Clean();
|
||||
analyseConditions.Clean();
|
||||
Clean(decisionCycleEvents);
|
||||
decisionConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Verification ...
|
||||
result = verificationCycleHelper.GetConditions(
|
||||
verificationCycleEvents,
|
||||
verificationPoiEvents,
|
||||
verificationConditions,
|
||||
barIndex,
|
||||
loopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Clean(triggerPoiEvents);
|
||||
Clean(analysePoiEvents);
|
||||
Clean(decisionPoiEvents);
|
||||
Clean(triggerCycleEvents);
|
||||
Clean(analyseCycleEvents);
|
||||
triggerConditions.Clean();
|
||||
analyseConditions.Clean();
|
||||
Clean(decisionCycleEvents);
|
||||
decisionConditions.Clean();
|
||||
Clean(verificationPoiEvents);
|
||||
Clean(verificationCycleEvents);
|
||||
verificationConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -1185,18 +1286,20 @@ struct X121SMCStrategySignalProviderData
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Clean(triggerPoiEvents);
|
||||
Clean(analysePoiEvents);
|
||||
Clean(decisionPoiEvents);
|
||||
Clean(consolidationPoiEvents);
|
||||
|
||||
//
|
||||
Clean(triggerCycleEvents);
|
||||
Clean(analyseCycleEvents);
|
||||
Clean(decisionCycleEvents);
|
||||
Clean(consolidationCycleEvents);
|
||||
|
||||
//
|
||||
triggerConditions.Clean();
|
||||
analyseConditions.Clean();
|
||||
Clean(decisionCycleEvents);
|
||||
decisionConditions.Clean();
|
||||
Clean(verificationPoiEvents);
|
||||
Clean(consolidationPoiEvents);
|
||||
Clean(verificationCycleEvents);
|
||||
verificationConditions.Clean();
|
||||
Clean(consolidationCycleEvents);
|
||||
consolidationConditions.Clean();
|
||||
|
||||
//
|
||||
@@ -1216,20 +1319,22 @@ struct X121SMCStrategySignalProviderData
|
||||
{
|
||||
//
|
||||
Clean(visionPoiEvents);
|
||||
Clean(triggerPoiEvents);
|
||||
Clean(analysePoiEvents);
|
||||
Clean(decisionPoiEvents);
|
||||
Clean(consolidationPoiEvents);
|
||||
|
||||
//
|
||||
Clean(visionCycleEvents);
|
||||
Clean(analyseCycleEvents);
|
||||
Clean(decisionCycleEvents);
|
||||
Clean(consolidationCycleEvents);
|
||||
|
||||
//
|
||||
visionConditions.Clean();
|
||||
Clean(decisionPoiEvents);
|
||||
Clean(triggerCycleEvents);
|
||||
Clean(analyseCycleEvents);
|
||||
triggerConditions.Clean();
|
||||
analyseConditions.Clean();
|
||||
Clean(decisionCycleEvents);
|
||||
decisionConditions.Clean();
|
||||
Clean(verificationPoiEvents);
|
||||
Clean(consolidationPoiEvents);
|
||||
Clean(verificationCycleEvents);
|
||||
verificationConditions.Clean();
|
||||
Clean(consolidationCycleEvents);
|
||||
consolidationConditions.Clean();
|
||||
|
||||
//
|
||||
@@ -1238,17 +1343,28 @@ struct X121SMCStrategySignalProviderData
|
||||
|
||||
//
|
||||
// Cycles POI States ...
|
||||
decisionState = decisionConditions.state;
|
||||
analyseState = analyseConditions.state;
|
||||
consolidationState = consolidationConditions.state;
|
||||
visionState = visionConditions.state;
|
||||
triggerState = triggerConditions.state;
|
||||
analyseState = analyseConditions.state;
|
||||
decisionState = decisionConditions.state;
|
||||
verificationState = verificationConditions.state;
|
||||
consolidationState = consolidationConditions.state;
|
||||
|
||||
//
|
||||
// Cycle X121Conditions ...
|
||||
decisionXConditions = decisionConditions.x121Conditions;
|
||||
analyseXConditions = analyseConditions.x121Conditions;
|
||||
consolidationXConditions = consolidationConditions.x121Conditions;
|
||||
visionXConditions = visionConditions.x121Conditions;
|
||||
triggerXConditions = triggerConditions.x121Conditions;
|
||||
analyseXConditions = analyseConditions.x121Conditions;
|
||||
decisionXConditions = decisionConditions.x121Conditions;
|
||||
verificationXConditions = verificationConditions.x121Conditions;
|
||||
consolidationXConditions = consolidationConditions.x121Conditions;
|
||||
|
||||
//
|
||||
// Trigger ...
|
||||
triggerXConditions.GenerateScore(
|
||||
triggerBullishScore,
|
||||
triggerBearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
@@ -1264,6 +1380,13 @@ struct X121SMCStrategySignalProviderData
|
||||
analyseBearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
// Verification ...
|
||||
verificationXConditions.GenerateScore(
|
||||
verificationBullishScore,
|
||||
verificationBearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
// Consolidation ...
|
||||
consolidationXConditions.GenerateScore(
|
||||
@@ -2919,7 +3042,7 @@ struct X121SMCStrategyConditionParser
|
||||
X121SMCStrategySignalProviderData &provider,
|
||||
int barIndex = 0,
|
||||
bool forceBarType = false,
|
||||
bool forceFiboPressure = false, //
|
||||
bool forceFiboPressure = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -3102,7 +3225,7 @@ struct X121SMCStrategyConditionParser
|
||||
// Update Inside Box From and To ...
|
||||
// Based on Breaked ...
|
||||
insideBox.from = insideBox.to;
|
||||
insideBox.to = cTime;
|
||||
insideBox.to = TimeCurrent();
|
||||
|
||||
//
|
||||
// Detect Breaked Box Direction ...
|
||||
|
||||
@@ -225,8 +225,11 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
if (hasWaitingBoxes)
|
||||
{
|
||||
//
|
||||
workingZone
|
||||
.ValidateWaitingBoxes(zIndex);
|
||||
// Validate Working Zone Waiting Boxes ...
|
||||
workingZone.ValidateWaitingBoxes(zIndex);
|
||||
|
||||
//
|
||||
// Double Check Has Waiting Boxes or not ...
|
||||
hasWaitingBoxes = workingZone.HasWaitingBoxes();
|
||||
}
|
||||
|
||||
@@ -260,10 +263,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
}
|
||||
|
||||
//
|
||||
// Start Draw ...
|
||||
//
|
||||
|
||||
//
|
||||
// Update Models To Time ...
|
||||
UpdateTo(cTime);
|
||||
|
||||
//
|
||||
@@ -281,10 +281,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// End Draw ...
|
||||
//
|
||||
|
||||
//
|
||||
// Detect Signal Box ...
|
||||
hasSignalBox =
|
||||
@@ -304,21 +300,21 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
//
|
||||
// Remove Signal Box from UnAvailable Box ...
|
||||
// if Exists ...
|
||||
bool hasUnAvailableBoxes = workingZone
|
||||
.HasUnavailableBoxes();
|
||||
if (hasUnAvailableBoxes)
|
||||
bool hasBreakedBoxes = workingZone
|
||||
.HasBreakedBoxes();
|
||||
if (hasBreakedBoxes)
|
||||
{
|
||||
//
|
||||
int idx = FindIndex(
|
||||
signalBox,
|
||||
workingZone.unavailableBoxes //
|
||||
workingZone.breakedBoxes //
|
||||
);
|
||||
bool has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
workingZone.unavailableBoxes,
|
||||
workingZone.breakedBoxes,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
@@ -352,20 +348,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Remove InValidate Boxes ...
|
||||
if (hasWaitingBoxes)
|
||||
{
|
||||
//
|
||||
// Validate Waiting Boxes ...
|
||||
workingZone.ValidateWaitingBoxes(zIndex);
|
||||
hasWaitingBoxes = workingZone.HasWaitingBoxes();
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Cleanup Signal if UnApproved ...
|
||||
if (!hasSignalBox)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -112,8 +112,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
void Destroy() override
|
||||
{
|
||||
//
|
||||
ZeroMemory(mTriggerCycleHelper);
|
||||
ZeroMemory(mDecisionCycleHelper);
|
||||
ZeroMemory(mAnalyseCycleHelper);
|
||||
ZeroMemory(mVerificationCycleHelper);
|
||||
ZeroMemory(mConsolidationCycleHelper);
|
||||
ZeroMemory(mVisionCycleHelper);
|
||||
|
||||
@@ -487,6 +489,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// XC121SMCCycleHelper *mTriggerCycleHelper;
|
||||
XC121SMCCycleHelper *mTriggerCycleHelper;
|
||||
XC121SMCCycleHelper *mDecisionCycleHelper;
|
||||
XC121SMCCycleHelper *mAnalyseCycleHelper;
|
||||
XC121SMCCycleHelper *mVerificationCycleHelper;
|
||||
@@ -509,21 +512,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Cycle Helpers ...
|
||||
result =
|
||||
//
|
||||
mVisionCycleHelper != NULL &&
|
||||
mAnalyseCycleHelper != NULL &&
|
||||
mDecisionCycleHelper != NULL &&
|
||||
mConsolidationCycleHelper != NULL
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
@@ -867,7 +855,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
mDecisionCycleHelper = new XC121SMCCycleHelper();
|
||||
isInited = mDecisionCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_M5,
|
||||
PERIOD_M1,
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
@@ -919,6 +907,63 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
mDecisionCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
||||
}
|
||||
|
||||
//
|
||||
// Trigger Cycle ...
|
||||
mTriggerCycleHelper = new XC121SMCCycleHelper();
|
||||
isInited = mTriggerCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_M5,
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
// Configure POI Drawer ...
|
||||
color bullishColor = clrDodgerBlue;
|
||||
color bearishColor = clrSienna;
|
||||
|
||||
//
|
||||
// Bars ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
||||
|
||||
//
|
||||
// Swings ...
|
||||
mTriggerCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
||||
|
||||
//
|
||||
// Momentum ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
||||
|
||||
//
|
||||
// Rejection ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
||||
|
||||
//
|
||||
// Support and Resistance ...
|
||||
mTriggerCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
||||
|
||||
//
|
||||
// Demand and Supply ...
|
||||
mTriggerCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
||||
|
||||
//
|
||||
// Order Blocks ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
||||
|
||||
//
|
||||
// Fair Value Gaps ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
||||
}
|
||||
|
||||
//
|
||||
// Analyse Cycle ...
|
||||
mAnalyseCycleHelper = new XC121SMCCycleHelper();
|
||||
@@ -976,6 +1021,63 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
mAnalyseCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
||||
}
|
||||
|
||||
//
|
||||
// Verification Cycle ...
|
||||
mVerificationCycleHelper = new XC121SMCCycleHelper();
|
||||
isInited = mVerificationCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_M30,
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
// Configure POI Drawer ...
|
||||
color bullishColor = clrDodgerBlue;
|
||||
color bearishColor = clrSienna;
|
||||
|
||||
//
|
||||
// Bars ...
|
||||
mVerificationCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
||||
mVerificationCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
||||
|
||||
//
|
||||
// Swings ...
|
||||
mVerificationCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
||||
mVerificationCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
||||
|
||||
//
|
||||
// Momentum ...
|
||||
mVerificationCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
||||
mVerificationCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
||||
|
||||
//
|
||||
// Rejection ...
|
||||
mVerificationCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
||||
mVerificationCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
||||
|
||||
//
|
||||
// Support and Resistance ...
|
||||
mVerificationCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
||||
mVerificationCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
||||
|
||||
//
|
||||
// Demand and Supply ...
|
||||
mVerificationCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
||||
mVerificationCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
||||
|
||||
//
|
||||
// Order Blocks ...
|
||||
mVerificationCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
||||
mVerificationCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
||||
|
||||
//
|
||||
// Fair Value Gaps ...
|
||||
mVerificationCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
||||
mVerificationCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
||||
}
|
||||
|
||||
//
|
||||
// Consolidation Cycle ...
|
||||
mConsolidationCycleHelper = new XC121SMCCycleHelper();
|
||||
@@ -1093,8 +1195,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
// Initial Cycle Provider ...
|
||||
cycleProvider.Init(
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user