last ...
This commit is contained in:
@@ -38,7 +38,7 @@ enum ENUM_XCHARTOBJECTS
|
|||||||
//
|
//
|
||||||
// Global ...
|
// Global ...
|
||||||
X_ZONE_OBJ = 7860,
|
X_ZONE_OBJ = 7860,
|
||||||
X_FROM_TO_OBJ = 7861,
|
X_BOX_OBJ = 7861,
|
||||||
X_BAR_ARROW_OBJ = 7862,
|
X_BAR_ARROW_OBJ = 7862,
|
||||||
//
|
//
|
||||||
X_SIGNAL_OBJ = 8860,
|
X_SIGNAL_OBJ = 8860,
|
||||||
@@ -2359,7 +2359,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
// Getter(s) / Setter(s) ...
|
// Getter(s) / Setter(s) ...
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Width ...
|
* Set High Shadow Width ...
|
||||||
*
|
*
|
||||||
* @param value: Integer ...
|
* @param value: Integer ...
|
||||||
*/
|
*/
|
||||||
@@ -2376,7 +2376,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Color ...
|
* Set High Shadow Color ...
|
||||||
*
|
*
|
||||||
* @param value: Color ...
|
* @param value: Color ...
|
||||||
*/
|
*/
|
||||||
@@ -2386,7 +2386,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Style ...
|
* Set High Shadow Style ...
|
||||||
*
|
*
|
||||||
* @param value: ENUM_LINE_STYLE member ...
|
* @param value: ENUM_LINE_STYLE member ...
|
||||||
*/
|
*/
|
||||||
@@ -2396,7 +2396,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Fill ...
|
* Set High Shadow Fill ...
|
||||||
*
|
*
|
||||||
* @param value: Boolean ...
|
* @param value: Boolean ...
|
||||||
*/
|
*/
|
||||||
@@ -2406,7 +2406,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Width ...
|
* Set Body Width ...
|
||||||
*
|
*
|
||||||
* @param value: Integer ...
|
* @param value: Integer ...
|
||||||
*/
|
*/
|
||||||
@@ -2423,7 +2423,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Color ...
|
* Set Body Color ...
|
||||||
*
|
*
|
||||||
* @param value: Color ...
|
* @param value: Color ...
|
||||||
*/
|
*/
|
||||||
@@ -2433,7 +2433,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Style ...
|
* Set Body Style ...
|
||||||
*
|
*
|
||||||
* @param value: ENUM_LINE_STYLE member ...
|
* @param value: ENUM_LINE_STYLE member ...
|
||||||
*/
|
*/
|
||||||
@@ -2443,7 +2443,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Fill ...
|
* Set Body Fill ...
|
||||||
*
|
*
|
||||||
* @param value: Boolean ...
|
* @param value: Boolean ...
|
||||||
*/
|
*/
|
||||||
@@ -2453,7 +2453,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Width ...
|
* Set Low Shadow Width ...
|
||||||
*
|
*
|
||||||
* @param value: Integer ...
|
* @param value: Integer ...
|
||||||
*/
|
*/
|
||||||
@@ -2470,7 +2470,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Color ...
|
* Set Low Shadow Color ...
|
||||||
*
|
*
|
||||||
* @param value: Color ...
|
* @param value: Color ...
|
||||||
*/
|
*/
|
||||||
@@ -2480,7 +2480,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Style ...
|
* Set Low Shadow Style ...
|
||||||
*
|
*
|
||||||
* @param value: ENUM_LINE_STYLE member ...
|
* @param value: ENUM_LINE_STYLE member ...
|
||||||
*/
|
*/
|
||||||
@@ -2490,7 +2490,7 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pivot Fill ...
|
* Set Low Shadow Fill ...
|
||||||
*
|
*
|
||||||
* @param value: Boolean ...
|
* @param value: Boolean ...
|
||||||
*/
|
*/
|
||||||
@@ -2523,6 +2523,154 @@ class XCOHCLObject : public XCBaseObject
|
|||||||
CChartObjectRectangle mLowShadowRect;
|
CChartObjectRectangle mLowShadowRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class XCBoxObject : public XCBaseObject
|
||||||
|
{
|
||||||
|
//
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creator ...
|
||||||
|
*
|
||||||
|
* @param chart_id: Long, Specified Chart ID ...
|
||||||
|
* @param window: Integer, Specified Chart Window ID ...
|
||||||
|
* @param pivot: XPVPivot instance ...
|
||||||
|
* @param prefix: String ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool Create(
|
||||||
|
long chart_id,
|
||||||
|
int window,
|
||||||
|
string name,
|
||||||
|
double upper,
|
||||||
|
double lower,
|
||||||
|
datetime from,
|
||||||
|
datetime to,
|
||||||
|
string prefix = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
upper > 0 &&
|
||||||
|
lower > 0 &&
|
||||||
|
to > from &&
|
||||||
|
IsValid(to) &&
|
||||||
|
IsValid(name) &&
|
||||||
|
IsValid(from) &&
|
||||||
|
upper > lower;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValid(prefix))
|
||||||
|
{
|
||||||
|
name = prefix + "_" + name;
|
||||||
|
}
|
||||||
|
string nameMD5 = ToMD5(name);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = mRect.Create(
|
||||||
|
chart_id,
|
||||||
|
name,
|
||||||
|
window,
|
||||||
|
from,
|
||||||
|
upper,
|
||||||
|
to,
|
||||||
|
lower //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
ObjName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Getter(s) / Setter(s) ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Width ...
|
||||||
|
*
|
||||||
|
* @param value: Integer ...
|
||||||
|
*/
|
||||||
|
void BoxWidth(int value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 1)
|
||||||
|
{
|
||||||
|
value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mRect.Width(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Color ...
|
||||||
|
*
|
||||||
|
* @param value: Color ...
|
||||||
|
*/
|
||||||
|
void BoxColor(color value)
|
||||||
|
{
|
||||||
|
mRect.Color(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Style ...
|
||||||
|
*
|
||||||
|
* @param value: ENUM_LINE_STYLE member ...
|
||||||
|
*/
|
||||||
|
void BoxStyle(ENUM_LINE_STYLE value)
|
||||||
|
{
|
||||||
|
mRect.Style(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Fill ...
|
||||||
|
*
|
||||||
|
* @param value: Boolean ...
|
||||||
|
*/
|
||||||
|
void BoxFill(bool value)
|
||||||
|
{
|
||||||
|
mRect.Fill(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Virtual ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Object Type ...
|
||||||
|
*
|
||||||
|
* @return ( ENUM_XCHARTOBJECTS )
|
||||||
|
*/
|
||||||
|
virtual ENUM_XCHARTOBJECTS Type()
|
||||||
|
{
|
||||||
|
return X_BOX_OBJ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
CChartObjectRectangle mRect;
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Zone Ticks ...
|
// Zone Ticks ...
|
||||||
|
|
||||||
|
|||||||
@@ -2858,6 +2858,97 @@ class XCPOIDrawer : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Specific Box on Chart ...
|
||||||
|
*
|
||||||
|
* @param upper: Double ...
|
||||||
|
* @param lower: Double ...
|
||||||
|
* @param from: Datetime ...
|
||||||
|
* @param to: Datetime ...
|
||||||
|
* @param clr: Color ...
|
||||||
|
* @param width: Integer ...
|
||||||
|
* @param fill: Boolean ...
|
||||||
|
* @param style: ENUM_LINE_STYLE member ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool CreateBox(
|
||||||
|
XCBoxObject *&object,
|
||||||
|
double upper,
|
||||||
|
double lower,
|
||||||
|
datetime from,
|
||||||
|
datetime to,
|
||||||
|
color clr = clrYellowGreen,
|
||||||
|
int width = 1,
|
||||||
|
bool fill = false,
|
||||||
|
ENUM_LINE_STYLE style = STYLE_SOLID //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
object = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
to = NormalizeTime(to);
|
||||||
|
|
||||||
|
//
|
||||||
|
string dateStr = ToFormatString(from) + "|" + ToFormatString(to);
|
||||||
|
string dateMD5 = ToMD5(dateStr);
|
||||||
|
string name = "XBox_" +
|
||||||
|
ToString(upper) + "_" +
|
||||||
|
ToString(lower) + "_" +
|
||||||
|
dateMD5;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
upper > 0 &&
|
||||||
|
lower > 0 &&
|
||||||
|
to > from &&
|
||||||
|
IsValid(to) &&
|
||||||
|
IsValid(name) &&
|
||||||
|
IsValid(from) &&
|
||||||
|
upper > lower;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string prefix = Prefix();
|
||||||
|
long chartID = ChartIdentification();
|
||||||
|
int window = SubWindowIdentification();
|
||||||
|
|
||||||
|
//
|
||||||
|
object = new XCBoxObject();
|
||||||
|
result = object.Create(
|
||||||
|
chartID,
|
||||||
|
window,
|
||||||
|
name,
|
||||||
|
upper,
|
||||||
|
lower,
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
prefix //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
object.BoxColor(clr);
|
||||||
|
object.BoxFill(fill);
|
||||||
|
object.BoxWidth(width);
|
||||||
|
object.BoxStyle(style);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw Specified Signal ...
|
* Draw Specified Signal ...
|
||||||
*
|
*
|
||||||
@@ -2934,7 +3025,8 @@ class XCPOIDrawer : public XCBase
|
|||||||
int DrawPriceZone(
|
int DrawPriceZone(
|
||||||
XPriceZones &zone,
|
XPriceZones &zone,
|
||||||
XCBaseObject *&drawnObjects[],
|
XCBaseObject *&drawnObjects[],
|
||||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||||
|
bool onlyBoundary = false //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2951,6 +3043,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isBullish = IsBullish(forDir);
|
bool isBullish = IsBullish(forDir);
|
||||||
|
bool isBearish = IsBearish(forDir);
|
||||||
bool isAll = forDir == X_DIRECTION_ALL ||
|
bool isAll = forDir == X_DIRECTION_ALL ||
|
||||||
forDir == X_DIRECTION_NONE;
|
forDir == X_DIRECTION_NONE;
|
||||||
|
|
||||||
@@ -2958,170 +3051,272 @@ class XCPOIDrawer : public XCBase
|
|||||||
if (isAll || isBullish)
|
if (isAll || isBullish)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Support Zone ...
|
if (onlyBoundary)
|
||||||
if (zone.HasSupportZone())
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCSupportZoneObject *iObj;
|
double upper = 0;
|
||||||
bool isCreated = CreateSupportZone(
|
double lower = 0;
|
||||||
zone.supportZone,
|
datetime to = NULL;
|
||||||
iObj //
|
datetime from = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRetrieved = zone.GetBoxData(
|
||||||
|
X_DIRECTION_NONE,
|
||||||
|
upper,
|
||||||
|
lower,
|
||||||
|
from,
|
||||||
|
to //
|
||||||
);
|
);
|
||||||
if (isCreated)
|
if (isRetrieved)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
color clr =
|
||||||
(XCBaseObject *)iObj,
|
isBullish
|
||||||
drawnObjects //
|
? BarBullishColor()
|
||||||
|
: isBearish
|
||||||
|
? BarBearishColor()
|
||||||
|
: clrGray;
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
result = CreateBox(
|
||||||
|
iObj,
|
||||||
|
upper,
|
||||||
|
lower,
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
clr,
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
STYLE_DOT //
|
||||||
);
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//
|
|
||||||
// Demand Zone ...
|
|
||||||
if (zone.HasDemandZone())
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCDemandZoneObject *iObj;
|
// Support Zone ...
|
||||||
bool isCreated = CreateDemandZone(
|
if (zone.HasSupportZone())
|
||||||
zone.demandZone,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
XCSupportZoneObject *iObj;
|
||||||
(XCBaseObject *)iObj,
|
bool isCreated = CreateSupportZone(
|
||||||
drawnObjects //
|
zone.supportZone,
|
||||||
|
iObj //
|
||||||
);
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// OrderBlock ...
|
|
||||||
if (zone.HasOrderBlock() &&
|
|
||||||
zone.orderBlock.IsBullish())
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
XCBullishOrderBlockObject *iObj;
|
// Demand Zone ...
|
||||||
bool isCreated = CreateBullishOrderBlock(
|
if (zone.HasDemandZone())
|
||||||
zone.orderBlock,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
XCDemandZoneObject *iObj;
|
||||||
(XCBaseObject *)iObj,
|
bool isCreated = CreateDemandZone(
|
||||||
drawnObjects //
|
zone.demandZone,
|
||||||
|
iObj //
|
||||||
);
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// FairValueGap ...
|
|
||||||
if (zone.HasFairValueGap() &&
|
|
||||||
zone.fairValueGap.IsBullish())
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
XCBullishFairValueGapObject *iObj;
|
// OrderBlock ...
|
||||||
bool isCreated = CreateBullishFairValueGap(
|
if (zone.HasOrderBlock() &&
|
||||||
zone.fairValueGap,
|
zone.orderBlock.IsBullish())
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
XCBullishOrderBlockObject *iObj;
|
||||||
(XCBaseObject *)iObj,
|
bool isCreated = CreateBullishOrderBlock(
|
||||||
drawnObjects //
|
zone.orderBlock,
|
||||||
|
iObj //
|
||||||
);
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// FairValueGap ...
|
||||||
|
if (zone.HasFairValueGap() &&
|
||||||
|
zone.fairValueGap.IsBullish())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBullishFairValueGapObject *iObj;
|
||||||
|
bool isCreated = CreateBullishFairValueGap(
|
||||||
|
zone.fairValueGap,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isAll || !isBullish)
|
if (isAll || isBearish)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Resistance Zone ...
|
if (onlyBoundary)
|
||||||
if (zone.HasResistanceZone())
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCResistanceZoneObject *iObj;
|
double upper = 0;
|
||||||
bool isCreated = CreateResistanceZone(
|
double lower = 0;
|
||||||
zone.resistanceZone,
|
datetime to = NULL;
|
||||||
iObj //
|
datetime from = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRetrieved = zone.GetBoxData(
|
||||||
|
X_DIRECTION_NONE,
|
||||||
|
upper,
|
||||||
|
lower,
|
||||||
|
from,
|
||||||
|
to //
|
||||||
);
|
);
|
||||||
if (isCreated)
|
if (isRetrieved)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
color clr =
|
||||||
(XCBaseObject *)iObj,
|
isBullish
|
||||||
drawnObjects //
|
? BarBullishColor()
|
||||||
|
: isBearish
|
||||||
|
? BarBearishColor()
|
||||||
|
: clrGray;
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
result = CreateBox(
|
||||||
|
iObj,
|
||||||
|
upper,
|
||||||
|
lower,
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
clr,
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
STYLE_DOT //
|
||||||
);
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//
|
|
||||||
// Supply Zone ...
|
|
||||||
if (zone.HasSupplyZone())
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCSupplyZoneObject *iObj;
|
// Resistance Zone ...
|
||||||
bool isCreated = CreateSupplyZone(
|
if (zone.HasResistanceZone())
|
||||||
zone.supplyZone,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
XCResistanceZoneObject *iObj;
|
||||||
(XCBaseObject *)iObj,
|
bool isCreated = CreateResistanceZone(
|
||||||
drawnObjects //
|
zone.resistanceZone,
|
||||||
|
iObj //
|
||||||
);
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// OrderBlock ...
|
|
||||||
if (zone.HasOrderBlock() &&
|
|
||||||
zone.orderBlock.IsBearish())
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
XCBearishOrderBlockObject *iObj;
|
// Supply Zone ...
|
||||||
bool isCreated = CreateBearishOrderBlock(
|
if (zone.HasSupplyZone())
|
||||||
zone.orderBlock,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
XCSupplyZoneObject *iObj;
|
||||||
(XCBaseObject *)iObj,
|
bool isCreated = CreateSupplyZone(
|
||||||
drawnObjects //
|
zone.supplyZone,
|
||||||
|
iObj //
|
||||||
);
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// FairValueGap ...
|
|
||||||
if (zone.HasFairValueGap() &&
|
|
||||||
zone.fairValueGap.IsBearish())
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
XCBearishFairValueGapObject *iObj;
|
// OrderBlock ...
|
||||||
bool isCreated = CreateBearishFairValueGap(
|
if (zone.HasOrderBlock() &&
|
||||||
zone.fairValueGap,
|
zone.orderBlock.IsBearish())
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
XCBearishOrderBlockObject *iObj;
|
||||||
(XCBaseObject *)iObj,
|
bool isCreated = CreateBearishOrderBlock(
|
||||||
drawnObjects //
|
zone.orderBlock,
|
||||||
|
iObj //
|
||||||
);
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// FairValueGap ...
|
||||||
|
if (zone.HasFairValueGap() &&
|
||||||
|
zone.fairValueGap.IsBearish())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBearishFairValueGapObject *iObj;
|
||||||
|
bool isCreated = CreateBearishFairValueGap(
|
||||||
|
zone.fairValueGap,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Ve
|
|||||||
//
|
//
|
||||||
// Trade ...
|
// Trade ...
|
||||||
input group "Trade";
|
input group "Trade";
|
||||||
input bool eaAllowTrade = true; // Allow Open Trade On Signals
|
input bool eaAllowTrade = true; // Allow Open Trade On Signals
|
||||||
input string eaStartTradeAt = "0:0"; // Enable Trade on Signals on Time
|
input string eaStartTradeAt = ""; // Enable Trade on Signals on Time
|
||||||
input string eaStopTradeAt = "0:0"; // Enable Trade on Signals on Time
|
input string eaStopTradeAt = ""; // Enable Trade on Signals on Time
|
||||||
input string eaCloseAllTradesAt = "0:0"; // Enable Close All Trades on Signals on Time
|
input string eaCloseAllTradesAt = "11:30"; // Enable Close All Trades on Signals on Time
|
||||||
|
|
||||||
//
|
//
|
||||||
// Risk Management ...
|
// Risk Management ...
|
||||||
|
|||||||
@@ -1832,7 +1832,7 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
canContinue = index > barIndex + loopback;
|
canContinue = index < barIndex + loopback;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1884,7 +1884,7 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
canContinue = index > barIndex + loopback;
|
canContinue = index < barIndex + loopback;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5225,15 +5225,10 @@ struct XPriceZones
|
|||||||
//
|
//
|
||||||
Clean(zones);
|
Clean(zones);
|
||||||
|
|
||||||
//
|
|
||||||
if (dir == X_DIRECTION_NONE)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBullish = IsBullish(dir);
|
bool isBullish = IsBullish(dir);
|
||||||
bool isBoth = dir == X_DIRECTION_ALL;
|
bool isBoth = dir == X_DIRECTION_ALL ||
|
||||||
|
dir == X_DIRECTION_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isBoth || isBullish)
|
if (isBoth || isBullish)
|
||||||
@@ -5396,6 +5391,293 @@ struct XPriceZones
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Lifetime of Zones ...
|
||||||
|
*
|
||||||
|
* @param dir: ENUM_X_DIRECTION Member, Specified Direction ...
|
||||||
|
* @param from: DateTime ...
|
||||||
|
* @param to: DateTime ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool GetLifetime(
|
||||||
|
ENUM_X_DIRECTION dir,
|
||||||
|
datetime &from,
|
||||||
|
datetime &to //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
to = NULL;
|
||||||
|
from = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
XCZone *zones[];
|
||||||
|
int mCount = FillZones(dir, zones);
|
||||||
|
result = IsValidSize(mCount);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish(dir);
|
||||||
|
bool isAll = dir == X_DIRECTION_NONE ||
|
||||||
|
dir == X_DIRECTION_ALL;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isAll || isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Support Zone ...
|
||||||
|
bool hasSupportZone = HasSupportZone();
|
||||||
|
if (hasSupportZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupportZone *zone = supportZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
from =
|
||||||
|
!IsValid(from) ||
|
||||||
|
from > zone.From()
|
||||||
|
? zone.From()
|
||||||
|
: from;
|
||||||
|
|
||||||
|
//
|
||||||
|
to =
|
||||||
|
!IsValid(to) ||
|
||||||
|
to < zone.To()
|
||||||
|
? zone.To()
|
||||||
|
: from;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Demand Zone ...
|
||||||
|
bool hasDemandZone = HasDemandZone();
|
||||||
|
if (hasDemandZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCDemandZone *zone = demandZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
from =
|
||||||
|
!IsValid(from) ||
|
||||||
|
from > zone.From()
|
||||||
|
? zone.From()
|
||||||
|
: from;
|
||||||
|
|
||||||
|
//
|
||||||
|
to =
|
||||||
|
!IsValid(to) ||
|
||||||
|
to < zone.To()
|
||||||
|
? zone.To()
|
||||||
|
: from;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Block ...
|
||||||
|
bool hasOrderBlock = HasOrderBlock() &&
|
||||||
|
orderBlock.IsBullish();
|
||||||
|
if (hasOrderBlock)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock *zone = orderBlock;
|
||||||
|
|
||||||
|
//
|
||||||
|
from =
|
||||||
|
!IsValid(from) ||
|
||||||
|
from > zone.From()
|
||||||
|
? zone.From()
|
||||||
|
: from;
|
||||||
|
|
||||||
|
//
|
||||||
|
to =
|
||||||
|
!IsValid(to) ||
|
||||||
|
to < zone.To()
|
||||||
|
? zone.To()
|
||||||
|
: from;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gap ...
|
||||||
|
bool hasFairValueGap = HasFairValueGap() &&
|
||||||
|
fairValueGap.IsBullish();
|
||||||
|
if (hasFairValueGap)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG *zone = fairValueGap;
|
||||||
|
|
||||||
|
//
|
||||||
|
from =
|
||||||
|
!IsValid(from) ||
|
||||||
|
from > zone.From()
|
||||||
|
? zone.From()
|
||||||
|
: from;
|
||||||
|
|
||||||
|
//
|
||||||
|
to =
|
||||||
|
!IsValid(to) ||
|
||||||
|
to < zone.To()
|
||||||
|
? zone.To()
|
||||||
|
: from;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isAll || !isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Resistance Zone ...
|
||||||
|
bool hasResistanceZone = HasResistanceZone();
|
||||||
|
if (hasResistanceZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCResistanceZone *zone = resistanceZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
from =
|
||||||
|
!IsValid(from) ||
|
||||||
|
from > zone.From()
|
||||||
|
? zone.From()
|
||||||
|
: from;
|
||||||
|
|
||||||
|
//
|
||||||
|
to =
|
||||||
|
!IsValid(to) ||
|
||||||
|
to < zone.To()
|
||||||
|
? zone.To()
|
||||||
|
: from;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supply Zone ...
|
||||||
|
bool hasSupplyZone = HasSupplyZone();
|
||||||
|
if (hasSupplyZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupplyZone *zone = supplyZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
from =
|
||||||
|
!IsValid(from) ||
|
||||||
|
from > zone.From()
|
||||||
|
? zone.From()
|
||||||
|
: from;
|
||||||
|
|
||||||
|
//
|
||||||
|
to =
|
||||||
|
!IsValid(to) ||
|
||||||
|
to < zone.To()
|
||||||
|
? zone.To()
|
||||||
|
: from;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Block ...
|
||||||
|
bool hasOrderBlock = HasOrderBlock() &&
|
||||||
|
orderBlock.IsBearish();
|
||||||
|
if (hasOrderBlock)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock *zone = orderBlock;
|
||||||
|
|
||||||
|
//
|
||||||
|
from =
|
||||||
|
!IsValid(from) ||
|
||||||
|
from > zone.From()
|
||||||
|
? zone.From()
|
||||||
|
: from;
|
||||||
|
|
||||||
|
//
|
||||||
|
to =
|
||||||
|
!IsValid(to) ||
|
||||||
|
to < zone.To()
|
||||||
|
? zone.To()
|
||||||
|
: from;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gap ...
|
||||||
|
bool hasFairValueGap = HasFairValueGap() &&
|
||||||
|
fairValueGap.IsBearish();
|
||||||
|
if (hasFairValueGap)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG *zone = fairValueGap;
|
||||||
|
|
||||||
|
//
|
||||||
|
from =
|
||||||
|
!IsValid(from) ||
|
||||||
|
from > zone.From()
|
||||||
|
? zone.From()
|
||||||
|
: from;
|
||||||
|
|
||||||
|
//
|
||||||
|
to =
|
||||||
|
!IsValid(to) ||
|
||||||
|
to < zone.To()
|
||||||
|
? zone.To()
|
||||||
|
: from;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
to > from &&
|
||||||
|
IsValid(to) &&
|
||||||
|
IsValid(from);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Box Model Data ...
|
||||||
|
*
|
||||||
|
* @param dir: ENUM_X_DIRECTION Member, Specified Direction ...
|
||||||
|
* @param upper: Double ...
|
||||||
|
* @param lower: Double ...
|
||||||
|
* @param from: DateTime ...
|
||||||
|
* @param to: DateTime ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool GetBoxData(
|
||||||
|
ENUM_X_DIRECTION dir,
|
||||||
|
double &upper,
|
||||||
|
double &lower,
|
||||||
|
datetime &from,
|
||||||
|
datetime &to //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasBoundary = GetBoundary(
|
||||||
|
dir,
|
||||||
|
upper,
|
||||||
|
lower //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasLifetime = GetLifetime(
|
||||||
|
dir,
|
||||||
|
from,
|
||||||
|
to //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
hasBoundary &&
|
||||||
|
hasLifetime;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3278,7 +3278,11 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
DrawX121SMCStrategyConditions(
|
DrawX121SMCStrategyConditions(
|
||||||
conditions,
|
conditions,
|
||||||
conditionsObjects,
|
conditionsObjects,
|
||||||
mDrawer //
|
mDrawer,
|
||||||
|
true,
|
||||||
|
true, // Analyse Price Zones ...
|
||||||
|
true, // Decision Zone ...
|
||||||
|
true // Only Box ...
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1328,12 +1328,13 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
string forceCloseTimeStr = CloseAllTradesAt();
|
string forceCloseTimeStr = CloseAllTradesAt();
|
||||||
datetime forceCloseTime = ParseDateTimeFromTimeString(forceCloseTimeStr);
|
datetime forceCloseTime = ParseDateTimeFromTimeString(forceCloseTimeStr);
|
||||||
bool canForceClose = IsTimeInRange(
|
bool canForceClose = IsTimeInRange(
|
||||||
TimeCurrent(),
|
TimeCurrent(),
|
||||||
forceCloseTime //
|
forceCloseTime //
|
||||||
);
|
) &&
|
||||||
|
!mIsForceCloseAtTime;
|
||||||
if (canForceClose)
|
if (canForceClose)
|
||||||
{
|
{
|
||||||
mTradeHandler.ForceClose();
|
mIsForceCloseAtTime = mTradeHandler.ForceClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1462,6 +1463,8 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
*/
|
*/
|
||||||
void HandleOnNewDay() override
|
void HandleOnNewDay() override
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
mIsForceCloseAtTime = false;
|
||||||
mTradeHandler.ResumePausedSymbols();
|
mTradeHandler.ResumePausedSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1753,6 +1756,9 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
string mStopTradeAt; // Enable Trade on Signals on Time ...
|
string mStopTradeAt; // Enable Trade on Signals on Time ...
|
||||||
string mCloseAllTradesAt; // Enable Close All Trades on Signals on Time ...
|
string mCloseAllTradesAt; // Enable Close All Trades on Signals on Time ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mIsForceCloseAtTime;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Risk Management Props ...
|
// Risk Management Props ...
|
||||||
double mR2R; // Signallers Risk to Reward Ratio ...
|
double mR2R; // Signallers Risk to Reward Ratio ...
|
||||||
|
|||||||
@@ -516,7 +516,8 @@ int DrawX121SMCStrategyConditions(
|
|||||||
XCPOIDrawer *drawer,
|
XCPOIDrawer *drawer,
|
||||||
bool drawMarketStructure = true,
|
bool drawMarketStructure = true,
|
||||||
bool drawPriceZones = true,
|
bool drawPriceZones = true,
|
||||||
bool drawDecisionZones = true //
|
bool drawDecisionZones = true,
|
||||||
|
bool drawOnlyPriceZonesBoundary = true //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -545,7 +546,9 @@ int DrawX121SMCStrategyConditions(
|
|||||||
XCBaseObject *objects[];
|
XCBaseObject *objects[];
|
||||||
int objectsCount = drawer.DrawPriceZone(
|
int objectsCount = drawer.DrawPriceZone(
|
||||||
conditions.priceZones,
|
conditions.priceZones,
|
||||||
objects //
|
objects,
|
||||||
|
conditions.signalDir,
|
||||||
|
drawOnlyPriceZonesBoundary //
|
||||||
);
|
);
|
||||||
if (IsValidSize(objectsCount))
|
if (IsValidSize(objectsCount))
|
||||||
{
|
{
|
||||||
@@ -567,7 +570,9 @@ int DrawX121SMCStrategyConditions(
|
|||||||
XCBaseObject *objects[];
|
XCBaseObject *objects[];
|
||||||
int objectsCount = drawer.DrawPriceZone(
|
int objectsCount = drawer.DrawPriceZone(
|
||||||
conditions.decisionZones,
|
conditions.decisionZones,
|
||||||
objects //
|
objects,
|
||||||
|
conditions.signalDir,
|
||||||
|
drawOnlyPriceZonesBoundary //
|
||||||
);
|
);
|
||||||
if (IsValidSize(objectsCount))
|
if (IsValidSize(objectsCount))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user