This commit is contained in:
2024-10-29 16:25:47 +03:30
parent b0e4f94f96
commit eb48aebac8
7 changed files with 12009 additions and 2559 deletions
+506 -64
View File
@@ -25,6 +25,7 @@
// //
#include <ChartObjects/ChartObject.mqh> #include <ChartObjects/ChartObject.mqh>
#include <ChartObjects/ChartObjectsArrows.mqh>
#include <ChartObjects/ChartObjectsLines.mqh> #include <ChartObjects/ChartObjectsLines.mqh>
#include <ChartObjects/ChartObjectsShapes.mqh> #include <ChartObjects/ChartObjectsShapes.mqh>
@@ -35,23 +36,29 @@ enum ENUM_XCHARTOBJECTS
{ {
// //
// Global ... // Global ...
X_ZONE = 7860, X_ZONE_OBJ = 7860,
X_FROM_TO = 7861, X_FROM_TO_OBJ = 7861,
X_BAR_ARROW = 7862, X_BAR_ARROW_OBJ = 7862,
// //
X_SIGNAL = 8860 X_SIGNAL_OBJ = 8860,
// //
// Structured ... // Structured ...
X_TRADE_DAY = 9860, X_TRADE_DAY_OBJ = 9860,
X_MARKET_SESSION = 9861, X_MARKET_SESSION_OBJ = 9861,
X_SUPPORT_ZONE = 9862, X_SWING_HIGH_OBJ = 9862,
X_RESISTANCE_ZONE = 9863, X_SWING_LOW_OBJ = 9863,
X_SUPPLY_ZONE = 9864, X_BULLISH_MOMENTUM_BAR_OBJ = 9864,
X_DEMAND_ZONE = 9865, X_BEARISH_MOMENTUM_BAR_OBJ = 9865,
X_BULLISH_ORDERBLOCK = 9866, X_BULLISH_REJECTION_BAR_OBJ = 9866,
X_BEARISH_ORDERBLOCK = 9867, X_BEARISH_REJECTION_BAR_OBJ = 9867,
X_BULLISH_FVG = 9868, X_SUPPORT_ZONE_OBJ = 9868,
X_BEARISH_FVG = 9869, X_RESISTANCE_ZONE_OBJ = 9869,
X_SUPPLY_ZONE_OBJ = 9870,
X_DEMAND_ZONE_OBJ = 9871,
X_BULLISH_ORDERBLOCK_OBJ = 9872,
X_BEARISH_ORDERBLOCK_OBJ = 9873,
X_BULLISH_FVG_OBJ = 9874,
X_BEARISH_FVG_OBJ = 9875,
}; };
enum ENUM_X_CHART_IDS enum ENUM_X_CHART_IDS
@@ -197,6 +204,9 @@ class XCBarArrow : public XCBaseObject
* @param chart_id: Long ... * @param chart_id: Long ...
* @param name: String ... * @param name: String ...
* @param window: Integer ... * @param window: Integer ...
* @param bar: XOHCL instance ...
* @param priceType: ENUM_X_PRICE member ...
* @param arrow: Integer ...
* *
* @return ( bool ) * @return ( bool )
*/ */
@@ -221,7 +231,7 @@ class XCBarArrow : public XCBaseObject
} }
// //
double time = bar.time; datetime time = bar.time;
double price = bar.GetPrice(priceType); double price = bar.GetPrice(priceType);
// //
@@ -253,7 +263,7 @@ class XCBarArrow : public XCBaseObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_BAR_ARROW; return X_BAR_ARROW_OBJ;
} }
/** /**
@@ -276,6 +286,16 @@ class XCBarArrow : public XCBaseObject
mArrow.Color(value); mArrow.Color(value);
} }
/**
* Set Arrow Width ...
*
* @param value: Integer ...
*/
void ArrowWidth(int value)
{
mArrow.Width(value);
}
// //
protected: protected:
// //
@@ -363,7 +383,7 @@ class XCFromToObject : public XCBaseObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_FROM_TO; return X_FROM_TO_OBJ;
} }
/** /**
@@ -648,7 +668,24 @@ class XCZoneObject : public XCBaseObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_ZONE; return X_ZONE_OBJ;
}
/**
* Fill Zone ...
*
* @param value: Boolean ...
*/
void ZoneFill(bool value)
{
//
if (!IsValid(mRect.Name()))
{
return;
}
//
mRect.Fill(value);
} }
/** /**
@@ -823,6 +860,10 @@ class XCSignalObject : public XCBaseObject
return result; return result;
} }
//
// Set Object Name ...
ObjName(name);
// //
return result; return result;
} }
@@ -957,7 +998,7 @@ class XCSignalObject : public XCBaseObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_SIGNAL; return X_SIGNAL_OBJ;
} }
// //
@@ -1030,17 +1071,8 @@ class XCTardeDayObject : public XCFromToObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_TRADE_DAY; return X_TRADE_DAY_OBJ;
} }
//
protected:
//
//
private:
//
//
}; };
// //
@@ -1103,21 +1135,447 @@ class XCMarketSessionObject : public XCFromToObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_MARKET_SESSION; return X_MARKET_SESSION_OBJ;
} }
//
protected:
//
//
private:
//
//
}; };
// //
class XCSwingHighObject : public // Swing High Object ...
class XCSwingHighObject : public XCBarArrow
{
//
public:
//
//
// Constructor ...
void XCSwingHighObject()
{
}
//
// Deconstructor ...
void ~XCSwingHighObject()
{
}
//
// Actions ...
/**
* Create XCSwingHighObject ...
*
* @param chart_id: Long ...
* @param name: String ...
* @param window: Integer ...
* @param bar: XOHCL instance ...
* @param arrow: Integer ...
*
* @return ( bool )
*/
bool CreateBySwing(
long chart_id,
const string name,
const int window,
XOHCL &swing,
int arrow //
)
{
//
bool result = false;
//
result = Create(
chart_id,
name,
window,
swing,
X_PRICE_HIGH,
(char)arrow //
);
//
return result;
}
//
// Virtual Actions ...
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_SWING_HIGH_OBJ;
}
};
//
// Swing Low Object ...
class XCSwingLowObject : public XCBarArrow
{
//
public:
//
//
// Constructor ...
void XCSwingLowObject()
{
}
//
// Deconstructor ...
void ~XCSwingLowObject()
{
}
//
// Actions ...
/**
* Create XCSwingHighObject ...
*
* @param chart_id: Long ...
* @param name: String ...
* @param window: Integer ...
* @param bar: XOHCL instance ...
* @param arrow: Integer ...
*
* @return ( bool )
*/
bool CreateBySwing(
long chart_id,
const string name,
const int window,
XOHCL &swing,
int arrow //
)
{
//
bool result = false;
//
result = Create(
chart_id,
name,
window,
swing,
X_PRICE_LOW,
(char)arrow //
);
//
return result;
}
//
// Virtual Actions ...
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_SWING_LOW_OBJ;
}
};
//
// Bullish Momentum Bar Object ...
class XCBullishMomentumBarObject : public XCBarArrow
{
//
public:
//
//
// Constructor ...
void XCBullishMomentumBarObject()
{
}
//
// Deconstructor ...
void ~XCBullishMomentumBarObject()
{
}
//
// Actions ...
/**
* Create XCBullishMomentumBarObject ...
*
* @param chart_id: Long ...
* @param name: String ...
* @param window: Integer ...
* @param bar: XOHCL instance ...
* @param arrow: Integer ...
*
* @return ( bool )
*/
bool CreateByBar(
long chart_id,
const string name,
const int window,
XOHCL &bar,
int arrow //
)
{
//
bool result = false;
//
result = Create(
chart_id,
name,
window,
bar,
X_PRICE_LOW,
(char)arrow //
);
//
return result;
}
//
// Virtual Actions ...
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_BULLISH_MOMENTUM_BAR_OBJ;
}
};
//
// Bearish Momentum Bar Object ...
class XCBearishMomentumBarObject : public XCBarArrow
{
//
public:
//
//
// Constructor ...
void XCBearishMomentumBarObject()
{
}
//
// Deconstructor ...
void ~XCBearishMomentumBarObject()
{
}
//
// Actions ...
/**
* Create XCBearishMomentumBarObject ...
*
* @param chart_id: Long ...
* @param name: String ...
* @param window: Integer ...
* @param bar: XOHCL instance ...
* @param arrow: Integer ...
*
* @return ( bool )
*/
bool CreateByBar(
long chart_id,
const string name,
const int window,
XOHCL &bar,
int arrow //
)
{
//
bool result = false;
//
result = Create(
chart_id,
name,
window,
bar,
X_PRICE_HIGH,
(char)arrow //
);
//
return result;
}
//
// Virtual Actions ...
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_BEARISH_MOMENTUM_BAR_OBJ;
}
};
//
// Bullish Rejection Bar Object ...
class XCBullishRejectionBarObject : public XCBarArrow
{
//
public:
//
//
// Constructor ...
void XCBullishRejectionBarObject()
{
}
//
// Deconstructor ...
void ~XCBullishRejectionBarObject()
{
}
//
// Actions ...
/**
* Create XCBullishRejectionBarObject ...
*
* @param chart_id: Long ...
* @param name: String ...
* @param window: Integer ...
* @param bar: XOHCL instance ...
* @param arrow: Integer ...
*
* @return ( bool )
*/
bool CreateByBar(
long chart_id,
const string name,
const int window,
XOHCL &bar,
int arrow //
)
{
//
bool result = false;
//
result = Create(
chart_id,
name,
window,
bar,
X_PRICE_LOW,
(char)arrow //
);
//
return result;
}
//
// Virtual Actions ...
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_BULLISH_REJECTION_BAR_OBJ;
}
};
//
// Bearish Rejection Bar Object ...
class XCBearishRejectionBarObject : public XCBarArrow
{
//
public:
//
//
// Constructor ...
void XCBearishRejectionBarObject()
{
}
//
// Deconstructor ...
void ~XCBearishRejectionBarObject()
{
}
//
// Actions ...
/**
* Create XCBearishRejectionBarObject ...
*
* @param chart_id: Long ...
* @param name: String ...
* @param window: Integer ...
* @param bar: XOHCL instance ...
* @param arrow: Integer ...
*
* @return ( bool )
*/
bool CreateByBar(
long chart_id,
const string name,
const int window,
XOHCL &bar,
int arrow //
)
{
//
bool result = false;
//
result = Create(
chart_id,
name,
window,
bar,
X_PRICE_HIGH,
(char)arrow //
);
//
return result;
}
//
// Virtual Actions ...
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_BEARISH_REJECTION_BAR_OBJ;
}
};
// //
// Support Zone ... // Support Zone ...
@@ -1200,10 +1658,8 @@ class XCSwingHighObject : public
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_SUPPORT_ZONE; return X_SUPPORT_ZONE_OBJ;
} }
//
}; };
// //
@@ -1287,10 +1743,8 @@ class XCResistanceZoneObject : public XCZoneObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_RESISTANCE_ZONE; return X_RESISTANCE_ZONE_OBJ;
} }
//
}; };
// //
@@ -1320,10 +1774,8 @@ class XCSupplyZoneObject : public XCZoneObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_SUPPLY_ZONE; return X_SUPPLY_ZONE_OBJ;
} }
//
}; };
// //
@@ -1353,10 +1805,8 @@ class XCDemandZoneObject : public XCZoneObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_DEMAND_ZONE; return X_DEMAND_ZONE_OBJ;
} }
//
}; };
// //
@@ -1387,10 +1837,8 @@ class XCBullishOrderBlockObject : public XCZoneObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_BULLISH_ORDERBLOCK; return X_BULLISH_ORDERBLOCK_OBJ;
} }
//
}; };
// //
@@ -1421,10 +1869,8 @@ class XCBearishOrderBlockObject : public XCZoneObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_BEARISH_ORDERBLOCK; return X_BEARISH_ORDERBLOCK_OBJ;
} }
//
}; };
// //
@@ -1455,10 +1901,8 @@ class XCBullishFVGObject : public XCZoneObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_BULLISH_FVG; return X_BULLISH_FVG_OBJ;
} }
//
}; };
// //
@@ -1489,10 +1933,8 @@ class XCBearishFVGObject : public XCZoneObject
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual ENUM_XCHARTOBJECTS Type()
{ {
return X_BEARISH_FVG; return X_BEARISH_FVG_OBJ;
} }
//
}; };
// //
File diff suppressed because it is too large Load Diff
+962 -3
View File
@@ -26,7 +26,7 @@
// //
// Definitions ... // Definitions ...
class XPOIDrawer : public XSCBase class XCPOIDrawer : public XSCBase
{ {
// //
public: public:
@@ -34,7 +34,7 @@ class XPOIDrawer : public XSCBase
// //
// Constructor ... // Constructor ...
void XPOIDrawer() void XCPOIDrawer()
{ {
// //
Default(); Default();
@@ -42,7 +42,7 @@ class XPOIDrawer : public XSCBase
// //
// Deconstructor ... // Deconstructor ...
void ~XPOIDrawer() void ~XCPOIDrawer()
{ {
} }
@@ -1273,11 +1273,970 @@ class XPOIDrawer : public XSCBase
// Object Creators ... // Object Creators ...
// //
// Swings ...
/**
* Create Swing High Object ...
*
* @param swing: XOHCL instance ...
*
* @return ( bool )
*/
bool CreateSwingHigh( bool CreateSwingHigh(
XOHCL &swing, XOHCL &swing,
XCSwingHighObject *&object // XCSwingHighObject *&object //
) )
{ {
//
bool result = false;
//
object = NULL;
//
result = swing.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = swing.GetTag(ToString(X_POI_SWING_HIGH));
//
int arrow = SwingHighArrow();
int width = SwingHighWidth();
color crl = SwingHighColor();
//
object = new XCSwingHighObject();
result = object.CreateBySwing(
chartID,
name,
window,
swing,
(char)arrow //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_BOTTOM);
//
return result;
}
/**
* Create Swing Low Object ...
*
* @param swing: XOHCL instance ...
*
* @return ( bool )
*/
bool CreateSwingLow(
XOHCL &swing,
XCSwingLowObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = swing.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = swing.GetTag(ToString(X_POI_SWING_LOW));
//
int arrow = SwingLowArrow();
int width = SwingLowWidth();
color crl = SwingLowColor();
//
object = new XCSwingLowObject();
result = object.CreateBySwing(
chartID,
name,
window,
swing,
(char)arrow //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_TOP);
//
return result;
}
//
// Momentum Bars ...
/**
* Create Bullish Momentum Bar Object ...
*
* @param bar: XOHCL instance ...
*
* @return ( bool )
*/
bool CreateBullishMomentumBar(
XOHCL &bar,
XCBullishMomentumBarObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = bar.GetTag(ToString(X_POI_MOMENTUM_BAR));
//
int arrow = BullishMomentumBarArrow();
int width = BullishMomentumBarWidth();
color crl = BullishMomentumBarColor();
//
object = new XCBullishMomentumBarObject();
result = object.CreateByBar(
chartID,
name,
window,
bar,
(char)arrow //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_TOP);
//
return result;
}
/**
* Create Bearish Momentum Bar Object ...
*
* @param bar: XOHCL instance ...
*
* @return ( bool )
*/
bool CreateBearishMomentumBar(
XOHCL &bar,
XCBearishMomentumBarObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = bar.GetTag(ToString(X_POI_MOMENTUM_BAR));
//
int arrow = BearishMomentumBarArrow();
int width = BearishMomentumBarWidth();
color crl = BearishMomentumBarColor();
//
object = new XCBearishMomentumBarObject();
result = object.CreateByBar(
chartID,
name,
window,
bar,
(char)arrow //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_TOP);
//
return result;
}
//
// Rejection Bars ...
/**
* Create Bullish Rejection Bar Object ...
*
* @param bar: XOHCL instance ...
*
* @return ( bool )
*/
bool CreateBullishRejectionBar(
XOHCL &bar,
XCBullishRejectionBarObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = bar.GetTag(ToString(X_POI_REJECTION_BAR));
//
int arrow = BullishRejectionBarArrow();
int width = BullishRejectionBarWidth();
color crl = BullishRejectionBarColor();
//
object = new XCBullishRejectionBarObject();
result = object.CreateByBar(
chartID,
name,
window,
bar,
(char)arrow //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_TOP);
//
return result;
}
/**
* Create Bearish Rejection Bar Object ...
*
* @param bar: XOHCL instance ...
*
* @return ( bool )
*/
bool CreateBearishRejectionBar(
XOHCL &bar,
XCBearishRejectionBarObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = bar.GetTag(ToString(X_POI_REJECTION_BAR));
//
int arrow = BearishRejectionBarArrow();
int width = BearishRejectionBarWidth();
color crl = BearishRejectionBarColor();
//
object = new XCBearishRejectionBarObject();
result = object.CreateByBar(
chartID,
name,
window,
bar,
(char)arrow //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_TOP);
//
return result;
}
//
// Support and Resistance Zones ...
/**
* Create Support Zone Object ...
*
* @param bar: XOHCL instance ...
*
* @return ( bool )
*/
bool CreateSupportZone(
XOHCL &bar,
XCSupportZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = bar.GetTag(ToString(X_POI_SUPPORT_ZONE));
//
datetime time2 = (datetime)((int)bar.time + (PeriodSeconds(bar.period) * 5));
//
bool fill = SupportZoneFill();
int width = SupportZoneWidth();
color crl = SupportZoneColor();
ENUM_LINE_STYLE style = SupportZoneStyle();
//
object = new XCSupportZoneObject();
result = object.CreateBySupport(
chartID,
name,
window,
bar,
time2,
true //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
/**
* Create Resistance Zone Object ...
*
* @param bar: XOHCL instance ...
*
* @return ( bool )
*/
bool CreateResistanceZone(
XOHCL &bar,
XCResistanceZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = bar.GetTag(ToString(X_POI_RESISTANCE_ZONE));
//
datetime time2 = (datetime)((int)bar.time + (PeriodSeconds(bar.period) * 5));
//
bool fill = ResistanceZoneFill();
int width = ResistanceZoneWidth();
color crl = ResistanceZoneColor();
ENUM_LINE_STYLE style = ResistanceZoneStyle();
//
object = new XCResistanceZoneObject();
result = object.CreateByResistance(
chartID,
name,
window,
bar,
time2,
true //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
//
// Supply and Demand Zones ...
/**
* Create Supply Zone Object ...
*
* @param zone: XZone instance ...
*
* @return ( bool )
*/
bool CreateSupplyZone(
XZone &zone,
XCSupplyZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = zone.GetTag();
result = Contains(
ToString(X_POI_SUPPLY_ZONE),
name //
);
if (!result)
{
return result;
}
//
bool fill = SupplyZoneFill();
int width = SupplyZoneWidth();
color crl = SupplyZoneColor();
ENUM_LINE_STYLE style = SupplyZoneStyle();
//
object = new XCSupplyZoneObject();
result = object.CreateByZone(
chartID,
name,
window,
zone,
NULL,
true //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
/**
* Create Demand Zone Object ...
*
* @param zone: XZone instance ...
*
* @return ( bool )
*/
bool CreateDemandZone(
XZone &zone,
XCDemandZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = zone.GetTag();
result = Contains(
ToString(X_POI_DEMAND_ZONE),
name //
);
if (!result)
{
return result;
}
//
bool fill = DemandZoneFill();
int width = DemandZoneWidth();
color crl = DemandZoneColor();
ENUM_LINE_STYLE style = DemandZoneStyle();
//
object = new XCDemandZoneObject();
result = object.CreateByZone(
chartID,
name,
window,
zone,
NULL,
true //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
//
// Order Blocks ...
/**
* Create Bullish Order Block Object ...
*
* @param zone: XZone instance ...
*
* @return ( bool )
*/
bool CreateBullishOrderBlock(
XZone &zone,
XCBullishOrderBlockObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = zone.GetTag();
result = Contains(
ToString(X_POI_BULLISH_ORDERBLOCK),
name //
);
if (!result)
{
return result;
}
//
bool fill = BullishOrderBlockFill();
int width = BullishOrderBlockWidth();
color crl = BullishOrderBlockColor();
ENUM_LINE_STYLE style = BullishOrderBlockStyle();
//
object = new XCBullishOrderBlockObject();
result = object.CreateByZone(
chartID,
name,
window,
zone,
NULL,
true //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
/**
* Create Bearish Order Block Object ...
*
* @param zone: XZone instance ...
*
* @return ( bool )
*/
bool CreateBearishOrderBlock(
XZone &zone,
XCBearishOrderBlockObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = zone.GetTag();
result = Contains(
ToString(X_POI_BEARISH_ORDERBLOCK),
name //
);
if (!result)
{
return result;
}
//
bool fill = BearishOrderBlockFill();
int width = BearishOrderBlockWidth();
color crl = BearishOrderBlockColor();
ENUM_LINE_STYLE style = BearishOrderBlockStyle();
//
object = new XCBearishOrderBlockObject();
result = object.CreateByZone(
chartID,
name,
window,
zone,
NULL,
true //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
//
// Order Blocks ...
/**
* Create Bullish FVG Object ...
*
* @param zone: XZone instance ...
*
* @return ( bool )
*/
bool CreateBullishFVG(
XZone &zone,
XCBullishFVGObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = zone.GetTag();
result = Contains(
ToString(X_POI_BULLISH_FVG),
name //
);
if (!result)
{
return result;
}
//
bool fill = BullishFVGFill();
int width = BullishFVGWidth();
color crl = BullishFVGColor();
ENUM_LINE_STYLE style = BullishFVGStyle();
//
object = new XCBullishFVGObject();
result = object.CreateByZone(
chartID,
name,
window,
zone,
NULL,
true //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
/**
* Create Bearish FVG Object ...
*
* @param zone: XZone instance ...
*
* @return ( bool )
*/
bool CreateBearishFVG(
XZone &zone,
XCBearishFVGObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
string name = zone.GetTag();
result = Contains(
ToString(X_POI_BEARISH_ORDERBLOCK),
name //
);
if (!result)
{
return result;
}
//
bool fill = BearishFVGFill();
int width = BearishFVGWidth();
color crl = BearishFVGColor();
ENUM_LINE_STYLE style = BearishFVGStyle();
//
object = new XCBearishFVGObject();
result = object.CreateByZone(
chartID,
name,
window,
zone,
NULL,
true //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
} }
// //
+321
View File
@@ -226,3 +226,324 @@
// Print("hasShortConditions"); // Print("hasShortConditions");
break; break;
} }
//////////////////////////////////////////////////////////////////////////////
//
XZone iBearishOrderBlock;
XZone iBearishFVG;
//
bool isPassed = false;
int orderBlocksCount = ArraySize(orderBlocksState.bearishOrderBlocks);
isPassed = IsValidSize(orderBlocksCount);
if (!isPassed)
{
continue;
}
//
// Find Related Order Block ...
isPassed = false;
for (int j = 0; j < orderBlocksCount; j++)
{
//
XZone jOrderBlock = orderBlocksState.bearishOrderBlocks[j];
//
bool isOrderBlockInsideZone = IsSupplyZoneOrderBlock(
iSupplyZone,
jOrderBlock //
);
if (isOrderBlockInsideZone)
{
//
isPassed = true;
iBearishOrderBlock = jOrderBlock;
conditions.bearishOrderBlock = jOrderBlock;
break;
}
}
if (!isPassed)
{
continue;
}
//
isPassed = false;
int fairValueGapsCount = ArraySize(fvgsState.bearishFVGs);
isPassed = IsValidSize(fairValueGapsCount);
if (!isPassed)
{
continue;
}
//
// Find Related Fair Value Gaps ...
isPassed = false;
for (int j = 0; j < fairValueGapsCount; j++)
{
//
XZone jFVG = fvgsState.bearishFVGs[j];
//
bool isBelongs = IsBearishOrderBlockFVG(
iBearishOrderBlock,
jFVG //
);
if (isBelongs)
{
//
iBearishFVG = jFVG;
conditions.bearishFVG = jFVG;
//
isPassed = true;
break;
}
}
// if (!isPassed)
// {
// continue;
// }
// //
// if (isPassed)
// {
// //
// DrawSupplyZone(iSupplyZone);
// DrawBearishOrderBlock(iBearishOrderBlock);
// DrawBearishFVG(iBearishFVG);
// }
//////////////////////////////////////////////
//
XZone iBullishOrderBlock;
XZone iBullishFVG;
//
bool isPassed = false;
int orderBlocksCount = ArraySize(orderBlocksState.bullishOrderBlocks);
isPassed = IsValidSize(orderBlocksCount);
if (!isPassed)
{
continue;
}
//
// Find Related Order Block ...
isPassed = false;
for (int j = 0; j < orderBlocksCount; j++)
{
//
XZone jOrderBlock = orderBlocksState.bullishOrderBlocks[j];
//
bool isOrderBlockInsideZone = IsDemandZoneOrderBlock(
iDemandZone,
jOrderBlock //
);
if (isOrderBlockInsideZone)
{
//
isPassed = true;
iBullishOrderBlock = jOrderBlock;
conditions.bullishOrderBlock = jOrderBlock;
break;
}
}
if (!isPassed)
{
continue;
}
//
isPassed = false;
int fairValueGapsCount = ArraySize(fvgsState.bullishFVGs);
isPassed = IsValidSize(fairValueGapsCount);
if (!isPassed)
{
continue;
}
//
// Find Related Fair Value Gaps ...
isPassed = false;
for (int j = 0; j < fairValueGapsCount; j++)
{
//
XZone jFVG = fvgsState.bullishFVGs[j];
//
bool isBelongs = IsBullishOrderBlockFVG(
iBullishOrderBlock,
jFVG //
);
if (isBelongs)
{
//
iBullishFVG = jFVG;
conditions.bullishFVG = jFVG;
//
isPassed = true;
break;
}
}
// if (!isPassed)
// {
// continue;
// }
// //
// if (isPassed)
// {
// //
// DrawDemandZone(iDemandZone);
// DrawBullishOrderBlock(iBullishOrderBlock);
// DrawBullishFVG(iBullishFVG);
// }
//////////////////////////////////////////////
//
// Tools Functions ...
/**
* Check an Order Block belongs to a Supply Zone ...
*
* @param supply: XZone instance ...
* @param orderBlock: XZone instance ...
*
* @return ( bool )
*/
bool IsSupplyZoneOrderBlock(
XZone &supply,
XZone &orderBlock //
)
{
//
bool result = false;
//
result = supply.IsValid() &&
orderBlock.IsValid();
if (!result)
{
return result;
}
//
result =
orderBlock.upper <= supply.upper;
//
return result;
}
/**
* Check an Order Block belongs to a Demand Zone ...
*
* @param demand: XZone instance ...
* @param orderBlock: XZone instance ...
*
* @return ( bool )
*/
bool IsDemandZoneOrderBlock(
XZone &demand,
XZone &orderBlock //
)
{
//
bool result = false;
//
result = demand.IsValid() &&
orderBlock.IsValid();
if (!result)
{
return result;
}
//
result =
orderBlock.lower >= demand.lower;
//
return result;
}
/**
* Check a Bearish FVG belongs to a Bearish Order Block ...
*
* @param orderBlock: XZone instance ...
* @param fvg: XZone instance ...
*
* @return ( bool )
*/
bool IsBearishOrderBlockFVG(
XZone &orderBlock,
XZone &fvg //
)
{
//
bool result = false;
//
result = fvg.IsValid() &&
orderBlock.IsValid();
if (!result)
{
return result;
}
//
result =
fvg.upper <= orderBlock.upper &&
fvg.upper > orderBlock.lower;
//
return result;
}
/**
* Check a Bullish FVG belongs to a Bullish Order Block ...
*
* @param orderBlock: XZone instance ...
* @param fvg: XZone instance ...
*
* @return ( bool )
*/
bool IsBullishOrderBlockFVG(
XZone &orderBlock,
XZone &fvg //
)
{
//
bool result = false;
//
result = fvg.IsValid() &&
orderBlock.IsValid();
if (!result)
{
return result;
}
//
result =
fvg.lower >= orderBlock.lower &&
fvg.lower < orderBlock.upper;
//
return result;
}
File diff suppressed because it is too large Load Diff
+16 -8
View File
@@ -51,8 +51,10 @@ struct X121SMCStrategyConditions
// //
XZone supplyZone; XZone supplyZone;
XZone bearishOrderBlock;
XZone bearishFVG; //
XZone bearishOrderBlocks[];
XZone bearishFVGs[];
// //
XOHCL swingHighs[]; XOHCL swingHighs[];
@@ -62,8 +64,10 @@ struct X121SMCStrategyConditions
// //
XZone demandZone; XZone demandZone;
XZone bullishOrderBlock;
XZone bullishFVG; //
XZone bullishOrderBlocks[];
XZone bullishFVGs[];
// //
XOHCL supports[]; XOHCL supports[];
@@ -92,13 +96,17 @@ struct X121SMCStrategyConditions
// //
supplyZone.Clean(); supplyZone.Clean();
bearishOrderBlock.Clean();
bearishFVG.Clean(); //
Clean(bearishFVGs);
Clean(bearishOrderBlocks);
// //
demandZone.Clean(); demandZone.Clean();
bullishOrderBlock.Clean();
bullishFVG.Clean(); //
Clean(bullishFVGs);
Clean(bullishOrderBlocks);
// //
Clean(swingHighs); Clean(swingHighs);
File diff suppressed because it is too large Load Diff