This commit is contained in:
2025-03-23 03:46:13 +03:30
parent a84b0befe2
commit c49abe21db
10 changed files with 4204 additions and 2932 deletions
+119 -521
View File
@@ -23,8 +23,8 @@
// Imports ...
#include "../Classes/x-saherelm.base.class.mq5"
#include "../Classes/x-saherelm.x-cobject.class.mq5"
#include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
#include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
//
// Definitions ...
@@ -3325,6 +3325,124 @@ class XCPOIDrawer : public XCBase
return result;
}
/**
* Draw Signal Box ...
*
* @param box: XSignalBox instance Reference ...
* @param objects: XCBaseObject pointer instance Reference ...
*
* @return ( bool )
*/
bool DrawSignalBox(
XSignalBox &box,
XCBaseObject *&objects[],
color clr = CLR_NONE //
)
{
//
bool result = false;
//
Clean(objects);
//
bool has = false;
bool hasColor = clr != CLR_NONE;
//
// Order Block ...
if (box.ob.IsValid())
{
//
XCBoxObject *iObj;
has = DrawBox(
box.ob,
iObj //
);
if (has)
{
//
iObj.BoxStyle(STYLE_DASH);
//
if (hasColor)
{
iObj.BoxColor(clr);
}
//
Add(
(XCBaseObject *)iObj,
objects //
);
}
}
//
// Fair Value Gap ...
if (box.fvg.IsValid())
{
//
XCBoxObject *iObj;
has = DrawBox(
box.fvg,
iObj //
);
if (has)
{
//
iObj.BoxStyle(STYLE_SOLID);
//
if (hasColor)
{
iObj.BoxColor(clr);
}
//
Add(
(XCBaseObject *)iObj,
objects //
);
}
}
//
// Sharp Zone ...
if (box.sharp.IsValid())
{
//
XCBoxObject *iObj;
has = DrawBox(
box.sharp,
iObj //
);
if (has)
{
//
iObj.BoxStyle(STYLE_DOT);
//
if (hasColor)
{
iObj.BoxColor(clr);
}
//
Add(
(XCBaseObject *)iObj,
objects //
);
}
}
//
result = HasChild(objects);
//
return result;
}
/**
* Draw Specified POI State ...
*
@@ -4110,526 +4228,6 @@ class XCPOIDrawer : public XCBase
return result;
}
//
int DrawOrderBlock(
XCOrderBlock *zone,
XCBaseObject *&objects[],
//
bool drawStartedBar = true,
bool drawActivatedBar = true,
bool drawBreakedBar = true,
bool drawWorkedBar = true,
//
int widthStartedBar = 1,
color clrStartedBar = clrYellow,
ENUM_LINE_STYLE styleStartedBar = STYLE_SOLID,
//
int widthActivatedBar = 1,
color clrActivatedBar = clrLime,
ENUM_LINE_STYLE styleActivatedBar = STYLE_SOLID,
//
int widthBreakedBar = 1,
color clrBreakedBar = clrRed,
ENUM_LINE_STYLE styleBreakedBar = STYLE_SOLID,
//
int widthWorkedBar = 1,
color clrWorkedBar = clrAqua,
ENUM_LINE_STYLE styleWorkedBar = STYLE_SOLID
//
)
{
//
int result = 0;
//
Clean(objects);
//
if (zone == NULL ||
!zone.IsValid())
{
return result;
}
//
ENUM_X_DIRECTION zoneDir = zone.GetDirection();
//
// Started Bar ...
XOHCL startedBar;
bool isBodyOut = false;
bool isStarted = zone
.IsStarted(
zoneDir,
startedBar,
isBodyOut //
);
if (isStarted)
{
//
datetime iBarTo = startedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
startedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthStartedBar);
iBarObj.LowShadowWidth(widthStartedBar);
iBarObj.HighShadowWidth(widthStartedBar);
//
iBarObj.BodyStyle(styleStartedBar);
iBarObj.LowShadowStyle(styleStartedBar);
iBarObj.HighShadowStyle(styleStartedBar);
//
iBarObj.BodyColor(clrStartedBar);
iBarObj.LowShadowColor(clrStartedBar);
iBarObj.HighShadowColor(clrStartedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Activated Bar ...
XOHCL activatedBar;
bool isBodyIn = false;
bool isActivated = zone
.IsActivated(
zoneDir,
activatedBar,
isBodyIn,
false // Force Body Out Started ...
);
if (isActivated)
{
//
datetime iBarTo = activatedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
activatedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthActivatedBar);
iBarObj.LowShadowWidth(widthActivatedBar);
iBarObj.HighShadowWidth(widthActivatedBar);
//
iBarObj.BodyStyle(styleActivatedBar);
iBarObj.LowShadowStyle(styleActivatedBar);
iBarObj.HighShadowStyle(styleActivatedBar);
//
iBarObj.BodyColor(clrActivatedBar);
iBarObj.LowShadowColor(clrActivatedBar);
iBarObj.HighShadowColor(clrActivatedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Breaked Bar ...
XOHCL breakedBar;
isBodyOut = false;
bool isBreaked = zone
.IsBreaked(
zoneDir,
breakedBar,
isBodyOut,
false, // Ignore Start ...
false // Force Body Out Started ...
);
if (isBreaked)
{
//
datetime iBarTo = breakedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
breakedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthBreakedBar);
iBarObj.LowShadowWidth(widthBreakedBar);
iBarObj.HighShadowWidth(widthBreakedBar);
//
iBarObj.BodyStyle(styleBreakedBar);
iBarObj.LowShadowStyle(styleBreakedBar);
iBarObj.HighShadowStyle(styleBreakedBar);
//
iBarObj.BodyColor(clrBreakedBar);
iBarObj.LowShadowColor(clrBreakedBar);
iBarObj.HighShadowColor(clrBreakedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Worked Bar ...
XOHCL workedBar;
isBodyOut = false;
bool isWorked = zone
.IsWorked(
zoneDir,
workedBar,
isBodyOut,
false, // Ignore Activation ...
false, // Force Body Out Started ...
false // Force Body In Activated ...
);
if (isWorked)
{
//
datetime iBarTo = workedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
workedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthWorkedBar);
iBarObj.LowShadowWidth(widthWorkedBar);
iBarObj.HighShadowWidth(widthWorkedBar);
//
iBarObj.BodyStyle(styleWorkedBar);
iBarObj.LowShadowStyle(styleWorkedBar);
iBarObj.HighShadowStyle(styleWorkedBar);
//
iBarObj.BodyColor(clrWorkedBar);
iBarObj.LowShadowColor(clrWorkedBar);
iBarObj.HighShadowColor(clrWorkedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
XCBaseObject *iObj;
bool isCreated = CreateOrderBlock(
zone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
objects //
);
}
//
result = ArraySize(objects);
//
return result;
}
//
int DrawFairValueGap(
XCFVG *zone,
XCBaseObject *&objects[],
//
bool drawStartedBar = true,
bool drawActivatedBar = true,
bool drawBreakedBar = true,
bool drawWorkedBar = true,
//
int widthStartedBar = 1,
color clrStartedBar = clrYellow,
ENUM_LINE_STYLE styleStartedBar = STYLE_SOLID,
//
int widthActivatedBar = 1,
color clrActivatedBar = clrLime,
ENUM_LINE_STYLE styleActivatedBar = STYLE_SOLID,
//
int widthBreakedBar = 1,
color clrBreakedBar = clrRed,
ENUM_LINE_STYLE styleBreakedBar = STYLE_SOLID,
//
int widthWorkedBar = 1,
color clrWorkedBar = clrAqua,
ENUM_LINE_STYLE styleWorkedBar = STYLE_SOLID
//
)
{
//
int result = 0;
//
Clean(objects);
//
if (zone == NULL ||
!zone.IsValid())
{
return result;
}
//
ENUM_X_DIRECTION zoneDir = zone.GetDirection();
//
// Started Bar ...
XOHCL startedBar;
bool isBodyOut = false;
bool isStarted = zone
.IsStarted(
zoneDir,
startedBar,
isBodyOut //
);
if (isStarted)
{
//
datetime iBarTo = startedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
startedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthStartedBar);
iBarObj.LowShadowWidth(widthStartedBar);
iBarObj.HighShadowWidth(widthStartedBar);
//
iBarObj.BodyStyle(styleStartedBar);
iBarObj.LowShadowStyle(styleStartedBar);
iBarObj.HighShadowStyle(styleStartedBar);
//
iBarObj.BodyColor(clrStartedBar);
iBarObj.LowShadowColor(clrStartedBar);
iBarObj.HighShadowColor(clrStartedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Activated Bar ...
XOHCL activatedBar;
bool isBodyIn = false;
bool isActivated = zone
.IsActivated(
zoneDir,
activatedBar,
isBodyIn,
false // Force Body Out Started ...
);
if (isActivated)
{
//
datetime iBarTo = activatedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
activatedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthActivatedBar);
iBarObj.LowShadowWidth(widthActivatedBar);
iBarObj.HighShadowWidth(widthActivatedBar);
//
iBarObj.BodyStyle(styleActivatedBar);
iBarObj.LowShadowStyle(styleActivatedBar);
iBarObj.HighShadowStyle(styleActivatedBar);
//
iBarObj.BodyColor(clrActivatedBar);
iBarObj.LowShadowColor(clrActivatedBar);
iBarObj.HighShadowColor(clrActivatedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Breaked Bar ...
XOHCL breakedBar;
isBodyOut = false;
bool isBreaked = zone
.IsBreaked(
zoneDir,
breakedBar,
isBodyOut,
false, // Ignore Start ...
false // Force Body Out Started ...
);
if (isBreaked)
{
//
datetime iBarTo = breakedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
breakedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthBreakedBar);
iBarObj.LowShadowWidth(widthBreakedBar);
iBarObj.HighShadowWidth(widthBreakedBar);
//
iBarObj.BodyStyle(styleBreakedBar);
iBarObj.LowShadowStyle(styleBreakedBar);
iBarObj.HighShadowStyle(styleBreakedBar);
//
iBarObj.BodyColor(clrBreakedBar);
iBarObj.LowShadowColor(clrBreakedBar);
iBarObj.HighShadowColor(clrBreakedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Worked Bar ...
XOHCL workedBar;
isBodyOut = false;
bool isWorked = zone
.IsWorked(
zoneDir,
workedBar,
isBodyOut,
false, // Ignore Activation ...
false, // Force Body Out Started ...
false // Force Body In Activated ...
);
if (isWorked)
{
//
datetime iBarTo = workedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
workedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthWorkedBar);
iBarObj.LowShadowWidth(widthWorkedBar);
iBarObj.HighShadowWidth(widthWorkedBar);
//
iBarObj.BodyStyle(styleWorkedBar);
iBarObj.LowShadowStyle(styleWorkedBar);
iBarObj.HighShadowStyle(styleWorkedBar);
//
iBarObj.BodyColor(clrWorkedBar);
iBarObj.LowShadowColor(clrWorkedBar);
iBarObj.HighShadowColor(clrWorkedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
XCBaseObject *iObj;
bool isCreated = CreateFairValueGap(
zone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
objects //
);
}
//
result = ArraySize(objects);
//
return result;
}
//
protected:
//
+584
View File
@@ -0,0 +1,584 @@
//
// Configurations ...
bool useSharpChange = false;
bool useOrderBlockFVG = false;
//
// Select Order Blocks ...
if (useOrderBlockFVG)
{
//
if (obStateEvents.hasNewOrderBlock)
{
//
idx = GetYoungest(obState.orderBlocks);
has = IsValidIndex(idx);
if (has)
{
//
XCFVG *iFVG = NULL;
XCOrderBlock *iOB = obState.orderBlocks[idx];
bool isBullish = iOB.IsBullish();
//
// Detecting Inside FVG ...
has = fvgState.HasFairValueGaps();
if (has)
{
//
XCFVG *tmpFVGs[];
count = fvgState.CountFairValueGaps();
for (int i = 0; i < count; i++)
{
//
XCFVG *jFVG = fvgState.fairValueGaps[i];
//
bool isDirPassed = jFVG.GetDirection() == iOB.GetDirection();
bool isFromPassed = jFVG.From() >= iOB.From();
bool isPlacePassed = IsInsideOrDiff(
jFVG,
iOB,
false //
);
//
has = isDirPassed &&
isFromPassed &&
isPlacePassed;
if (has)
{
//
Add(
jFVG,
tmpFVGs //
);
}
//
ZeroMemory(jFVG);
}
//
// Selecting iFVG Based on Direction of OB ...
has = HasChild(tmpFVGs);
if (has)
{
//
idx =
isBullish
? GetLowest(tmpFVGs)
: GetHighest(tmpFVGs);
has = IsValidIndex(idx);
if (has)
{
iFVG = tmpFVGs[idx];
}
}
//
Clean(tmpFVGs);
}
//
XBoxZone iOBBox;
XBoxZone iFVGBox;
if (iFVG != NULL)
{
//
has = ToBox(
iFVGBox,
iFVG //
);
}
//
has = ToBox(
iOBBox,
iOB //
);
//
has = iOBBox.IsValid() &&
iFVGBox.IsValid();
if (has)
{
//
XSignalBox iSignalBox;
//
iSignalBox.ob = iOBBox;
iSignalBox.fvg = iFVGBox;
//
// Here We Check Waiting Box Contains Other Zones ...
// Like Support/Resistances ...
bool forceVerification = false;
if (forceVerification)
{
//
XBoxZone iVerificationBox;
XBoxZone tmpBoxes[];
if (isBullish)
{
//
ToBox(
provider.decisionState.supportZones,
tmpBoxes //
);
}
else
{
//
ToBox(
provider.decisionState.resistanceZones,
tmpBoxes //
);
}
has = HasChild(tmpBoxes);
if (has)
{
//
while (HasChild(tmpBoxes))
{
//
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
// Select Box ...
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
// Validate Box ...
bool isValidPassed = !IsBoxValid(
iBox,
barIndex //
);
bool isDirPassed = iBox.dir == iOBBox.dir;
bool isPlacePassed =
IsBoxInside(
iBox,
iOBBox //
)
//
&&
//
(!iFVGBox.IsValid()
? true
: IsBoxInsideOr(
iBox,
iFVGBox //
));
//
has =
isDirPassed &&
isValidPassed &&
isPlacePassed;
if (has)
{
//
iVerificationBox = iBox;
iBox.Clean();
break;
}
//
iBox.Clean();
}
}
has = iVerificationBox.IsValid();
Clean(tmpBoxes);
iVerificationBox.Clean();
}
//
if (has)
{
//
AddRef(
iSignalBox,
waitingBoxes //
);
}
//
iSignalBox.Clean();
}
//
iOBBox.Clean();
iFVGBox.Clean();
ZeroMemory(iOB);
ZeroMemory(iFVG);
}
}
}
//
// Checking Other Senario for Waiting Boxes ...
if (useSharpChange)
{
//
if (obStateEvents.hasNewSharp)
{
//
XBoxZone currSharp;
XBoxZone prevSharp;
XBoxZone sharpConsolidation;
//
// Retrieve Current Sharp ...
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
XBoxZone tmpBoxes[];
Copy(
obState.sharps,
tmpBoxes //
);
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
if (has)
{
//
currSharp = tmpBoxes[idx];
bool isBullish = currSharp.IsBullish();
//
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
while (HasChild(tmpBoxes))
{
//
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
//
if (!has)
{
break;
}
//
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
if (iBox.dir == currSharp.dir)
{
//
prevSharp = iBox;
iBox.Clean();
break;
}
//
iBox.Clean();
}
//
Clean(tmpBoxes);
}
Clean(tmpBoxes);
//
// Preparing Sharp Consolidation Box ...
has = currSharp.IsValid() &&
prevSharp.IsValid() &&
prevSharp.lower < currSharp.upper;
if (has)
{
//
sharpConsolidation.type = "XSHCNZ";
sharpConsolidation.dir = currSharp.dir;
sharpConsolidation.symbol = currSharp.symbol;
sharpConsolidation.period = currSharp.period;
//
sharpConsolidation.from = prevSharp.to;
sharpConsolidation.to = currSharp.from;
//
int toIDX = GetBarIndex(
currSharp.symbol,
currSharp.period,
sharpConsolidation.to //
);
int fromIDX = GetBarIndex(
currSharp.symbol,
currSharp.period,
sharpConsolidation.from //
);
int length = fromIDX - toIDX;
//
XOHCL toBar;
has = toBar.Init(
sharpConsolidation.symbol,
sharpConsolidation.period,
toIDX //
);
//
if (has)
{
//
double upper = toBar.FindHighest(
length,
MODE_HIGH //
);
//
double lower = toBar.FindLowest(
length,
MODE_LOW //
);
//
sharpConsolidation.upper = upper;
sharpConsolidation.lower = lower;
}
//
has = sharpConsolidation.IsValid();
if (has)
{
//
XSignalBox iBox;
//
iBox.ob = sharpConsolidation;
//
AddRef(
iBox,
waitingBoxes //
);
//
iBox.Clean();
// //
// XCBoxObject *iCBoxObj;
// XCBoxObject *iPBoxObj;
// provider.visionCycleHelper.mPOIDrawer.DrawBox(
// currSharp,
// iCBoxObj //
// );
// provider.visionCycleHelper.mPOIDrawer.DrawBox(
// prevSharp,
// iPBoxObj //
// );
}
//
currSharp.Clean();
prevSharp.Clean();
sharpConsolidation.Clean();
}
}
//
// Update Exists Box ...
// XBoxZone fvgs[];
// count = ArraySize(waitingBoxes);
// has = IsValidSize(count);
// if (has)
// {
// //
// for (int i = 0; i < count; i++)
// {
// //
// bool isSharpBox = waitingBoxes[i].ob.type == "XSHCNZ";
// if (!isSharpBox)
// {
// continue;
// }
// //
// bool isBullish = waitingBoxes[i].ob.IsBullish();
// //
// // Extract Inside FVGS ...
// if (isBullish)
// {
// //
// ToBox(
// fvgState.bullishFairValueGaps,
// fvgs //
// );
// }
// else
// {
// //
// ToBox(
// fvgState.bearishFairValueGaps,
// fvgs //
// );
// }
// has = HasChild(fvgs);
// if (has)
// {
// //
// int removeds[];
// int iFVGsCount = ArraySize(fvgs);
// for (int j = 0; j < iFVGsCount; j++)
// {
// //
// XBoxZone iFVGBox = fvgs[j];
// bool isFromPassed = iFVGBox.from >= waitingBoxes[i].ob.from;
// bool isBoundaryPassed =
// isBullish
// ? iFVGBox.lower < waitingBoxes[i].ob.upper
// : iFVGBox.upper > waitingBoxes[i].ob.lower;
// //
// has = isFromPassed &&
// isBoundaryPassed;
// if (!has)
// {
// //
// Add(
// j,
// removeds //
// );
// }
// }
// //
// CleanupArray(
// removeds,
// fvgs //
// );
// Clean(removeds);
// }
// //
// // Select FVG ...
// has = HasChild(fvgs);
// if (has)
// {
// //
// idx = isBullish
// ? GetLowest(fvgs)
// : GetHighest(fvgs);
// has = IsValidIndex(idx);
// if (has)
// {
// waitingBoxes[i].fvg = fvgs[idx];
// }
// }
// else
// {
// waitingBoxes[i].fvg.Clean();
// }
// }
// }
//
// Clean(fvgs);
}
/////////////////////////////////////////////////////////////////////////////////////
if (signalProvider == X121SMC_XWZ_PROVIDER_XHKMA)
{
//
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
//
// Prepare Box fro SL ...
iSL = pivot;
Add(
iSL,
sls //
);
//
// Fix rf Reward ...
rfRewar = 2;
}
else if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX)
{
//
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
//
Clean(sls);
//
// Prepare Box fro SL ...
iSL = signalBox.lower + ((signalBox.upper - signalBox.lower) / 2);
Add(
iSL,
sls //
);
//
// Fix rf Reward ...
rfRewar = 2;
}
else if (signalProvider == X121SMC_XWZ_PROVIDER_XACTIVATED_BOX)
{
//
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
//
Clean(sls);
//
// Prepare Box fro SL ...
iSL = pivot;
Add(
iSL,
sls //
);
//
// Fix rf Reward ...
rfRewar = 2;
}
else if (signalProvider == X121SMC_XWZ_PROVIDER_XBREAKED_BOX)
{
//
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
//
Clean(sls);
//
// Prepare Box fro SL ...
iSL = pivot;
Add(
iSL,
sls //
);
//
// Fix rf Reward ...
rfRewar = 2;
}
+520
View File
@@ -0,0 +1,520 @@
//
int DrawOrderBlock(
XCOrderBlock *zone,
XCBaseObject *&objects[],
//
bool drawStartedBar = true,
bool drawActivatedBar = true,
bool drawBreakedBar = true,
bool drawWorkedBar = true,
//
int widthStartedBar = 1,
color clrStartedBar = clrYellow,
ENUM_LINE_STYLE styleStartedBar = STYLE_SOLID,
//
int widthActivatedBar = 1,
color clrActivatedBar = clrLime,
ENUM_LINE_STYLE styleActivatedBar = STYLE_SOLID,
//
int widthBreakedBar = 1,
color clrBreakedBar = clrRed,
ENUM_LINE_STYLE styleBreakedBar = STYLE_SOLID,
//
int widthWorkedBar = 1,
color clrWorkedBar = clrAqua,
ENUM_LINE_STYLE styleWorkedBar = STYLE_SOLID
//
)
{
//
int result = 0;
//
Clean(objects);
//
if (zone == NULL ||
!zone.IsValid())
{
return result;
}
//
ENUM_X_DIRECTION zoneDir = zone.GetDirection();
//
// Started Bar ...
XOHCL startedBar;
bool isBodyOut = false;
bool isStarted = zone
.IsStarted(
zoneDir,
startedBar,
isBodyOut //
);
if (isStarted)
{
//
datetime iBarTo = startedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
startedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthStartedBar);
iBarObj.LowShadowWidth(widthStartedBar);
iBarObj.HighShadowWidth(widthStartedBar);
//
iBarObj.BodyStyle(styleStartedBar);
iBarObj.LowShadowStyle(styleStartedBar);
iBarObj.HighShadowStyle(styleStartedBar);
//
iBarObj.BodyColor(clrStartedBar);
iBarObj.LowShadowColor(clrStartedBar);
iBarObj.HighShadowColor(clrStartedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Activated Bar ...
XOHCL activatedBar;
bool isBodyIn = false;
bool isActivated = zone
.IsActivated(
zoneDir,
activatedBar,
isBodyIn,
false // Force Body Out Started ...
);
if (isActivated)
{
//
datetime iBarTo = activatedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
activatedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthActivatedBar);
iBarObj.LowShadowWidth(widthActivatedBar);
iBarObj.HighShadowWidth(widthActivatedBar);
//
iBarObj.BodyStyle(styleActivatedBar);
iBarObj.LowShadowStyle(styleActivatedBar);
iBarObj.HighShadowStyle(styleActivatedBar);
//
iBarObj.BodyColor(clrActivatedBar);
iBarObj.LowShadowColor(clrActivatedBar);
iBarObj.HighShadowColor(clrActivatedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Breaked Bar ...
XOHCL breakedBar;
isBodyOut = false;
bool isBreaked = zone
.IsBreaked(
zoneDir,
breakedBar,
isBodyOut,
false, // Ignore Start ...
false // Force Body Out Started ...
);
if (isBreaked)
{
//
datetime iBarTo = breakedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
breakedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthBreakedBar);
iBarObj.LowShadowWidth(widthBreakedBar);
iBarObj.HighShadowWidth(widthBreakedBar);
//
iBarObj.BodyStyle(styleBreakedBar);
iBarObj.LowShadowStyle(styleBreakedBar);
iBarObj.HighShadowStyle(styleBreakedBar);
//
iBarObj.BodyColor(clrBreakedBar);
iBarObj.LowShadowColor(clrBreakedBar);
iBarObj.HighShadowColor(clrBreakedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Worked Bar ...
XOHCL workedBar;
isBodyOut = false;
bool isWorked = zone
.IsWorked(
zoneDir,
workedBar,
isBodyOut,
false, // Ignore Activation ...
false, // Force Body Out Started ...
false // Force Body In Activated ...
);
if (isWorked)
{
//
datetime iBarTo = workedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
workedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthWorkedBar);
iBarObj.LowShadowWidth(widthWorkedBar);
iBarObj.HighShadowWidth(widthWorkedBar);
//
iBarObj.BodyStyle(styleWorkedBar);
iBarObj.LowShadowStyle(styleWorkedBar);
iBarObj.HighShadowStyle(styleWorkedBar);
//
iBarObj.BodyColor(clrWorkedBar);
iBarObj.LowShadowColor(clrWorkedBar);
iBarObj.HighShadowColor(clrWorkedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
XCBaseObject *iObj;
bool isCreated = CreateOrderBlock(
zone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
objects //
);
}
//
result = ArraySize(objects);
//
return result;
}
//
int DrawFairValueGap(
XCFVG *zone,
XCBaseObject *&objects[],
//
bool drawStartedBar = true,
bool drawActivatedBar = true,
bool drawBreakedBar = true,
bool drawWorkedBar = true,
//
int widthStartedBar = 1,
color clrStartedBar = clrYellow,
ENUM_LINE_STYLE styleStartedBar = STYLE_SOLID,
//
int widthActivatedBar = 1,
color clrActivatedBar = clrLime,
ENUM_LINE_STYLE styleActivatedBar = STYLE_SOLID,
//
int widthBreakedBar = 1,
color clrBreakedBar = clrRed,
ENUM_LINE_STYLE styleBreakedBar = STYLE_SOLID,
//
int widthWorkedBar = 1,
color clrWorkedBar = clrAqua,
ENUM_LINE_STYLE styleWorkedBar = STYLE_SOLID
//
)
{
//
int result = 0;
//
Clean(objects);
//
if (zone == NULL ||
!zone.IsValid())
{
return result;
}
//
ENUM_X_DIRECTION zoneDir = zone.GetDirection();
//
// Started Bar ...
XOHCL startedBar;
bool isBodyOut = false;
bool isStarted = zone
.IsStarted(
zoneDir,
startedBar,
isBodyOut //
);
if (isStarted)
{
//
datetime iBarTo = startedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
startedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthStartedBar);
iBarObj.LowShadowWidth(widthStartedBar);
iBarObj.HighShadowWidth(widthStartedBar);
//
iBarObj.BodyStyle(styleStartedBar);
iBarObj.LowShadowStyle(styleStartedBar);
iBarObj.HighShadowStyle(styleStartedBar);
//
iBarObj.BodyColor(clrStartedBar);
iBarObj.LowShadowColor(clrStartedBar);
iBarObj.HighShadowColor(clrStartedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Activated Bar ...
XOHCL activatedBar;
bool isBodyIn = false;
bool isActivated = zone
.IsActivated(
zoneDir,
activatedBar,
isBodyIn,
false // Force Body Out Started ...
);
if (isActivated)
{
//
datetime iBarTo = activatedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
activatedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthActivatedBar);
iBarObj.LowShadowWidth(widthActivatedBar);
iBarObj.HighShadowWidth(widthActivatedBar);
//
iBarObj.BodyStyle(styleActivatedBar);
iBarObj.LowShadowStyle(styleActivatedBar);
iBarObj.HighShadowStyle(styleActivatedBar);
//
iBarObj.BodyColor(clrActivatedBar);
iBarObj.LowShadowColor(clrActivatedBar);
iBarObj.HighShadowColor(clrActivatedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Breaked Bar ...
XOHCL breakedBar;
isBodyOut = false;
bool isBreaked = zone
.IsBreaked(
zoneDir,
breakedBar,
isBodyOut,
false, // Ignore Start ...
false // Force Body Out Started ...
);
if (isBreaked)
{
//
datetime iBarTo = breakedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
breakedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthBreakedBar);
iBarObj.LowShadowWidth(widthBreakedBar);
iBarObj.HighShadowWidth(widthBreakedBar);
//
iBarObj.BodyStyle(styleBreakedBar);
iBarObj.LowShadowStyle(styleBreakedBar);
iBarObj.HighShadowStyle(styleBreakedBar);
//
iBarObj.BodyColor(clrBreakedBar);
iBarObj.LowShadowColor(clrBreakedBar);
iBarObj.HighShadowColor(clrBreakedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
// Worked Bar ...
XOHCL workedBar;
isBodyOut = false;
bool isWorked = zone
.IsWorked(
zoneDir,
workedBar,
isBodyOut,
false, // Ignore Activation ...
false, // Force Body Out Started ...
false // Force Body In Activated ...
);
if (isWorked)
{
//
datetime iBarTo = workedBar.NextAt();
//
XCOHCLObject *iBarObj;
bool isCreated = CreateBar(
workedBar,
iBarObj,
iBarTo //
);
if (isCreated)
{
//
iBarObj.BodyWidth(widthWorkedBar);
iBarObj.LowShadowWidth(widthWorkedBar);
iBarObj.HighShadowWidth(widthWorkedBar);
//
iBarObj.BodyStyle(styleWorkedBar);
iBarObj.LowShadowStyle(styleWorkedBar);
iBarObj.HighShadowStyle(styleWorkedBar);
//
iBarObj.BodyColor(clrWorkedBar);
iBarObj.LowShadowColor(clrWorkedBar);
iBarObj.HighShadowColor(clrWorkedBar);
//
Add(
(XCBaseObject *)iBarObj,
objects //
);
}
}
//
XCBaseObject *iObj;
bool isCreated = CreateFairValueGap(
zone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
objects //
);
}
//
result = ArraySize(objects);
//
return result;
}
File diff suppressed because it is too large Load Diff
+4 -38
View File
@@ -5327,43 +5327,6 @@ struct XBoxZone
period == item.period;
}
// /**
// * Check Box is Same as another ...
// *
// * @param box: XBoxZone instance Reference ...
// *
// * @return ( bool )
// */
// bool IsSame(XBoxZone &box)
// {
// //
// bool result = false;
// //
// result = IsValid() &&
// box.IsValid();
// if (!result)
// {
// return result;
// }
// //
// result =
// //
// dir == box.dir &&
// from == box.from &&
// type == box.type &&
// upper == box.upper &&
// lower == box.lower &&
// symbol == box.symbol &&
// period == box.period
// //
// ;
// //
// return result;
// }
/**
* Retrieve Box Age ...
*
@@ -5409,9 +5372,12 @@ struct XBoxZone
string GetTag()
{
//
string typeStr = IsValid(type)
? type
: "XBOX";
string result =
//
"XBOX" + "_" +
typeStr + "_" +
ToString(dir) + "_" +
symbol + "_" +
ToString(period) + "_" +
+34 -1
View File
@@ -51,6 +51,7 @@ struct XSignalBox
//
XBoxZone ob;
XBoxZone fvg;
XBoxZone sharp;
//
// Constructor ...
@@ -70,6 +71,7 @@ struct XSignalBox
//
ob.Clean();
fvg.Clean();
sharp.Clean();
}
/**
@@ -84,12 +86,43 @@ struct XSignalBox
//
result =
ob.IsValid();
ob.IsValid() &&
fvg.IsValid() &&
sharp.IsValid();
//
return result;
}
/**
* Update Structure Models To Date ...
*
* @param value: datetime ...
*/
void UpdateTo(datetime value = NULL)
{
//
value = NormalizeTime(value);
//
if (ob.IsValid())
{
ob.to = value;
}
//
if (fvg.IsValid())
{
fvg.to = value;
}
//
if (sharp.IsValid())
{
sharp.to = value;
}
}
//
};
File diff suppressed because it is too large Load Diff
@@ -172,9 +172,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
double point = 0;
double targets[];
double reward = 0;
XBoxZone signalBox;
XSignalBox signalBox;
bool hasTrend = false;
XBoxZone signalHolderBox;
bool hasPriority = false;
double amountPercent = -1;
bool hasSignalBox = false;
@@ -279,18 +278,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
// Draw Working Zone ...
if (hasWorkingZone)
{
//
workingZone.Draw(
drawer,
//
true, // Draw Supply Zone ...
true, // Draw Demand Zone ...
false, // Draw Supply Zone ...
false, // Draw Demand Zone ...
true, // Draw Waiting Zones ...
true // Draw Trend ...
false // Draw Trend ...
);
}
//
// Detect Signal Box ...
@@ -298,7 +293,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
hasWorkingZone &&
workingZone.DetectSignalConditions(
signalBox,
signalHolderBox,
signalBoxDir,
signalProvider,
provider,
@@ -306,6 +300,10 @@ class XCX121SMCXWZSignalDetector : public XCBase
);
//
// Remove Signal Box form
// Waiting Boxes and Breaked Boxes
// if Exists on them, then add it to
// UnAvailable Boxes ...
if (hasSignalBox)
{
//
@@ -355,6 +353,13 @@ class XCX121SMCXWZSignalDetector : public XCBase
);
}
}
//
// Adding to UnAvailable Box ...
AddRef(
signalBox,
workingZone.unavailableBoxes //
);
}
//
@@ -367,13 +372,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
{
//
signalBox.Clean();
signalHolderBox.Clean();
signalBoxDir = X_DIRECTION_NONE;
}
//
// Check Priority Exists ...
hasPriority = workingZone
hasPriority =
hasWorkingZone &&
workingZone
.DetectPriority(
priority,
signalBoxDir,
@@ -383,7 +389,9 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
// Check Price Reward and Amount Exists ...
hasRewardAmount = CalculateRiskReward(
hasRewardAmount =
hasWorkingZone &&
CalculateRiskReward(
priority,
reward,
amountPercent //
@@ -399,37 +407,22 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
// Draw Signal Box ...
XCBoxObject *iSignalBoxObj;
has = drawer.DrawBox(
XCBaseObject *objects[];
has = drawer.DrawSignalBox(
signalBox,
iSignalBoxObj //
objects,
clrYellow //
);
if (has)
{
//
iSignalBoxObj.BoxWidth(1);
iSignalBoxObj.BoxColor(clrYellow);
iSignalBoxObj.BoxStyle(STYLE_SOLID);
//
workingZone.mDrawnObjects.Add(iSignalBoxObj);
}
//
// Draw Signal Holder Box if Exists ...
if (signalHolderBox.IsValid())
int count = ArraySize(objects);
for (int i = 0; i < count; i++)
{
//
XCBoxObject *iSignalHolderBoxObj;
has = drawer.DrawBox(
signalHolderBox,
iSignalHolderBoxObj //
);
if (has)
{
workingZone.mDrawnObjects.Add(iSignalHolderBoxObj);
workingZone.mDrawnObjects.Add(objects[i]);
}
}
Clean(objects);
//
// Detect Signal Direction ...
@@ -438,17 +431,17 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
pivot = isBullish
? signalBox.lower
: signalBox.upper;
? signalBox.ob.lower
: signalBox.ob.upper;
//
point = isBullish
? signalBox.upper
: signalBox.lower;
? signalBox.ob.upper
: signalBox.ob.lower;
//
double entry = GetEntry(
signalBox.symbol,
signalBox.ob.symbol,
signalBoxDir //
);
@@ -471,41 +464,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
// Select and Provide SL Based on ...
double iAtr = 0;
if (signalProvider == X121SMC_XWZ_PROVIDER_XHKMA)
if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX)
{
//
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
//
// Prepare Box fro SL ...
iSL = pivot;
Add(
iSL,
sls //
);
//
// Fix rf Reward ...
rfRewar = 2;
}
else if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX)
{
//
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
//
Clean(sls);
//
// Prepare Box fro SL ...
iSL = signalBox.lower + ((signalBox.upper - signalBox.lower) / 2);
Add(
iSL,
sls //
);
//
// Fix rf Reward ...
rfRewar = 2;
@@ -900,7 +864,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
mConditions.setupTime = cTime;
mConditions.dir = signalBoxDir;
mConditions.priority = priority;
mConditions.signalBox = signalBox;
mConditions.signalBox = signalBox.ob;
mConditions.provider = signalProvider;
mConditions.amountPercent = amountPercent;
}
@@ -921,7 +885,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
signalBox.Clean();
signalHolderBox.Clean();
consolidationZBar.Clean();
//
+232 -376
View File
@@ -31,7 +31,6 @@
enum ENUM_X121SMC_XWZ_PROVIDERS
{
X121SMC_XWZ_PROVIDER_NONE,
X121SMC_XWZ_PROVIDER_XHKMA,
X121SMC_XWZ_PROVIDER_XBREAKED_BOX,
X121SMC_XWZ_PROVIDER_XREJECTED_BOX,
X121SMC_XWZ_PROVIDER_XACTIVATED_BOX,
@@ -488,6 +487,7 @@ struct X121SMCStrategyXWZWorkingZone
int idx = -1;
int count = 0;
bool has = false;
datetime cTime = TimeCurrent();
//
if (barIndex < 0)
@@ -559,235 +559,19 @@ struct X121SMCStrategyXWZWorkingZone
}
//
// Select Order Blocks ...
if (obStateEvents.hasNewOrderBlock)
{
//
idx = GetYoungest(obState.orderBlocks);
has = IsValidIndex(idx);
if (has)
{
//
XCFVG *iFVG = NULL;
XCOrderBlock *iOB = obState.orderBlocks[idx];
bool isBullish = iOB.IsBullish();
//
// Detecting Inside FVG ...
has = fvgState.HasFairValueGaps();
if (has)
{
//
XCFVG *tmpFVGs[];
count = fvgState.CountFairValueGaps();
for (int i = 0; i < count; i++)
{
//
XCFVG *jFVG = fvgState.fairValueGaps[i];
//
bool isDirPassed = jFVG.GetDirection() == iOB.GetDirection();
bool isFromPassed = jFVG.From() >= iOB.From();
bool isPlacePassed = IsInsideOrDiff(
jFVG,
iOB,
false //
);
//
has = isDirPassed &&
isFromPassed &&
isPlacePassed;
if (has)
{
//
Add(
jFVG,
tmpFVGs //
);
}
//
ZeroMemory(jFVG);
}
//
// Selecting iFVG Based on Direction of OB ...
has = HasChild(tmpFVGs);
if (has)
{
//
idx =
isBullish
? GetLowest(tmpFVGs)
: GetHighest(tmpFVGs);
has = IsValidIndex(idx);
if (has)
{
iFVG = tmpFVGs[idx];
}
}
//
Clean(tmpFVGs);
}
//
XBoxZone iOBBox;
XBoxZone iFVGBox;
if (iFVG != NULL)
{
//
has = ToBox(
iFVGBox,
iFVG //
);
}
//
has = ToBox(
iOBBox,
iOB //
);
//
has = iOBBox.IsValid() &&
iFVGBox.IsValid();
if (has)
{
//
XSignalBox iSignalBox;
//
iSignalBox.ob = iOBBox;
iSignalBox.fvg = iFVGBox;
//
// Here We Check Waiting Box Contains Other Zones ...
// Like Support/Resistances ...
bool forceVerification = false;
if (forceVerification)
{
//
XBoxZone iVerificationBox;
XBoxZone tmpBoxes[];
if (isBullish)
{
//
ToBox(
provider.decisionState.supportZones,
tmpBoxes //
);
}
else
{
//
ToBox(
provider.decisionState.resistanceZones,
tmpBoxes //
);
}
has = HasChild(tmpBoxes);
if (has)
{
//
while (HasChild(tmpBoxes))
{
//
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
// Select Box ...
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
// Validate Box ...
bool isValidPassed = !IsBoxValid(
iBox,
barIndex //
);
bool isDirPassed = iBox.dir == iOBBox.dir;
bool isPlacePassed =
IsBoxInside(
iBox,
iOBBox //
)
//
&&
//
(!iFVGBox.IsValid()
? true
: IsBoxInsideOr(
iBox,
iFVGBox //
));
//
has =
isDirPassed &&
isValidPassed &&
isPlacePassed;
if (has)
{
//
iVerificationBox = iBox;
iBox.Clean();
break;
}
//
iBox.Clean();
}
}
has = iVerificationBox.IsValid();
Clean(tmpBoxes);
iVerificationBox.Clean();
}
//
if (has)
{
//
AddRef(
iSignalBox,
waitingBoxes //
);
}
//
iSignalBox.Clean();
}
//
iOBBox.Clean();
iFVGBox.Clean();
ZeroMemory(iOB);
ZeroMemory(iFVG);
}
}
//
// Checking Other Senario for Waiting Boxes ...
// Detect a Sharp Zone Which Contains
// an Order Block and Also an FVG ...
if (obStateEvents.hasNewSharp)
{
//
XBoxZone ob;
XBoxZone fvg;
XBoxZone currSharp;
XBoxZone prevSharp;
XBoxZone sharpConsolidation;
//
// Retrieve Current Sharp ...
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
XBoxZone tmpBoxes[];
Copy(
obState.sharps,
@@ -906,38 +690,226 @@ struct X121SMCStrategyXWZWorkingZone
}
//
// Detect Order Block / FVG ...
has = sharpConsolidation.IsValid();
if (has)
{
//
// Check Direction ...
bool isBullish = sharpConsolidation.IsBullish();
//
// Find Inside Order Block ...
Clean(tmpBoxes);
if (isBullish)
{
//
ToBox(
obState.bullishOrderBlocks,
tmpBoxes //
);
}
else
{
//
ToBox(
obState.bearishOrderBlocks,
tmpBoxes //
);
}
//
// Select Order Block ...
has = HasChild(tmpBoxes);
if (has)
{
//
XCBoxObject *iCurrObj;
XCBoxObject *iPrevObj;
XCBoxObject *iSharpConsolidationObj;
has = drawer.DrawBox(
currSharp,
iCurrObj //
while (HasChild(tmpBoxes))
{
//
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
has =
has &&
drawer.DrawBox(
prevSharp,
iPrevObj //
//
// Validate Selected Box ...
bool isDirPassed = iBox.dir == sharpConsolidation.dir;
bool isFromPassed = iBox.from > sharpConsolidation.from;
bool isInsidePassed = IsBoxInside(
iBox,
sharpConsolidation //
);
has =
has &&
drawer.DrawBox(
sharpConsolidation,
iSharpConsolidationObj //
bool isValidationPassed = IsBoxValid(
iBox,
barIndex //
);
//
has = isDirPassed &&
isFromPassed &&
isInsidePassed &&
isValidationPassed;
if (has)
{
Print("Sharp Detection ...");
ob = iBox;
}
//
iBox.Clean();
//
if (ob.IsValid())
{
break;
}
}
}
Clean(tmpBoxes);
//
// Find Inside FVG ...
has = ob.IsValid();
if (has)
{
//
Clean(tmpBoxes);
if (isBullish)
{
//
ToBox(
fvgState.bullishFairValueGaps,
tmpBoxes //
);
}
else
{
//
ToBox(
fvgState.bearishFairValueGaps,
tmpBoxes //
);
}
//
// Select FVG ...
has = HasChild(tmpBoxes);
if (has)
{
//
while (HasChild(tmpBoxes))
{
//
idx = isBullish
? GetLowest(tmpBoxes)
: GetHighest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
// Validate Selected Box ...
bool isDirPassed = iBox.dir == ob.dir;
bool isFromPassed = iBox.from > ob.from;
bool isInsidePassed = IsBoxInside(
iBox,
ob //
);
//
has = isDirPassed &&
isFromPassed &&
isInsidePassed;
if (has)
{
fvg = iBox;
}
//
iBox.Clean();
//
if (fvg.IsValid())
{
break;
}
}
}
Clean(tmpBoxes);
}
}
//
// Checking Validation of Boxes ...
has = ob.IsValid() &&
fvg.IsValid() &&
sharpConsolidation.IsValid();
if (has)
{
//
// Update Time ...
ob.to = cTime;
fvg.to = cTime;
sharpConsolidation.to = cTime;
//
XSignalBox iSBox;
//
iSBox.ob = ob;
iSBox.fvg = fvg;
iSBox.sharp = sharpConsolidation;
//
has = iSBox.IsValid();
if (has)
{
//
AddRef(
iSBox,
waitingBoxes //
);
}
//
iSBox.Clean();
}
//
ob.Clean();
fvg.Clean();
toBar.Clean();
currSharp.Clean();
prevSharp.Clean();
sharpConsolidation.Clean();
}
//
Clean(tmpBoxes);
currSharp.Clean();
prevSharp.Clean();
sharpConsolidation.Clean();
}
//
count = CountWaitingBoxes();
@@ -1017,15 +989,6 @@ struct X121SMCStrategyXWZWorkingZone
//
has = isInite &&
(
//
IsBoxBreaked(
iBox.fvg,
iBar.Index() - 1,
barIndex,
period //
)
//
||
//
IsBoxBreaked(
iBox.ob,
@@ -1335,14 +1298,7 @@ struct X121SMCStrategyXWZWorkingZone
count = CountWaitingBoxes();
for (int i = 0; i < count; i++)
{
//
waitingBoxes[i].ob.to = value;
//
if (waitingBoxes[i].fvg.IsValid())
{
waitingBoxes[i].fvg.to = value;
}
waitingBoxes[i].UpdateTo(value);
}
}
@@ -1443,7 +1399,6 @@ struct X121SMCStrategyXWZWorkingZone
* Detect Signal Box Conditions ...
*
* @param box: XBoxZone instance reference, Signalled Box ...
* @param holderBox: XBoxZone instance reference, Signalled Holder Box ...
* @param dir: ENUM_X_DIRECTION member, Specified Signal Direction ...
* @param signalProvider: ENUM_X121SMC_XWZ_PROVIDERS member, Specified Signal Type ...
* @param provider: X121SMCStrategySignalProviderData instance reference ...
@@ -1452,8 +1407,7 @@ struct X121SMCStrategyXWZWorkingZone
* @return ( bool )
*/
bool DetectSignalConditions(
XBoxZone &box,
XBoxZone &holderBox,
XSignalBox &box,
ENUM_X_DIRECTION &dir,
ENUM_X121SMC_XWZ_PROVIDERS &signalProvider,
X121SMCStrategySignalProviderData &provider,
@@ -1468,7 +1422,6 @@ struct X121SMCStrategyXWZWorkingZone
//
box.Clean();
holderBox.Clean();
dir = X_DIRECTION_NONE;
signalProvider = X121SMC_XWZ_PROVIDER_NONE;
@@ -1507,14 +1460,14 @@ struct X121SMCStrategyXWZWorkingZone
// ---------------------------------------------
// Rejected Box ...
// ---------------------------------------------
bool useSenario1 = true;
bool useSenario1 = false;
bool isSenario1Happend = false;
bool isSenario1Bullish = false;
bool isSenario1Bearish = false;
if (useSenario1)
{
//
isSenario1Happend = cParser.HasSenario1Conditions(
isSenario1Happend = cParser.HasRejectedBoxConditions(
X_CYCLE_DECISION,
box,
holderBox,
@@ -1553,32 +1506,6 @@ struct X121SMCStrategyXWZWorkingZone
if (!isSenario1Happend &&
useSenario2)
{
//
isSenario2Happend = cParser.HasSenario2Conditions(
X_CYCLE_DECISION,
box,
holderBox,
dir,
waitingBoxes,
provider,
barIndex //
);
//
isSenario2Bullish =
isSenario2Happend &&
IsBullish(dir);
//
isSenario2Bearish =
isSenario2Happend &&
IsBearish(dir);
//
if (isSenario2Happend)
{
signalProvider = X121SMC_XWZ_PROVIDER_XACTIVATED_BOX;
}
}
//
@@ -1594,32 +1521,6 @@ struct X121SMCStrategyXWZWorkingZone
!isSenario2Happend &&
useSenario3)
{
//
isSenario3Happend = cParser.HasSenario3Conditions(
X_CYCLE_DECISION,
box,
holderBox,
dir,
waitingBoxes,
provider,
barIndex //
);
//
isSenario3Bullish =
isSenario3Happend &&
IsBullish(dir);
//
isSenario3Bearish =
isSenario3Happend &&
IsBearish(dir);
//
if (isSenario3Happend)
{
signalProvider = X121SMC_XWZ_PROVIDER_XBREAKED_BOX;
}
}
//
@@ -1636,40 +1537,14 @@ struct X121SMCStrategyXWZWorkingZone
!isSenario3Happend &&
useSenario4)
{
//
isSenario4Happend = cParser.HasSenario4Conditions(
X_CYCLE_DECISION,
trend,
box,
holderBox,
dir,
waitingBoxes,
provider,
barIndex //
);
//
isSenario4Bullish =
isSenario4Happend &&
IsBullish(dir);
//
isSenario4Bearish =
isSenario4Happend &&
IsBearish(dir);
//
if (isSenario4Happend)
{
signalProvider = X121SMC_XWZ_PROVIDER_XHKMA;
}
}
//
// Senario 5:
// ---------------------------------------------
// XSHCNZ Signal Box Detection Conditions ...
// ---------------------------------------------
bool useSenario5 = false;
bool useSenario5 = true;
bool isSenario5Happend = false;
bool isSenario5Bullish = false;
bool isSenario5Bearish = false;
@@ -1708,7 +1583,8 @@ struct X121SMCStrategyXWZWorkingZone
isSenario2Bullish ||
isSenario3Bullish ||
isSenario4Bullish ||
isSenario5Bullish
isSenario5Bullish ||
isSenario6Bullish
//
;
@@ -1719,7 +1595,8 @@ struct X121SMCStrategyXWZWorkingZone
isSenario2Bearish ||
isSenario3Bearish ||
isSenario4Bearish ||
isSenario5Bearish
isSenario5Bearish ||
isSenario6Bearish
//
;
@@ -1876,13 +1753,13 @@ struct X121SMCStrategyXWZWorkingZone
*
* @param drawSupplyZone: boolean ...
* @param drawDemandZone: boolean ...
* @param drawWaitingZones: boolean ...
* @param drawWaitingBoxes: boolean ...
*/
void Draw(
XCPOIDrawer *drawer,
bool drawSupplyZone = false,
bool drawDemandZone = false,
bool drawWaitingZones = false,
bool drawWaitingBoxes = false,
bool drawTrend = false //
)
{
@@ -2108,7 +1985,7 @@ struct X121SMCStrategyXWZWorkingZone
//
// Waiting Zones ...
if (drawWaitingZones)
if (drawWaitingBoxes)
{
//
has = HasWaitingBoxes();
@@ -2119,42 +1996,21 @@ struct X121SMCStrategyXWZWorkingZone
for (int i = 0; i < count; i++)
{
//
// OB ...
XCBoxObject *iOBBoxObj;
has = drawer.DrawBox(
waitingBoxes[i].ob,
iOBBoxObj //
);
if (has)
{
mDrawnObjects.Add(iOBBoxObj);
}
//
// FVG ...
if (waitingBoxes[i].fvg.IsValid())
{
//
XCBoxObject *iFVGBoxObj;
has = drawer.DrawBox(
waitingBoxes[i].fvg,
iFVGBoxObj //
XCBaseObject *objects[];
has = drawer.DrawSignalBox(
waitingBoxes[i],
objects //
);
if (has)
{
//
iFVGBoxObj.BoxStyle(STYLE_SOLID);
//
mDrawnObjects.Add(iFVGBoxObj);
count = ArraySize(objects);
for (int i = 0; i < count; i++)
{
mWorkingZoneObjects.Add(objects[i]);
}
//
ZeroMemory(iFVGBoxObj);
}
//
ZeroMemory(iOBBoxObj);
Clean(objects);
}
}
}
@@ -835,8 +835,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// XVWAP ...
x121Inputs.xvwapInputs.showVWapFast = showAll || false;
x121Inputs.xvwapInputs.showVWapMedium = showAll || false;
x121Inputs.xvwapInputs.showVWapFast = showAll || true;
x121Inputs.xvwapInputs.showVWapMedium = showAll || true;
x121Inputs.xvwapInputs.showVWapSlow = showAll || false;
//