last ...
This commit is contained in:
@@ -23,8 +23,8 @@
|
|||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../Classes/x-saherelm.base.class.mq5"
|
#include "../Classes/x-saherelm.base.class.mq5"
|
||||||
#include "../Classes/x-saherelm.x-cobject.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.extensions.lib.mq5"
|
||||||
|
#include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definitions ...
|
// Definitions ...
|
||||||
@@ -3325,6 +3325,124 @@ class XCPOIDrawer : public XCBase
|
|||||||
return result;
|
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 ...
|
* Draw Specified POI State ...
|
||||||
*
|
*
|
||||||
@@ -4110,526 +4228,6 @@ class XCPOIDrawer : public XCBase
|
|||||||
return result;
|
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:
|
protected:
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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
@@ -5327,43 +5327,6 @@ struct XBoxZone
|
|||||||
period == item.period;
|
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 ...
|
* Retrieve Box Age ...
|
||||||
*
|
*
|
||||||
@@ -5409,9 +5372,12 @@ struct XBoxZone
|
|||||||
string GetTag()
|
string GetTag()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
string typeStr = IsValid(type)
|
||||||
|
? type
|
||||||
|
: "XBOX";
|
||||||
string result =
|
string result =
|
||||||
//
|
//
|
||||||
"XBOX" + "_" +
|
typeStr + "_" +
|
||||||
ToString(dir) + "_" +
|
ToString(dir) + "_" +
|
||||||
symbol + "_" +
|
symbol + "_" +
|
||||||
ToString(period) + "_" +
|
ToString(period) + "_" +
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ struct XSignalBox
|
|||||||
//
|
//
|
||||||
XBoxZone ob;
|
XBoxZone ob;
|
||||||
XBoxZone fvg;
|
XBoxZone fvg;
|
||||||
|
XBoxZone sharp;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
@@ -70,6 +71,7 @@ struct XSignalBox
|
|||||||
//
|
//
|
||||||
ob.Clean();
|
ob.Clean();
|
||||||
fvg.Clean();
|
fvg.Clean();
|
||||||
|
sharp.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,12 +86,43 @@ struct XSignalBox
|
|||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
ob.IsValid();
|
ob.IsValid() &&
|
||||||
|
fvg.IsValid() &&
|
||||||
|
sharp.IsValid();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
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 point = 0;
|
||||||
double targets[];
|
double targets[];
|
||||||
double reward = 0;
|
double reward = 0;
|
||||||
XBoxZone signalBox;
|
XSignalBox signalBox;
|
||||||
bool hasTrend = false;
|
bool hasTrend = false;
|
||||||
XBoxZone signalHolderBox;
|
|
||||||
bool hasPriority = false;
|
bool hasPriority = false;
|
||||||
double amountPercent = -1;
|
double amountPercent = -1;
|
||||||
bool hasSignalBox = false;
|
bool hasSignalBox = false;
|
||||||
@@ -279,18 +278,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Draw Working Zone ...
|
// Draw Working Zone ...
|
||||||
if (hasWorkingZone)
|
workingZone.Draw(
|
||||||
{
|
drawer,
|
||||||
//
|
//
|
||||||
workingZone.Draw(
|
false, // Draw Supply Zone ...
|
||||||
drawer,
|
false, // Draw Demand Zone ...
|
||||||
//
|
true, // Draw Waiting Zones ...
|
||||||
true, // Draw Supply Zone ...
|
false // Draw Trend ...
|
||||||
true, // Draw Demand Zone ...
|
);
|
||||||
true, // Draw Waiting Zones ...
|
|
||||||
true // Draw Trend ...
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Signal Box ...
|
// Detect Signal Box ...
|
||||||
@@ -298,7 +293,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
hasWorkingZone &&
|
hasWorkingZone &&
|
||||||
workingZone.DetectSignalConditions(
|
workingZone.DetectSignalConditions(
|
||||||
signalBox,
|
signalBox,
|
||||||
signalHolderBox,
|
|
||||||
signalBoxDir,
|
signalBoxDir,
|
||||||
signalProvider,
|
signalProvider,
|
||||||
provider,
|
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)
|
if (hasSignalBox)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -355,6 +353,13 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Adding to UnAvailable Box ...
|
||||||
|
AddRef(
|
||||||
|
signalBox,
|
||||||
|
workingZone.unavailableBoxes //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -367,27 +372,30 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
signalBox.Clean();
|
signalBox.Clean();
|
||||||
signalHolderBox.Clean();
|
|
||||||
signalBoxDir = X_DIRECTION_NONE;
|
signalBoxDir = X_DIRECTION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Priority Exists ...
|
// Check Priority Exists ...
|
||||||
hasPriority = workingZone
|
hasPriority =
|
||||||
.DetectPriority(
|
hasWorkingZone &&
|
||||||
priority,
|
workingZone
|
||||||
signalBoxDir,
|
.DetectPriority(
|
||||||
zIndex,
|
priority,
|
||||||
period //
|
signalBoxDir,
|
||||||
);
|
zIndex,
|
||||||
|
period //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Price Reward and Amount Exists ...
|
// Check Price Reward and Amount Exists ...
|
||||||
hasRewardAmount = CalculateRiskReward(
|
hasRewardAmount =
|
||||||
priority,
|
hasWorkingZone &&
|
||||||
reward,
|
CalculateRiskReward(
|
||||||
amountPercent //
|
priority,
|
||||||
);
|
reward,
|
||||||
|
amountPercent //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Signal Conditions ...
|
// Check Signal Conditions ...
|
||||||
@@ -399,37 +407,22 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Draw Signal Box ...
|
// Draw Signal Box ...
|
||||||
XCBoxObject *iSignalBoxObj;
|
XCBaseObject *objects[];
|
||||||
has = drawer.DrawBox(
|
has = drawer.DrawSignalBox(
|
||||||
signalBox,
|
signalBox,
|
||||||
iSignalBoxObj //
|
objects,
|
||||||
|
clrYellow //
|
||||||
);
|
);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
iSignalBoxObj.BoxWidth(1);
|
int count = ArraySize(objects);
|
||||||
iSignalBoxObj.BoxColor(clrYellow);
|
for (int i = 0; i < count; i++)
|
||||||
iSignalBoxObj.BoxStyle(STYLE_SOLID);
|
|
||||||
|
|
||||||
//
|
|
||||||
workingZone.mDrawnObjects.Add(iSignalBoxObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Draw Signal Holder Box if Exists ...
|
|
||||||
if (signalHolderBox.IsValid())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCBoxObject *iSignalHolderBoxObj;
|
|
||||||
has = drawer.DrawBox(
|
|
||||||
signalHolderBox,
|
|
||||||
iSignalHolderBoxObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
{
|
||||||
workingZone.mDrawnObjects.Add(iSignalHolderBoxObj);
|
workingZone.mDrawnObjects.Add(objects[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Clean(objects);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Signal Direction ...
|
// Detect Signal Direction ...
|
||||||
@@ -438,17 +431,17 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
pivot = isBullish
|
pivot = isBullish
|
||||||
? signalBox.lower
|
? signalBox.ob.lower
|
||||||
: signalBox.upper;
|
: signalBox.ob.upper;
|
||||||
|
|
||||||
//
|
//
|
||||||
point = isBullish
|
point = isBullish
|
||||||
? signalBox.upper
|
? signalBox.ob.upper
|
||||||
: signalBox.lower;
|
: signalBox.ob.lower;
|
||||||
|
|
||||||
//
|
//
|
||||||
double entry = GetEntry(
|
double entry = GetEntry(
|
||||||
signalBox.symbol,
|
signalBox.ob.symbol,
|
||||||
signalBoxDir //
|
signalBoxDir //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -471,41 +464,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
// Select and Provide SL Based on ...
|
// Select and Provide SL Based on ...
|
||||||
double iAtr = 0;
|
double iAtr = 0;
|
||||||
if (signalProvider == X121SMC_XWZ_PROVIDER_XHKMA)
|
if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
iAtr = provider.decisionXConditions.atrBuffer[1];
|
iAtr = provider.decisionXConditions.atrBuffer[1];
|
||||||
iAtr *= 0;
|
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 ...
|
// Fix rf Reward ...
|
||||||
rfRewar = 2;
|
rfRewar = 2;
|
||||||
@@ -900,7 +864,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
mConditions.setupTime = cTime;
|
mConditions.setupTime = cTime;
|
||||||
mConditions.dir = signalBoxDir;
|
mConditions.dir = signalBoxDir;
|
||||||
mConditions.priority = priority;
|
mConditions.priority = priority;
|
||||||
mConditions.signalBox = signalBox;
|
mConditions.signalBox = signalBox.ob;
|
||||||
mConditions.provider = signalProvider;
|
mConditions.provider = signalProvider;
|
||||||
mConditions.amountPercent = amountPercent;
|
mConditions.amountPercent = amountPercent;
|
||||||
}
|
}
|
||||||
@@ -921,7 +885,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
signalBox.Clean();
|
signalBox.Clean();
|
||||||
signalHolderBox.Clean();
|
|
||||||
consolidationZBar.Clean();
|
consolidationZBar.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
enum ENUM_X121SMC_XWZ_PROVIDERS
|
enum ENUM_X121SMC_XWZ_PROVIDERS
|
||||||
{
|
{
|
||||||
X121SMC_XWZ_PROVIDER_NONE,
|
X121SMC_XWZ_PROVIDER_NONE,
|
||||||
X121SMC_XWZ_PROVIDER_XHKMA,
|
|
||||||
X121SMC_XWZ_PROVIDER_XBREAKED_BOX,
|
X121SMC_XWZ_PROVIDER_XBREAKED_BOX,
|
||||||
X121SMC_XWZ_PROVIDER_XREJECTED_BOX,
|
X121SMC_XWZ_PROVIDER_XREJECTED_BOX,
|
||||||
X121SMC_XWZ_PROVIDER_XACTIVATED_BOX,
|
X121SMC_XWZ_PROVIDER_XACTIVATED_BOX,
|
||||||
@@ -488,6 +487,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
int idx = -1;
|
int idx = -1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool has = false;
|
bool has = false;
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
//
|
//
|
||||||
if (barIndex < 0)
|
if (barIndex < 0)
|
||||||
@@ -559,235 +559,19 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Select Order Blocks ...
|
// Detect a Sharp Zone Which Contains
|
||||||
if (obStateEvents.hasNewOrderBlock)
|
// an Order Block and Also an FVG ...
|
||||||
{
|
|
||||||
//
|
|
||||||
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 (obStateEvents.hasNewSharp)
|
if (obStateEvents.hasNewSharp)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
XBoxZone ob;
|
||||||
|
XBoxZone fvg;
|
||||||
XBoxZone currSharp;
|
XBoxZone currSharp;
|
||||||
XBoxZone prevSharp;
|
XBoxZone prevSharp;
|
||||||
XBoxZone sharpConsolidation;
|
XBoxZone sharpConsolidation;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Current Sharp ...
|
// Retrieve Current Sharp ...
|
||||||
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
|
||||||
XBoxZone tmpBoxes[];
|
XBoxZone tmpBoxes[];
|
||||||
Copy(
|
Copy(
|
||||||
obState.sharps,
|
obState.sharps,
|
||||||
@@ -906,37 +690,225 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Detect Order Block / FVG ...
|
||||||
has = sharpConsolidation.IsValid();
|
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)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
while (HasChild(tmpBoxes))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetYoungest(tmpBoxes);
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[idx];
|
||||||
|
ArrayRemove(
|
||||||
|
tmpBoxes,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Selected Box ...
|
||||||
|
bool isDirPassed = iBox.dir == sharpConsolidation.dir;
|
||||||
|
bool isFromPassed = iBox.from > sharpConsolidation.from;
|
||||||
|
bool isInsidePassed = IsBoxInside(
|
||||||
|
iBox,
|
||||||
|
sharpConsolidation //
|
||||||
|
);
|
||||||
|
bool isValidationPassed = IsBoxValid(
|
||||||
|
iBox,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
has = isDirPassed &&
|
||||||
|
isFromPassed &&
|
||||||
|
isInsidePassed &&
|
||||||
|
isValidationPassed;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (has)
|
Clean(tmpBoxes);
|
||||||
{
|
currSharp.Clean();
|
||||||
//
|
prevSharp.Clean();
|
||||||
XCBoxObject *iCurrObj;
|
sharpConsolidation.Clean();
|
||||||
XCBoxObject *iPrevObj;
|
|
||||||
XCBoxObject *iSharpConsolidationObj;
|
|
||||||
has = drawer.DrawBox(
|
|
||||||
currSharp,
|
|
||||||
iCurrObj //
|
|
||||||
);
|
|
||||||
has =
|
|
||||||
has &&
|
|
||||||
drawer.DrawBox(
|
|
||||||
prevSharp,
|
|
||||||
iPrevObj //
|
|
||||||
);
|
|
||||||
has =
|
|
||||||
has &&
|
|
||||||
drawer.DrawBox(
|
|
||||||
sharpConsolidation,
|
|
||||||
iSharpConsolidationObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
Print("Sharp Detection ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1017,15 +989,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
has = isInite &&
|
has = isInite &&
|
||||||
(
|
(
|
||||||
//
|
|
||||||
IsBoxBreaked(
|
|
||||||
iBox.fvg,
|
|
||||||
iBar.Index() - 1,
|
|
||||||
barIndex,
|
|
||||||
period //
|
|
||||||
)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
//
|
||||||
IsBoxBreaked(
|
IsBoxBreaked(
|
||||||
iBox.ob,
|
iBox.ob,
|
||||||
@@ -1335,14 +1298,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
count = CountWaitingBoxes();
|
count = CountWaitingBoxes();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
waitingBoxes[i].UpdateTo(value);
|
||||||
waitingBoxes[i].ob.to = value;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (waitingBoxes[i].fvg.IsValid())
|
|
||||||
{
|
|
||||||
waitingBoxes[i].fvg.to = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1443,7 +1399,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
* Detect Signal Box Conditions ...
|
* Detect Signal Box Conditions ...
|
||||||
*
|
*
|
||||||
* @param box: XBoxZone instance reference, Signalled Box ...
|
* @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 dir: ENUM_X_DIRECTION member, Specified Signal Direction ...
|
||||||
* @param signalProvider: ENUM_X121SMC_XWZ_PROVIDERS member, Specified Signal Type ...
|
* @param signalProvider: ENUM_X121SMC_XWZ_PROVIDERS member, Specified Signal Type ...
|
||||||
* @param provider: X121SMCStrategySignalProviderData instance reference ...
|
* @param provider: X121SMCStrategySignalProviderData instance reference ...
|
||||||
@@ -1452,8 +1407,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool DetectSignalConditions(
|
bool DetectSignalConditions(
|
||||||
XBoxZone &box,
|
XSignalBox &box,
|
||||||
XBoxZone &holderBox,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
ENUM_X121SMC_XWZ_PROVIDERS &signalProvider,
|
ENUM_X121SMC_XWZ_PROVIDERS &signalProvider,
|
||||||
X121SMCStrategySignalProviderData &provider,
|
X121SMCStrategySignalProviderData &provider,
|
||||||
@@ -1468,7 +1422,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
box.Clean();
|
box.Clean();
|
||||||
holderBox.Clean();
|
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
signalProvider = X121SMC_XWZ_PROVIDER_NONE;
|
signalProvider = X121SMC_XWZ_PROVIDER_NONE;
|
||||||
|
|
||||||
@@ -1507,14 +1460,14 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
// Rejected Box ...
|
// Rejected Box ...
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
bool useSenario1 = true;
|
bool useSenario1 = false;
|
||||||
bool isSenario1Happend = false;
|
bool isSenario1Happend = false;
|
||||||
bool isSenario1Bullish = false;
|
bool isSenario1Bullish = false;
|
||||||
bool isSenario1Bearish = false;
|
bool isSenario1Bearish = false;
|
||||||
if (useSenario1)
|
if (useSenario1)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
isSenario1Happend = cParser.HasSenario1Conditions(
|
isSenario1Happend = cParser.HasRejectedBoxConditions(
|
||||||
X_CYCLE_DECISION,
|
X_CYCLE_DECISION,
|
||||||
box,
|
box,
|
||||||
holderBox,
|
holderBox,
|
||||||
@@ -1553,32 +1506,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
if (!isSenario1Happend &&
|
if (!isSenario1Happend &&
|
||||||
useSenario2)
|
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 &&
|
!isSenario2Happend &&
|
||||||
useSenario3)
|
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 &&
|
!isSenario3Happend &&
|
||||||
useSenario4)
|
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:
|
// Senario 5:
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
|
// XSHCNZ Signal Box Detection Conditions ...
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
bool useSenario5 = false;
|
bool useSenario5 = true;
|
||||||
bool isSenario5Happend = false;
|
bool isSenario5Happend = false;
|
||||||
bool isSenario5Bullish = false;
|
bool isSenario5Bullish = false;
|
||||||
bool isSenario5Bearish = false;
|
bool isSenario5Bearish = false;
|
||||||
@@ -1708,7 +1583,8 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
isSenario2Bullish ||
|
isSenario2Bullish ||
|
||||||
isSenario3Bullish ||
|
isSenario3Bullish ||
|
||||||
isSenario4Bullish ||
|
isSenario4Bullish ||
|
||||||
isSenario5Bullish
|
isSenario5Bullish ||
|
||||||
|
isSenario6Bullish
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1719,7 +1595,8 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
isSenario2Bearish ||
|
isSenario2Bearish ||
|
||||||
isSenario3Bearish ||
|
isSenario3Bearish ||
|
||||||
isSenario4Bearish ||
|
isSenario4Bearish ||
|
||||||
isSenario5Bearish
|
isSenario5Bearish ||
|
||||||
|
isSenario6Bearish
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1876,13 +1753,13 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
*
|
*
|
||||||
* @param drawSupplyZone: boolean ...
|
* @param drawSupplyZone: boolean ...
|
||||||
* @param drawDemandZone: boolean ...
|
* @param drawDemandZone: boolean ...
|
||||||
* @param drawWaitingZones: boolean ...
|
* @param drawWaitingBoxes: boolean ...
|
||||||
*/
|
*/
|
||||||
void Draw(
|
void Draw(
|
||||||
XCPOIDrawer *drawer,
|
XCPOIDrawer *drawer,
|
||||||
bool drawSupplyZone = false,
|
bool drawSupplyZone = false,
|
||||||
bool drawDemandZone = false,
|
bool drawDemandZone = false,
|
||||||
bool drawWaitingZones = false,
|
bool drawWaitingBoxes = false,
|
||||||
bool drawTrend = false //
|
bool drawTrend = false //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -2108,7 +1985,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Waiting Zones ...
|
// Waiting Zones ...
|
||||||
if (drawWaitingZones)
|
if (drawWaitingBoxes)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
has = HasWaitingBoxes();
|
has = HasWaitingBoxes();
|
||||||
@@ -2119,42 +1996,21 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// OB ...
|
XCBaseObject *objects[];
|
||||||
XCBoxObject *iOBBoxObj;
|
has = drawer.DrawSignalBox(
|
||||||
has = drawer.DrawBox(
|
waitingBoxes[i],
|
||||||
waitingBoxes[i].ob,
|
objects //
|
||||||
iOBBoxObj //
|
|
||||||
);
|
);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
|
||||||
mDrawnObjects.Add(iOBBoxObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// FVG ...
|
|
||||||
if (waitingBoxes[i].fvg.IsValid())
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCBoxObject *iFVGBoxObj;
|
count = ArraySize(objects);
|
||||||
has = drawer.DrawBox(
|
for (int i = 0; i < count; i++)
|
||||||
waitingBoxes[i].fvg,
|
|
||||||
iFVGBoxObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
{
|
||||||
//
|
mWorkingZoneObjects.Add(objects[i]);
|
||||||
iFVGBoxObj.BoxStyle(STYLE_SOLID);
|
|
||||||
|
|
||||||
//
|
|
||||||
mDrawnObjects.Add(iFVGBoxObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(iFVGBoxObj);
|
|
||||||
}
|
}
|
||||||
|
Clean(objects);
|
||||||
//
|
|
||||||
ZeroMemory(iOBBoxObj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -835,8 +835,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// XVWAP ...
|
// XVWAP ...
|
||||||
x121Inputs.xvwapInputs.showVWapFast = showAll || false;
|
x121Inputs.xvwapInputs.showVWapFast = showAll || true;
|
||||||
x121Inputs.xvwapInputs.showVWapMedium = showAll || false;
|
x121Inputs.xvwapInputs.showVWapMedium = showAll || true;
|
||||||
x121Inputs.xvwapInputs.showVWapSlow = showAll || false;
|
x121Inputs.xvwapInputs.showVWapSlow = showAll || false;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user