last ...
This commit is contained in:
@@ -38,7 +38,7 @@ enum ENUM_XCHARTOBJECTS
|
||||
//
|
||||
// Global ...
|
||||
X_ZONE_OBJ = 7860,
|
||||
X_FROM_TO_OBJ = 7861,
|
||||
X_BOX_OBJ = 7861,
|
||||
X_BAR_ARROW_OBJ = 7862,
|
||||
//
|
||||
X_SIGNAL_OBJ = 8860,
|
||||
@@ -2359,7 +2359,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Set Pivot Width ...
|
||||
* Set High Shadow Width ...
|
||||
*
|
||||
* @param value: Integer ...
|
||||
*/
|
||||
@@ -2376,7 +2376,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Color ...
|
||||
* Set High Shadow 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 ...
|
||||
*/
|
||||
@@ -2396,7 +2396,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Fill ...
|
||||
* Set High Shadow Fill ...
|
||||
*
|
||||
* @param value: Boolean ...
|
||||
*/
|
||||
@@ -2406,7 +2406,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Width ...
|
||||
* Set Body Width ...
|
||||
*
|
||||
* @param value: Integer ...
|
||||
*/
|
||||
@@ -2423,7 +2423,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Color ...
|
||||
* Set Body Color ...
|
||||
*
|
||||
* @param value: Color ...
|
||||
*/
|
||||
@@ -2433,7 +2433,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Style ...
|
||||
* Set Body Style ...
|
||||
*
|
||||
* @param value: ENUM_LINE_STYLE member ...
|
||||
*/
|
||||
@@ -2443,7 +2443,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Fill ...
|
||||
* Set Body Fill ...
|
||||
*
|
||||
* @param value: Boolean ...
|
||||
*/
|
||||
@@ -2453,7 +2453,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Width ...
|
||||
* Set Low Shadow Width ...
|
||||
*
|
||||
* @param value: Integer ...
|
||||
*/
|
||||
@@ -2470,7 +2470,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Color ...
|
||||
* Set Low Shadow 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 ...
|
||||
*/
|
||||
@@ -2490,7 +2490,7 @@ class XCOHCLObject : public XCBaseObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pivot Fill ...
|
||||
* Set Low Shadow Fill ...
|
||||
*
|
||||
* @param value: Boolean ...
|
||||
*/
|
||||
@@ -2523,6 +2523,154 @@ class XCOHCLObject : public XCBaseObject
|
||||
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 ...
|
||||
|
||||
|
||||
@@ -2858,6 +2858,97 @@ class XCPOIDrawer : public XCBase
|
||||
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 ...
|
||||
*
|
||||
@@ -2934,7 +3025,8 @@ class XCPOIDrawer : public XCBase
|
||||
int DrawPriceZone(
|
||||
XPriceZones &zone,
|
||||
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 isBearish = IsBearish(forDir);
|
||||
bool isAll = forDir == X_DIRECTION_ALL ||
|
||||
forDir == X_DIRECTION_NONE;
|
||||
|
||||
@@ -2958,170 +3051,272 @@ class XCPOIDrawer : public XCBase
|
||||
if (isAll || isBullish)
|
||||
{
|
||||
//
|
||||
// Support Zone ...
|
||||
if (zone.HasSupportZone())
|
||||
if (onlyBoundary)
|
||||
{
|
||||
//
|
||||
XCSupportZoneObject *iObj;
|
||||
bool isCreated = CreateSupportZone(
|
||||
zone.supportZone,
|
||||
iObj //
|
||||
double upper = 0;
|
||||
double lower = 0;
|
||||
datetime to = NULL;
|
||||
datetime from = NULL;
|
||||
|
||||
//
|
||||
bool isRetrieved = zone.GetBoxData(
|
||||
X_DIRECTION_NONE,
|
||||
upper,
|
||||
lower,
|
||||
from,
|
||||
to //
|
||||
);
|
||||
if (isCreated)
|
||||
if (isRetrieved)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
color clr =
|
||||
isBullish
|
||||
? BarBullishColor()
|
||||
: isBearish
|
||||
? BarBearishColor()
|
||||
: clrGray;
|
||||
XCBoxObject *iObj;
|
||||
result = CreateBox(
|
||||
iObj,
|
||||
upper,
|
||||
lower,
|
||||
from,
|
||||
to,
|
||||
clr,
|
||||
1,
|
||||
false,
|
||||
STYLE_DOT //
|
||||
);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zone ...
|
||||
if (zone.HasDemandZone())
|
||||
else
|
||||
{
|
||||
//
|
||||
XCDemandZoneObject *iObj;
|
||||
bool isCreated = CreateDemandZone(
|
||||
zone.demandZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
// Support Zone ...
|
||||
if (zone.HasSupportZone())
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
XCSupportZoneObject *iObj;
|
||||
bool isCreated = CreateSupportZone(
|
||||
zone.supportZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// OrderBlock ...
|
||||
if (zone.HasOrderBlock() &&
|
||||
zone.orderBlock.IsBullish())
|
||||
{
|
||||
//
|
||||
XCBullishOrderBlockObject *iObj;
|
||||
bool isCreated = CreateBullishOrderBlock(
|
||||
zone.orderBlock,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
// Demand Zone ...
|
||||
if (zone.HasDemandZone())
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
XCDemandZoneObject *iObj;
|
||||
bool isCreated = CreateDemandZone(
|
||||
zone.demandZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// FairValueGap ...
|
||||
if (zone.HasFairValueGap() &&
|
||||
zone.fairValueGap.IsBullish())
|
||||
{
|
||||
//
|
||||
XCBullishFairValueGapObject *iObj;
|
||||
bool isCreated = CreateBullishFairValueGap(
|
||||
zone.fairValueGap,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
// OrderBlock ...
|
||||
if (zone.HasOrderBlock() &&
|
||||
zone.orderBlock.IsBullish())
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
XCBullishOrderBlockObject *iObj;
|
||||
bool isCreated = CreateBullishOrderBlock(
|
||||
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 (zone.HasResistanceZone())
|
||||
if (onlyBoundary)
|
||||
{
|
||||
//
|
||||
XCResistanceZoneObject *iObj;
|
||||
bool isCreated = CreateResistanceZone(
|
||||
zone.resistanceZone,
|
||||
iObj //
|
||||
double upper = 0;
|
||||
double lower = 0;
|
||||
datetime to = NULL;
|
||||
datetime from = NULL;
|
||||
|
||||
//
|
||||
bool isRetrieved = zone.GetBoxData(
|
||||
X_DIRECTION_NONE,
|
||||
upper,
|
||||
lower,
|
||||
from,
|
||||
to //
|
||||
);
|
||||
if (isCreated)
|
||||
if (isRetrieved)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
color clr =
|
||||
isBullish
|
||||
? BarBullishColor()
|
||||
: isBearish
|
||||
? BarBearishColor()
|
||||
: clrGray;
|
||||
XCBoxObject *iObj;
|
||||
result = CreateBox(
|
||||
iObj,
|
||||
upper,
|
||||
lower,
|
||||
from,
|
||||
to,
|
||||
clr,
|
||||
1,
|
||||
false,
|
||||
STYLE_DOT //
|
||||
);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Supply Zone ...
|
||||
if (zone.HasSupplyZone())
|
||||
else
|
||||
{
|
||||
//
|
||||
XCSupplyZoneObject *iObj;
|
||||
bool isCreated = CreateSupplyZone(
|
||||
zone.supplyZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
// Resistance Zone ...
|
||||
if (zone.HasResistanceZone())
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
XCResistanceZoneObject *iObj;
|
||||
bool isCreated = CreateResistanceZone(
|
||||
zone.resistanceZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// OrderBlock ...
|
||||
if (zone.HasOrderBlock() &&
|
||||
zone.orderBlock.IsBearish())
|
||||
{
|
||||
//
|
||||
XCBearishOrderBlockObject *iObj;
|
||||
bool isCreated = CreateBearishOrderBlock(
|
||||
zone.orderBlock,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
// Supply Zone ...
|
||||
if (zone.HasSupplyZone())
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
XCSupplyZoneObject *iObj;
|
||||
bool isCreated = CreateSupplyZone(
|
||||
zone.supplyZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// FairValueGap ...
|
||||
if (zone.HasFairValueGap() &&
|
||||
zone.fairValueGap.IsBearish())
|
||||
{
|
||||
//
|
||||
XCBearishFairValueGapObject *iObj;
|
||||
bool isCreated = CreateBearishFairValueGap(
|
||||
zone.fairValueGap,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
// OrderBlock ...
|
||||
if (zone.HasOrderBlock() &&
|
||||
zone.orderBlock.IsBearish())
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
XCBearishOrderBlockObject *iObj;
|
||||
bool isCreated = CreateBearishOrderBlock(
|
||||
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 //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user