Files
MQL5Data/Classes/x-saherelm.x-poi.drawer.class.mq5
T
2025-05-20 21:48:12 +03:30

4385 lines
91 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class Library
// --------------------------------------
// Name: XPOIDrawer
// Description: Provides Point of Interests
// Drawing Tools ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// Imports ...
#include "../Classes/x-saherelm.base.class.mq5"
#include "../Classes/x-saherelm.x-cobject.class.mq5"
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
#include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
//
// Definitions ...
//
// Extensions ...
void AddObjects(
CArrayObj *&source,
CArrayObj &dest //
)
{
//
bool has = source != NULL &&
source.Total() > 0;
if (!has)
{
return;
}
//
for (int i = 0; i < source.Total(); i++)
{
dest.Add(source.At(i));
}
}
//
// Implementations ...
class XCPOIDrawer : public XCBase
{
//
public:
//
//
// Constructor ...
void XCPOIDrawer()
{
//
Default();
}
//
// Deconstructor ...
void ~XCPOIDrawer()
{
//
Clean(mTicksZoneSpecs);
}
//
// Setter Getter (s) ...
/**
* Get Prefix ...
*
* @return ( string )
*/
string Prefix()
{
return mPrefix;
}
/**
* Set Prifx ...
*
* @param value: String ...
*/
void Prefix(string value)
{
mPrefix = value;
}
/**
* Get Chart ID ...
*
* @return ( long )
*/
long ChartIdentification()
{
return mChartIdentification;
}
/**
* Set Chart ID ...
*
* @param value: Long ...
*/
void ChartIdentification(long value)
{
//
if (value < 0)
{
value = 0;
}
//
mChartIdentification = value;
}
/**
* Get SubWindow Id ...
*
* @return ( int )
*/
int SubWindowIdentification()
{
return mSubWindowIdentification;
}
/**
* Set SubWindow Id ...
*
* @param value: Integer ...
*/
void SubWindowIdentification(int value)
{
//
if (value < 0)
{
value = 0;
}
//
mSubWindowIdentification = value;
}
//
// XOHCL ...
/**
* Get Bar Width ...
*
* @return ( int )
*/
int BarWidth()
{
return mBarWidth;
}
/**
* Set Bar Width ...
*
* @param value: Integer ...
*/
void BarWidth(int value)
{
//
if (value < 0)
{
value = 0;
}
//
mBarWidth = value;
}
/**
* Get Bar Bullish Color ...
*
* @return ( color )
*/
color BarBullishColor()
{
return mBarBullishColor;
}
/**
* Set Bar Bullish Color ...
*
* @param value: Color ...
*/
void BarBullishColor(color value)
{
mBarBullishColor = value;
}
/**
* Get Bar Bearish Color ...
*
* @return ( color )
*/
color BarBearishColor()
{
return mBarBearishColor;
}
/**
* Set Bar Bearish Color ...
*
* @param value: Color ...
*/
void BarBearishColor(color value)
{
mBarBearishColor = value;
}
/**
* Get Fill Bar High Shadow State ...
*
* @return ( bool )
*/
bool BarFillHighShadow()
{
return mBarFillHighShadow;
}
/**
* Set Fill Bar High Shadow State ...
*
* @param value: Boolean ...
*/
void BarFillHighShadow(bool value)
{
mBarFillHighShadow = value;
}
/**
* Get Bar High Shadow Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE BarHighShadowStyle()
{
return mBarHighShadowStyle;
}
/**
* Set Bar High Shadow Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void BarHighShadowStyle(ENUM_LINE_STYLE value)
{
mBarHighShadowStyle = value;
}
/**
* Get Fill Bar Body State ...
*
* @return ( bool )
*/
bool BarFillBody()
{
return mBarFillBody;
}
/**
* Set Fill Bar Body State ...
*
* @param value: Boolean ...
*/
void BarFillBody(bool value)
{
mBarFillBody = value;
}
/**
* Get Bar Body Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE BarBodyStyle()
{
return mBarBodyStyle;
}
/**
* Set Bar Body Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void BarBodyStyle(ENUM_LINE_STYLE value)
{
mBarBodyStyle = value;
}
/**
* Get Fill Bar Low Show State ...
*
* @return ( bool )
*/
bool BarFillLowShadow()
{
return mBarFillLowShadow;
}
/**
* Set Fill Bar Low Show State ...
*
* @param value: Boolean ...
*/
void BarFillLowShadow(bool value)
{
mBarFillLowShadow = value;
}
/**
* Get Bar Low Shadow Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE BarLowShadowStyle()
{
return mBarLowShadowStyle;
}
/**
* Set Bar Low Shadow Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void BarLowShadowStyle(ENUM_LINE_STYLE value)
{
mBarLowShadowStyle = value;
}
//
// Swing Low ...
/**
* Get Swing Low Width ...
*
* @return ( int )
*/
int SwingLowWidth()
{
return mSwingLowWidth;
}
/**
* Set Swing Low Width ...
*
* @param value: Integer ...
*/
void SwingLowWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mSwingLowWidth = value;
}
/**
* Get Swing Low Arrow Code ...
*
* @return ( int )
*/
int SwingLowArrow()
{
return mSwingLowArrow;
}
/**
* Set Swing Low Arrow Code ...
*
* @param value: Integer ...
*/
void SwingLowArrow(int value)
{
//
mSwingLowArrow = value;
}
/**
* Get Swing Low Color ...
*
* @return ( color )
*/
color SwingLowColor()
{
return mSwingLowColor;
}
/**
* Set Swing Low Color ...
*
* @param value: Color ...
*/
void SwingLowColor(color value)
{
mSwingLowColor = value;
}
//
// Swing High ...
/**
* Get Swing High Width ...
*
* @return ( int )
*/
int SwingHighWidth()
{
return mSwingHighWidth;
}
/**
* Set Swing High Width ...
*
* @param value: Integer ...
*/
void SwingHighWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mSwingHighWidth = value;
}
/**
* Get Swing High Arrow Code ...
*
* @return ( int )
*/
int SwingHighArrow()
{
return mSwingHighArrow;
}
/**
* Set Swing High Arrow Code ...
*
* @param value: Integer ...
*/
void SwingHighArrow(int value)
{
//
mSwingHighArrow = value;
}
/**
* Get Swing High Color ...
*
* @return ( color )
*/
color SwingHighColor()
{
return mSwingHighColor;
}
/**
* Set Swing High Color ...
*
* @param value: Color ...
*/
void SwingHighColor(color value)
{
mSwingHighColor = value;
}
//
// Bullish Momentum Bar ...
/**
* Get Bullish Momentum Bar Width ...
*
* @return ( int )
*/
int BullishMomentumBarWidth()
{
return mBullishMomentumBarWidth;
}
/**
* Set Bullish Momentum Bar Width ...
*
* @param value: Integer ...
*/
void BullishMomentumBarWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mBullishMomentumBarWidth = value;
}
/**
* Get Bullish Momentum Bar Arrow Code ...
*
* @return ( int )
*/
int BullishMomentumBarArrow()
{
return mBullishMomentumBarArrow;
}
/**
* Set Bullish Momentum Bar Arrow Code ...
*
* @param value: Integer ...
*/
void BullishMomentumBarArrow(int value)
{
//
mBullishMomentumBarArrow = value;
}
/**
* Get Bullish Momentum Bar Color ...
*
* @return ( color )
*/
color BullishMomentumBarColor()
{
return mBullishMomentumBarColor;
}
/**
* Set Bullish Momentum Bar Color ...
*
* @param value: Color ...
*/
void BullishMomentumBarColor(color value)
{
mBullishMomentumBarColor = value;
}
//
// Bearish Momentum Bar ...
/**
* Get Bearish Momentum Bar Width ...
*
* @return ( int )
*/
int BearishMomentumBarWidth()
{
return mBearishMomentumBarWidth;
}
/**
* Set Bearish Momentum Bar Width ...
*
* @param value: Integer ...
*/
void BearishMomentumBarWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mBearishMomentumBarWidth = value;
}
/**
* Get Bearish Momentum Bar Arrow Code ...
*
* @return ( int )
*/
int BearishMomentumBarArrow()
{
return mBearishMomentumBarArrow;
}
/**
* Set Bearish Momentum Bar Arrow Code ...
*
* @param value: Integer ...
*/
void BearishMomentumBarArrow(int value)
{
//
mBearishMomentumBarArrow = value;
}
/**
* Get Bearish Momentum Bar Color ...
*
* @return ( color )
*/
color BearishMomentumBarColor()
{
return mBearishMomentumBarColor;
}
/**
* Set Bearish Momentum Bar Color ...
*
* @param value: Color ...
*/
void BearishMomentumBarColor(color value)
{
mBearishMomentumBarColor = value;
}
//
// Bullish Rejection Bar ...
/**
* Get Bullish Rejection Bar Width ...
*
* @return ( int )
*/
int BullishRejectionBarWidth()
{
return mBullishRejectionBarWidth;
}
/**
* Set Bullish Rejection Bar Width ...
*
* @param value: Integer ...
*/
void BullishRejectionBarWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mBullishRejectionBarWidth = value;
}
/**
* Get Bullish Rejection Bar Arrow Code ...
*
* @return ( int )
*/
int BullishRejectionBarArrow()
{
return mBullishRejectionBarArrow;
}
/**
* Set Bullish Rejection Bar Arrow Code ...
*
* @param value: Integer ...
*/
void BullishRejectionBarArrow(int value)
{
//
mBullishRejectionBarArrow = value;
}
/**
* Get Bullish Rejection Bar Color ...
*
* @return ( color )
*/
color BullishRejectionBarColor()
{
return mBullishRejectionBarColor;
}
/**
* Set Bullish Rejection Bar Color ...
*
* @param value: Color ...
*/
void BullishRejectionBarColor(color value)
{
mBullishRejectionBarColor = value;
}
//
// Bearish Rejection Bar ...
/**
* Get Bearish Rejection Bar Width ...
*
* @return ( int )
*/
int BearishRejectionBarWidth()
{
return mBearishRejectionBarWidth;
}
/**
* Set Bearish Rejection Bar Width ...
*
* @param value: Integer ...
*/
void BearishRejectionBarWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mBearishRejectionBarWidth = value;
}
/**
* Get Bearish Rejection Bar Arrow Code ...
*
* @return ( int )
*/
int BearishRejectionBarArrow()
{
return mBearishRejectionBarArrow;
}
/**
* Set Bearish Rejection Bar Arrow Code ...
*
* @param value: Integer ...
*/
void BearishRejectionBarArrow(int value)
{
//
mBearishRejectionBarArrow = value;
}
/**
* Get Bearish Rejection Bar Color ...
*
* @return ( color )
*/
color BearishRejectionBarColor()
{
return mBearishRejectionBarColor;
}
/**
* Set Bearish Rejection Bar Color ...
*
* @param value: Color ...
*/
void BearishRejectionBarColor(color value)
{
mBearishRejectionBarColor = value;
}
//
// Supply Zone ...
/**
* Get Fill Supply Zone ...
*
* @return ( bool )
*/
bool SupplyZoneFill()
{
return mSupplyZoneFill;
}
/**
* Set Fill Supply Zone ...
*
* @param value: Boolean ...
*/
void SupplyZoneFill(bool value)
{
mSupplyZoneFill = value;
}
/**
* Get Supply Zone Width ...
*
* @return ( int )
*/
int SupplyZoneWidth()
{
return mSupplyZoneWidth;
}
/**
* Set Supply Zone Width ...
*
* @param value: Integer ...
*/
void SupplyZoneWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mSupplyZoneWidth = value;
}
/**
* Get Supply Zone Color ...
*
* @return ( color )
*/
color SupplyZoneColor()
{
return mSupplyZoneColor;
}
/**
* Set Supply Zone Color ...
*
* @param value: Color ...
*/
void SupplyZoneColor(color value)
{
mSupplyZoneColor = value;
}
/**
* Get Supply Zone Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE SupplyZoneStyle()
{
return mSupplyZoneStyle;
}
/**
* Set Supply Zone Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void SupplyZoneStyle(ENUM_LINE_STYLE value)
{
mSupplyZoneStyle = value;
}
//
// Demand Zone ...
/**
* Get Fill Demand Zone ...
*
* @return ( bool )
*/
bool DemandZoneFill()
{
return mDemandZoneFill;
}
/**
* Set Fill Demand Zone ...
*
* @param value: Boolean ...
*/
void DemandZoneFill(bool value)
{
mDemandZoneFill = value;
}
/**
* Get Demand Zone Width ...
*
* @return ( int )
*/
int DemandZoneWidth()
{
return mDemandZoneWidth;
}
/**
* Set Demand Zone Width ...
*
* @param value: Integer ...
*/
void DemandZoneWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mDemandZoneWidth = value;
}
/**
* Get Demand Zone Color ...
*
* @return ( color )
*/
color DemandZoneColor()
{
return mDemandZoneColor;
}
/**
* Set Demand Zone Color ...
*
* @param value: Color ...
*/
void DemandZoneColor(color value)
{
mDemandZoneColor = value;
}
/**
* Get Demand Zone Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE DemandZoneStyle()
{
return mDemandZoneStyle;
}
/**
* Set Demand Zone Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void DemandZoneStyle(ENUM_LINE_STYLE value)
{
mDemandZoneStyle = value;
}
//
// Resistance Zone ...
/**
* Get Fill Resistance Zone ...
*
* @return ( bool )
*/
bool ResistanceZoneFill()
{
return mResistanceZoneFill;
}
/**
* Set Fill Resistance Zone ...
*
* @param value: Boolean ...
*/
void ResistanceZoneFill(bool value)
{
mResistanceZoneFill = value;
}
/**
* Get Resistance Zone Width ...
*
* @return ( int )
*/
int ResistanceZoneWidth()
{
return mResistanceZoneWidth;
}
/**
* Set Resistance Zone Width ...
*
* @param value: Integer ...
*/
void ResistanceZoneWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mResistanceZoneWidth = value;
}
/**
* Get Resistance Zone Color ...
*
* @return ( color )
*/
color ResistanceZoneColor()
{
return mResistanceZoneColor;
}
/**
* Set Resistance Zone Color ...
*
* @param value: Color ...
*/
void ResistanceZoneColor(color value)
{
mResistanceZoneColor = value;
}
/**
* Get Resistance Zone Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE ResistanceZoneStyle()
{
return mResistanceZoneStyle;
}
/**
* Set Resistance Zone Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void ResistanceZoneStyle(ENUM_LINE_STYLE value)
{
mResistanceZoneStyle = value;
}
//
// Support Zone ...
/**
* Get Fill Support Zone ...
*
* @return ( bool )
*/
bool SupportZoneFill()
{
return mSupportZoneFill;
}
/**
* Set Fill Support Zone ...
*
* @param value: Boolean ...
*/
void SupportZoneFill(bool value)
{
mSupportZoneFill = value;
}
/**
* Get Support Zone Width ...
*
* @return ( int )
*/
int SupportZoneWidth()
{
return mSupportZoneWidth;
}
/**
* Set Support Zone Width ...
*
* @param value: Integer ...
*/
void SupportZoneWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mSupportZoneWidth = value;
}
/**
* Get Support Zone Color ...
*
* @return ( color )
*/
color SupportZoneColor()
{
return mSupportZoneColor;
}
/**
* Set Support Zone Color ...
*
* @param value: Color ...
*/
void SupportZoneColor(color value)
{
mSupportZoneColor = value;
}
/**
* Get Support Zone Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE SupportZoneStyle()
{
return mSupportZoneStyle;
}
/**
* Set Support Zone Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void SupportZoneStyle(ENUM_LINE_STYLE value)
{
mSupportZoneStyle = value;
}
//
// Bullish Order Block ...
/**
* Get Fill Bullish Order Block ...
*
* @return ( bool )
*/
bool BullishOrderBlockFill()
{
return mBullishOrderBlockFill;
}
/**
* Set Fill Bullish Order Block ...
*
* @param value: Boolean ...
*/
void BullishOrderBlockFill(bool value)
{
mBullishOrderBlockFill = value;
}
/**
* Get Bullish Order Block Width ...
*
* @return ( int )
*/
int BullishOrderBlockWidth()
{
return mBullishOrderBlockWidth;
}
/**
* Set Bullish Order Block Width ...
*
* @param value: Integer ...
*/
void BullishOrderBlockWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mBullishOrderBlockWidth = value;
}
/**
* Get Bullish Order Block Color ...
*
* @return ( color )
*/
color BullishOrderBlockColor()
{
return mBullishOrderBlockColor;
}
/**
* Set Bullish Order Block Color ...
*
* @param value: Color ...
*/
void BullishOrderBlockColor(color value)
{
mBullishOrderBlockColor = value;
}
/**
* Get Bullish Order Block Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE BullishOrderBlockStyle()
{
return mBullishOrderBlockStyle;
}
/**
* Set Bullish Order Block Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void BullishOrderBlockStyle(ENUM_LINE_STYLE value)
{
mBullishOrderBlockStyle = value;
}
//
// Bearish Order Block ...
/**
* Get Fill Bearish Order Block ...
*
* @return ( bool )
*/
bool BearishOrderBlockFill()
{
return mBearishOrderBlockFill;
}
/**
* Set Fill Bearish Order Block ...
*
* @param value: Boolean ...
*/
void BearishOrderBlockFill(bool value)
{
mBearishOrderBlockFill = value;
}
/**
* Get Bearish Order Block Width ...
*
* @return ( int )
*/
int BearishOrderBlockWidth()
{
return mBearishOrderBlockWidth;
}
/**
* Set Bearish Order Block Width ...
*
* @param value: Integer ...
*/
void BearishOrderBlockWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mBearishOrderBlockWidth = value;
}
/**
* Get Bearish Order Block Color ...
*
* @return ( color )
*/
color BearishOrderBlockColor()
{
return mBearishOrderBlockColor;
}
/**
* Set Bearish Order Block Color ...
*
* @param value: Color ...
*/
void BearishOrderBlockColor(color value)
{
mBearishOrderBlockColor = value;
}
/**
* Get Bearish Order Block Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE BearishOrderBlockStyle()
{
return mBearishOrderBlockStyle;
}
/**
* Set Bearish Order Block Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void BearishOrderBlockStyle(ENUM_LINE_STYLE value)
{
mBearishOrderBlockStyle = value;
}
//
// Bullish FVG ...
/**
* Get Fill Bullish FVG ...
*
* @return ( bool )
*/
bool BullishFVGFill()
{
return mBullishFVGFill;
}
/**
* Set Fill Bullish FVG ...
*
* @param value: Boolean ...
*/
void BullishFVGFill(bool value)
{
mBullishFVGFill = value;
}
/**
* Get Bullish FVG Width ...
*
* @return ( int )
*/
int BullishFVGWidth()
{
return mBullishFVGWidth;
}
/**
* Set Bullish FVG Width ...
*
* @param value: Integer ...
*/
void BullishFVGWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mBullishFVGWidth = value;
}
/**
* Get Bullish FVG Color ...
*
* @return ( color )
*/
color BullishFVGColor()
{
return mBullishFVGColor;
}
/**
* Set Bullish FVG Color ...
*
* @param value: Color ...
*/
void BullishFVGColor(color value)
{
mBullishFVGColor = value;
}
/**
* Get Bullish FVG Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE BullishFVGStyle()
{
return mBullishFVGStyle;
}
/**
* Set Bullish FVG Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void BullishFVGStyle(ENUM_LINE_STYLE value)
{
mBullishFVGStyle = value;
}
//
// Bearish FVG ...
/**
* Get Fill Bearish FVG ...
*
* @return ( bool )
*/
bool BearishFVGFill()
{
return mBearishFVGFill;
}
/**
* Set Fill Bearish FVG ...
*
* @param value: Boolean ...
*/
void BearishFVGFill(bool value)
{
mBearishFVGFill = value;
}
/**
* Get Bearish FVG Width ...
*
* @return ( int )
*/
int BearishFVGWidth()
{
return mBearishFVGWidth;
}
/**
* Set Bearish FVG Width ...
*
* @param value: Integer ...
*/
void BearishFVGWidth(int value)
{
//
if (value < 1)
{
value = 1;
}
//
mBearishFVGWidth = value;
}
/**
* Get Bearish FVG Color ...
*
* @return ( color )
*/
color BearishFVGColor()
{
return mBearishFVGColor;
}
/**
* Set Bearish FVG Color ...
*
* @param value: Color ...
*/
void BearishFVGColor(color value)
{
mBearishFVGColor = value;
}
/**
* Get Bearish FVG Style ...
*
* @return ( ENUM_LINE_STYLE )
*/
ENUM_LINE_STYLE BearishFVGStyle()
{
return mBearishFVGStyle;
}
/**
* Set Bearish FVG Style ...
*
* @param value: ENUM_LINE_STYLE member ...
*/
void BearishFVGStyle(ENUM_LINE_STYLE value)
{
mBearishFVGStyle = value;
}
//
// Virtuals ...
/**
* Apply Default Configurations ...
*/
virtual void Default()
{
//
// Apply Default Props ...
//
Prefix(NULL);
ChartIdentification(0);
SubWindowIdentification(0);
//
BarWidth(1);
BarBearishColor(clrRed);
BarBullishColor(clrLime);
BarFillBody(false);
BarFillHighShadow(false);
BarFillLowShadow(false);
BarBodyStyle(STYLE_DOT);
BarLowShadowStyle(STYLE_DOT);
BarHighShadowStyle(STYLE_DOT);
//
int arrowWidth = 1;
//
SwingLowArrow(108);
SwingLowColor(clrAqua);
SwingLowWidth(arrowWidth);
//
SwingHighArrow(108);
SwingHighWidth(arrowWidth);
SwingHighColor(clrMagenta);
//
arrowWidth++;
//
BullishMomentumBarArrow(225);
BullishMomentumBarWidth(arrowWidth);
BullishMomentumBarColor(clrAqua);
//
BearishMomentumBarArrow(226);
BearishMomentumBarWidth(arrowWidth);
BearishMomentumBarColor(clrMagenta);
//
arrowWidth++;
//
BullishRejectionBarArrow(217);
BullishRejectionBarWidth(arrowWidth);
BullishRejectionBarColor(clrAqua);
//
BearishRejectionBarArrow(218);
BearishRejectionBarWidth(arrowWidth);
BearishRejectionBarColor(clrMagenta);
//
SupportZoneFill(false);
SupportZoneWidth(1);
SupportZoneStyle(STYLE_DOT);
SupportZoneColor(clrLime);
//
ResistanceZoneFill(false);
ResistanceZoneWidth(1);
ResistanceZoneStyle(STYLE_DOT);
ResistanceZoneColor(clrRed);
//
SupplyZoneFill(false);
SupplyZoneWidth(1);
SupplyZoneStyle(STYLE_DOT);
SupplyZoneColor(clrRed);
//
DemandZoneFill(false);
DemandZoneWidth(1);
DemandZoneStyle(STYLE_DOT);
DemandZoneColor(clrGreen);
//
BullishOrderBlockFill(false);
BullishOrderBlockWidth(1);
BullishOrderBlockStyle(STYLE_DASHDOT);
BullishOrderBlockColor(clrLime);
//
BearishOrderBlockFill(false);
BearishOrderBlockWidth(1);
BearishOrderBlockStyle(STYLE_DASHDOT);
BearishOrderBlockColor(clrRed);
//
BullishFVGFill(false);
BullishFVGWidth(1);
BullishFVGStyle(STYLE_DOT);
BullishFVGColor(clrLime);
//
BearishFVGFill(false);
BearishFVGWidth(1);
BearishFVGStyle(STYLE_DOT);
BearishFVGColor(clrRed);
//
// Add Default TickZone Specs ...
bool isSpecsInited = false;
bool fillTickZone = false;
XTickZoneLevelSpecs specs10;
isSpecsInited = specs10.Init(
10,
clrWhite,
clrWhite,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs10);
}
//
XTickZoneLevelSpecs specs20;
isSpecsInited = specs20.Init(
20,
clrOrange,
clrOrange,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs20);
}
//
XTickZoneLevelSpecs specs30;
isSpecsInited = specs30.Init(
30,
clrOrange,
clrOrange,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs30);
}
//
XTickZoneLevelSpecs specs40;
isSpecsInited = specs40.Init(
40,
clrOrange,
clrOrange,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs40);
}
//
XTickZoneLevelSpecs specs50;
isSpecsInited = specs50.Init(
50,
clrYellow,
clrYellow,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs50);
}
//
XTickZoneLevelSpecs specs60;
isSpecsInited = specs60.Init(
60,
clrYellow,
clrYellow,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs60);
}
//
XTickZoneLevelSpecs specs70;
isSpecsInited = specs70.Init(
70,
clrYellow,
clrYellow,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs70);
}
//
XTickZoneLevelSpecs specs80;
isSpecsInited = specs80.Init(
80,
clrRed,
clrRed,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs80);
}
//
XTickZoneLevelSpecs specs90;
isSpecsInited = specs90.Init(
90,
clrRed,
clrRed,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs90);
}
//
XTickZoneLevelSpecs specs100;
isSpecsInited = specs100.Init(
100,
clrRed,
clrRed,
fillTickZone //
);
if (isSpecsInited)
{
AddTickZoneLevelSpecs(specs100);
}
//
}
//
// Object Creators ...
//
// Swings ...
/**
* Create Swing High Object ...
*
* @param swing: XCSwing instance ...
* @param object: XCSwingHighObject pointer ...
*
* @return ( bool )
*/
bool CreateSwingHigh(
XCSwing &swing,
XCSwingHighObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
swing.IsValid() &&
swing.IsSwingHigh();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
int arrow = SwingHighArrow();
int width = SwingHighWidth();
color crl = SwingHighColor();
//
object = new XCSwingHighObject();
result = object.Create(
chartID,
window,
arrow,
swing,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_BOTTOM);
//
return result;
}
/**
* Create Swing Low Object ...
*
* @param swing: XCSwing instance ...
* @param object: XCSwingLowObject pointer ...
*
* @return ( bool )
*/
bool CreateSwingLow(
XCSwing &swing,
XCSwingLowObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
swing.IsValid() &&
swing.IsSwingLow();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
int arrow = SwingLowArrow();
int width = SwingLowWidth();
color crl = SwingLowColor();
//
object = new XCSwingLowObject();
result = object.Create(
chartID,
window,
arrow,
swing,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_TOP);
//
return result;
}
//
// Momentum Bars ...
/**
* Create Bullish Momentum Bar Object ...
*
* @param momentumBar: XCMomentumBar instance ...
* @param object: XCBullishMomentumObject pointer ...
*
* @return ( bool )
*/
bool CreateBullishMomentumBar(
XCMomentumBar &momentumBar,
XCBullishMomentumBarObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
momentumBar.IsValid() &&
momentumBar.IsBullish();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
int arrow = BullishMomentumBarArrow();
int width = BullishMomentumBarWidth();
color crl = BullishMomentumBarColor();
//
object = new XCBullishMomentumBarObject();
result = object.Create(
chartID,
window,
arrow,
momentumBar,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_TOP);
//
return result;
}
/**
* Create Bearish Momentum Bar Object ...
*
* @param momentumBar: XCMomentumBar instance ...
* @param object: XCBearishMomentumObject pointer ...
*
* @return ( bool )
*/
bool CreateBearishMomentumBar(
XCMomentumBar &momentumBar,
XCBearishMomentumBarObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
momentumBar.IsValid() &&
momentumBar.IsBearish();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
int arrow = BearishMomentumBarArrow();
int width = BearishMomentumBarWidth();
color crl = BearishMomentumBarColor();
//
object = new XCBearishMomentumBarObject();
result = object.Create(
chartID,
window,
arrow,
momentumBar,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_BOTTOM);
//
return result;
}
//
// Rejection Bars ...
/**
* Create Bullish Rejection Bar Object ...
*
* @param momentumBar: XCRejectionBar instance ...
* @param object: XCBullishRejectionObject pointer ...
*
* @return ( bool )
*/
bool CreateBullishRejectionBar(
XCRejectionBar &rejectionBar,
XCBullishRejectionBarObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
rejectionBar.IsValid() &&
rejectionBar.IsBullish();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
int arrow = BullishRejectionBarArrow();
int width = BullishRejectionBarWidth();
color crl = BullishRejectionBarColor();
//
object = new XCBullishRejectionBarObject();
result = object.Create(
chartID,
window,
arrow,
rejectionBar,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_TOP);
//
return result;
}
/**
* Create Bearish Rejection Bar Object ...
*
* @param rejectionBar: XCRejectionBar instance ...
* @param object: XCBearishRejectionObject pointer ...
*
* @return ( bool )
*/
bool CreateBearishRejectionBar(
XCRejectionBar &rejectionBar,
XCBearishRejectionBarObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
rejectionBar.IsValid() &&
rejectionBar.IsBearish();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
int arrow = BearishRejectionBarArrow();
int width = BearishRejectionBarWidth();
color crl = BearishRejectionBarColor();
//
object = new XCBearishRejectionBarObject();
result = object.Create(
chartID,
window,
arrow,
rejectionBar,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ArrowColor(crl);
object.ArrowWidth(width);
object.ArrowAnchor(ANCHOR_BOTTOM);
//
return result;
}
//
// Support and Resistance ...
/**
* Create Support Object ...
*
* @param zone: XCSupportZone instance ...
* @param object: XCSupportZoneObject pointer ...
*
* @return ( bool )
*/
bool CreateSupportZone(
XCSupportZone &zone,
XCSupportZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
zone.IsValid();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
bool fill = SupportZoneFill();
int width = SupportZoneWidth();
color crl = SupportZoneColor();
ENUM_LINE_STYLE style = SupportZoneStyle();
//
object = new XCSupportZoneObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
/**
* Create Resistance Object ...
*
* @param zone: XCResistanceZone instance ...
* @param object: XCResistanceZoneObject pointer ...
*
* @return ( bool )
*/
bool CreateResistanceZone(
XCResistanceZone &zone,
XCResistanceZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
zone.IsValid();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
bool fill = ResistanceZoneFill();
int width = ResistanceZoneWidth();
color crl = ResistanceZoneColor();
ENUM_LINE_STYLE style = ResistanceZoneStyle();
//
object = new XCResistanceZoneObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
//
// Supply and Demand Zones ...
/**
* Create Supply Object ...
*
* @param zone: XCSupplyZone instance ...
* @param object: XCSupplyZoneObject pointer ...
*
* @return ( bool )
*/
bool CreateSupplyZone(
XCSupplyZone &zone,
XCSupplyZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
zone.IsValid();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
bool fill = SupplyZoneFill();
int width = SupplyZoneWidth();
color crl = SupplyZoneColor();
ENUM_LINE_STYLE style = SupplyZoneStyle();
//
object = new XCSupplyZoneObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
/**
* Create Demand Object ...
*
* @param zone: XCDemandZone instance ...
* @param object: XCDemandZoneObject pointer ...
*
* @return ( bool )
*/
bool CreateDemandZone(
XCDemandZone &zone,
XCDemandZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
zone.IsValid();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
bool fill = DemandZoneFill();
int width = DemandZoneWidth();
color crl = DemandZoneColor();
ENUM_LINE_STYLE style = DemandZoneStyle();
//
object = new XCDemandZoneObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
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: XCOrderBlock instance ...
* @param object: XCBullishOrderBlockObject pointer ...
*
* @return ( bool )
*/
bool CreateBullishOrderBlock(
XCOrderBlock &zone,
XCBullishOrderBlockObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
zone.IsValid() &&
zone.IsBullish();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
bool fill = BullishOrderBlockFill();
int width = BullishOrderBlockWidth();
color crl = BullishOrderBlockColor();
ENUM_LINE_STYLE style = BullishOrderBlockStyle();
//
object = new XCBullishOrderBlockObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
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: XCOrderBlock instance ...
* @param object: XCBearishOrderBlockObject pointer ...
*
* @return ( bool )
*/
bool CreateBearishOrderBlock(
XCOrderBlock &zone,
XCBearishOrderBlockObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result =
zone.IsValid() &&
zone.IsBearish();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
bool fill = BearishOrderBlockFill();
int width = BearishOrderBlockWidth();
color crl = BearishOrderBlockColor();
ENUM_LINE_STYLE style = BearishOrderBlockStyle();
//
object = new XCBearishOrderBlockObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
bool CreateOrderBlock(
XCOrderBlock &zone,
XCBaseObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
bool isBullish = zone.IsBullish();
if (isBullish)
{
//
XCBullishOrderBlockObject *iObj;
result = CreateBullishOrderBlock(
zone,
iObj //
);
if (result)
{
object = (XCBaseObject *)iObj;
}
}
else
{
//
XCBearishOrderBlockObject *iObj;
result = CreateBearishOrderBlock(
zone,
iObj //
);
if (result)
{
object = (XCBaseObject *)iObj;
}
}
//
return result;
}
//
// Fair Value Gaps ...
/**
* Create Bullish Fair Value Gap Object ...
*
* @param zone: XCFVG instance ...
* @param object: XCBullishOrderBlockObject pointer ...
*
* @return ( bool )
*/
bool CreateBullishFairValueGap(
XCFVG &zone,
XCBullishFairValueGapObject *&object //
)
{
//
bool result = false;
//
result = zone.IsValid() &&
zone.IsBullish();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
bool fill = BullishFVGFill();
int width = BullishFVGWidth();
color crl = BullishFVGColor();
ENUM_LINE_STYLE style = BullishFVGStyle();
//
object = new XCBullishFairValueGapObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
/**
* Create Bearish Fair Value Gap Object ...
*
* @param zone: XCFVG instance ...
* @param object: XCBearishOrderBlockObject pointer ...
*
* @return ( bool )
*/
bool CreateBearishFairValueGap(
XCFVG &zone,
XCBearishFairValueGapObject *&object //
)
{
//
bool result = false;
//
result = zone.IsValid() &&
zone.IsBearish();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
bool fill = BearishFVGFill();
int width = BearishFVGWidth();
color crl = BearishFVGColor();
ENUM_LINE_STYLE style = BearishFVGStyle();
//
object = new XCBearishFairValueGapObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
if (!result)
{
return result;
}
//
object.ZoneFill(fill);
object.ZoneColor(crl);
object.ZoneWidth(width);
object.ZoneStyle(style);
//
return result;
}
bool CreateFairValueGap(
XCFVG &zone,
XCBaseObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
bool isBullish = zone.IsBullish();
if (isBullish)
{
//
XCBullishFairValueGapObject *iObj;
result = CreateBullishFairValueGap(
zone,
iObj //
);
if (result)
{
object = (XCBaseObject *)iObj;
}
}
else
{
//
XCBearishFairValueGapObject *iObj;
result = CreateBearishFairValueGap(
zone,
iObj //
);
if (result)
{
object = (XCBaseObject *)iObj;
}
}
//
return result;
}
//
// Ticks Zone ...
/**
* Add Tick Zone Draw Specifications ...
*
* @param specs: XTickZoneLevelSpecs instance ...
*/
void AddTickZoneLevelSpecs(
XTickZoneLevelSpecs &specs //
)
{
//
if (!specs.IsValid())
{
return;
}
//
bool isExists = false;
int count = ArraySize(mTicksZoneSpecs);
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XTickZoneLevelSpecs iSpec = mTicksZoneSpecs[i];
//
isExists = specs.percent == iSpec.percent;
if (isExists)
{
break;
}
}
}
if (isExists)
{
return;
}
//
AddRef(
specs,
mTicksZoneSpecs //
);
}
/**
* Draw Specified Ticker Zone ...
*
* @param zone: XCTicksZone instance Specified Ticker Zone ...
* @param object: XCTicksZoneObject pointer ...
*
* @return ( bool )
*/
bool CreateTicksZone(
XCTicksZone &zone,
XCTicksZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
object = new XCTicksZoneObject();
result = object.Create(
chartID,
window,
zone,
mTicksZoneSpecs,
prefix //
);
//
if (!result)
{
return result;
}
//
return result;
}
/**
* Create Consolidation Zone Object ...
*
* @param zone: XConsolidationZone instance Reference ...
*
* @return ( bool )
*/
bool CreateConsolidationZone(
XConsolidationZone &zone,
XCConsolidationZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
color czColor = IsBullish(zone.dir)
? BarBullishColor()
: BarBearishColor();
//
object = new XCConsolidationZoneObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
if (result)
{
object.ZoneColor(czColor);
}
//
return result;
}
/**
* Create Bar Object ...
*
* @param bar: XOHCL instance Reference ...
* @param object: XCOHCLObject pointer Reference ..
* @param to: Datetime ...
*
* @return ( bool )
*/
bool CreateBar(
XOHCL &bar,
XCOHCLObject *&object,
datetime to = NULL //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
to = NormalizeTime(to);
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
int width = BarWidth();
//
color mBullishColor = BarBullishColor();
color mBearishColor = BarBearishColor();
//
bool fillBody = BarFillBody();
bool fillHighShadow = BarFillHighShadow();
bool fillLowShadow = BarFillLowShadow();
//
ENUM_LINE_STYLE bodyStyle = BarBodyStyle();
ENUM_LINE_STYLE highShadowStyle = BarHighShadowStyle();
ENUM_LINE_STYLE lowShadowStyle = BarLowShadowStyle();
//
object = new XCOHCLObject();
result = object.Create(
chartID,
window,
bar,
to,
prefix //
);
if (result)
{
//
// Apply Styling ...
//
object.BodyWidth(width);
object.LowShadowWidth(width);
object.HighShadowWidth(width);
//
object.BodyStyle(bodyStyle);
object.LowShadowStyle(lowShadowStyle);
object.HighShadowStyle(highShadowStyle);
//
bool isBullish = bar.IsBullish();
if (isBullish)
{
//
object.BodyColor(mBullishColor);
object.LowShadowColor(mBullishColor);
object.HighShadowColor(mBullishColor);
}
else
{
//
object.BodyColor(mBearishColor);
object.LowShadowColor(mBearishColor);
object.HighShadowColor(mBearishColor);
}
//
object.BodyFill(fillBody);
object.HighShadowFill(fillHighShadow);
object.LowShadowFill(fillLowShadow);
}
//
return result;
}
/**
* Create Bar Arrow Object ...
*
* @param bar: XOHCL instance Reference ...
* @param priceType: ENUM_X_PRICE member ...
* @param arrow: int, Arrow Code ...
* @param clr: color, Arro Color ...
* @param width: int, Arrow Width ...
* @param anchor: ENUM_ARROW_ANCHOR, anchor of Arrow ...
* @param name: string, name of Arrow ...
*
* @return ( bool )
*/
bool CreateBarArrow(
XOHCL &bar,
XCBarArrowObject *&object,
ENUM_X_PRICE priceType,
int arrow = 159,
color clr = clrYellow,
int width = 3,
ENUM_ARROW_ANCHOR anchor = ANCHOR_BOTTOM,
string name = NULL //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
string barTag = bar.GetTag(name);
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
color mBullishColor = BarBullishColor();
color mBearishColor = BarBearishColor();
//
prefix =
(IsValid(prefix)
? prefix + "_"
: prefix) +
barTag;
//
object = new XCBarArrowObject();
result = object
.CreateByBar(
chartID,
prefix,
window,
arrow,
bar,
priceType //
);
if (result)
{
//
object.ArrowColor(clr);
object.ArrowWidth(width);
}
//
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,
string name,
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);
if (!IsValid(name))
{
//
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;
}
/**
* Create Specific Box on Chart ...
*
* @param box: XBoxZone instance Reference ...
* @param clr: Color ...
* @param width: Integer ...
* @param fill: Boolean ...
* @param style: ENUM_LINE_STYLE member ...
*
* @return ( bool )
*/
bool DrawBox(
XBoxZone &box,
XCBoxObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = box.IsValid();
if (!result)
{
return result;
}
//
int width = 1;
bool fill = false;
color clr =
box.IsBullish()
? BullishFVGColor()
: BearishFVGColor();
ENUM_LINE_STYLE style = STYLE_DASHDOTDOT;
string name = box.GetTag();
//
result = CreateBox(
object,
name,
box.upper,
box.lower,
box.from,
box.to,
clr,
width,
fill,
style //
);
//
return result;
}
/**
* Create Specific Box on Chart ...
*
* @param box: XBoxZone instance Reference ...
* @param clr: Color ...
* @param width: Integer ...
* @param fill: Boolean ...
* @param style: ENUM_LINE_STYLE member ...
*
* @return ( bool )
*/
bool CreateBox(
XBoxZone &box,
XCBoxObject *&object,
color clr = clrYellowGreen,
int width = 1,
bool fill = false,
ENUM_LINE_STYLE style = STYLE_SOLID //
)
{
//
bool result = false;
//
object = NULL;
//
result = box.IsValid();
if (!result)
{
return result;
}
//
string name = box.GetTag();
//
result = CreateBox(
object,
name,
box.upper,
box.lower,
box.from,
box.to,
clr,
width,
fill,
style //
);
//
return result;
}
/**
* Draw Specified Signal ...
*
* @param signal: XSignal instance ...
*/
bool DrawSignal(
XSignal &signal,
XCSignalObject *&object,
int length = 3 //
)
{
//
bool result = false;
//
object = NULL;
length = NormalizeInt(length, 3);
//
result = signal.IsValid();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
object = new XCSignalObject();
result = object.Create(
chartID,
window,
signal,
length,
prefix //
);
if (!result)
{
return result;
}
//
object.TPWidth(1);
object.TPColor(clrGreen);
object.TPWidth(STYLE_DOT);
//
object.SLWidth(1);
object.SLColor(clrRed);
object.SLWidth(STYLE_DOT);
//
object.TargetWidth(1);
object.TargetColor(clrLightBlue);
object.TargetWidth(STYLE_DOT);
//
object.EntryWidth(1);
object.EntryColor(clrYellow);
object.EntryWidth(STYLE_DOT);
//
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 ...
*
* @param state: XPOIState instance Reference ...
* @param drawnObjects: CArrayObj instance for Holding Drawn Objects ...
* @param drawTicksZone: Boolean ...
* @param ignoreSwingHighs: Boolean ...
* @param ignoreSwingLows: Boolean ...
* @param ignoreSupportZones: Boolean ...
* @param ignoreResistanceZones: Boolean ...
* @param ignoreSupplyZones: Boolean ...
* @param ignoreDemandZones: Boolean ...
* @param ignoreBullishOrderBlocks: Boolean ...
* @param ignoreBearishOrderBlocks: Boolean ...
* @param ignoreBullishFairValueGaps: Boolean ...
* @param ignoreBearishFairValueGaps: Boolean ...
* @param ignoreBullishRejectionBars: Boolean ...
* @param ignoreBearishRejectionBars: Boolean ...
* @param ignoreBullishMomentumBars: Boolean ...
* @param ignoreBearishMomentumBars: Boolean ...
*/
int DrawState(
XPOIState &state,
XCBaseObject *&drawnObjects[],
//
// Bullish ...
bool ignoreSwingLows = false,
bool ignoreDemandZones = false,
bool ignoreSupportZones = false,
bool ignoreBullishSharps = false,
bool ignoreBullishSpikes = false,
bool ignoreBullishPullbacks = false,
bool ignoreBullishMomentums = false,
bool ignoreBullishRejections = false,
bool ignoreBullishOrderBlocks = false,
bool ignoreBullishFairValueGaps = false,
bool ignoreBullishConsolidationZones = false,
//
// Bearish ...
bool ignoreSwingHighs = false,
bool ignoreSupplyZones = false,
bool ignoreResistanceZones = false,
bool ignoreBearishSharps = false,
bool ignoreBearishSpikes = false,
bool ignoreBearishPullbacks = false,
bool ignoreBearishMomentums = false,
bool ignoreBearishRejections = false,
bool ignoreBearishOrderBlocks = false,
bool ignoreBearishFairValueGaps = false,
bool ignoreBearishConsolidationZones = false //
)
{
//
int result = 0;
//
if (!state.IsValid() ||
!state.HasChild())
{
return result;
}
//
Clean(drawnObjects);
//
// Swings ...
//
// SwingHighs ...
if (!ignoreSwingHighs)
{
//
int count = state.CountSwingHighs();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCSwing *iSwing = state.swingHighs[i];
XCSwingHighObject *iObj;
//
bool isCreated = CreateSwingHigh(
iSwing,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// SwingLows ...
if (!ignoreSwingLows)
{
//
int count = state.CountSwingLows();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCSwing *iSwing = state.swingLows[i];
XCSwingLowObject *iObj;
//
bool isCreated = CreateSwingLow(
iSwing,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Support / Resistance ...
//
// SupportZones ...
if (!ignoreSupportZones)
{
//
int count = state.CountSupportZones();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCSupportZone *iZone = state.supportZones[i];
XCSupportZoneObject *iObj;
//
bool isCreated = CreateSupportZone(
iZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// ResistanceZones ...
if (!ignoreResistanceZones)
{
//
int count = state.CountResistanceZones();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCResistanceZone *iZone = state.resistanceZones[i];
XCResistanceZoneObject *iObj;
//
bool isCreated = CreateResistanceZone(
iZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Supply / Demand ...
//
// SupplyZones ...
if (!ignoreSupplyZones)
{
//
int count = state.CountSupplyZones();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCSupplyZone *iZone = state.supplyZones[i];
XCSupplyZoneObject *iObj;
//
bool isCreated = CreateSupplyZone(
iZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// DemandZones ...
if (!ignoreDemandZones)
{
//
int count = state.CountDemandZones();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCDemandZone *iZone = state.demandZones[i];
XCDemandZoneObject *iObj;
//
bool isCreated = CreateDemandZone(
iZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Order Blocks ...
//
// BullishOrderBlocks ...
if (!ignoreBullishOrderBlocks)
{
//
int count = state.CountBullishOrderBlocks();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCOrderBlock *iZone = state.bullishOrderBlocks[i];
XCBullishOrderBlockObject *iObj;
//
bool isCreated = CreateBullishOrderBlock(
iZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// BearishOrderBlocks ...
if (!ignoreBearishOrderBlocks)
{
//
int count = state.CountBearishOrderBlocks();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCOrderBlock *iZone = state.bearishOrderBlocks[i];
XCBearishOrderBlockObject *iObj;
//
bool isCreated = CreateBearishOrderBlock(
iZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Fair Value Gaps ...
//
// BullishFairValueGaps ...
if (!ignoreBullishFairValueGaps)
{
//
int count = state.CountBullishFairValueGaps();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCFVG *iZone = state.bullishFairValueGaps[i];
XCBullishFairValueGapObject *iObj;
//
bool isCreated = CreateBullishFairValueGap(
iZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// BearishFairValueGaps ...
if (!ignoreBearishFairValueGaps)
{
//
int count = state.CountBearishFairValueGaps();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCFVG *iZone = state.bearishFairValueGaps[i];
XCBearishFairValueGapObject *iObj;
//
bool isCreated = CreateBearishFairValueGap(
iZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Rejections ...
//
// BullishRejectionBars ...
if (!ignoreBullishRejections)
{
//
int count = state.CountBullishRejections();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCRejectionBar *iBar = state.bullishRejections[i];
XCBullishRejectionBarObject *iObj;
//
bool isCreated = CreateBullishRejectionBar(
iBar,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// BearishRejectionBars ...
if (!ignoreBearishRejections)
{
//
int count = state.CountBearishRejections();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCRejectionBar *iBar = state.bearishRejections[i];
XCBearishRejectionBarObject *iObj;
//
bool isCreated = CreateBearishRejectionBar(
iBar,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Momentums ...
//
// BullishMomentumBars ...
if (!ignoreBullishMomentums)
{
//
int count = state.CountBullishMomentums();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCMomentumBar *iBar = state.bullishMomentums[i];
XCBullishMomentumBarObject *iObj;
//
bool isCreated = CreateBullishMomentumBar(
iBar,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// BearishMomentumBars ...
if (!ignoreBearishMomentums)
{
//
int count = state.CountBearishMomentums();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCMomentumBar *iBar = state.bearishMomentums[i];
XCBearishMomentumBarObject *iObj;
//
bool isCreated = CreateBearishMomentumBar(
iBar,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Pullbacks ...
//
// Bullish ...
if (!ignoreBullishPullbacks)
{
//
int count = state.CountBullishPullbacks();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCBoxObject *iObj;
bool isCreated = DrawBox(
state.bullishPullbacks[i],
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Bearish ...
if (!ignoreBearishPullbacks)
{
//
int count = state.CountBearishPullbacks();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCBoxObject *iObj;
bool isCreated = DrawBox(
state.bearishPullbacks[i],
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Consolidation Zones ...
//
// Bullish Consolidation Zones ...
if (!ignoreBullishConsolidationZones)
{
//
int count = state.CountBullishConsolidationZones();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCConsolidationZoneObject *iObj;
bool isCreated = CreateConsolidationZone(
state.bullishConsolidationZones[i],
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Bearish Consolidation Zones ...
if (!ignoreBearishConsolidationZones)
{
//
int count = state.CountBearishConsolidationZones();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCConsolidationZoneObject *iObj;
bool isCreated = CreateConsolidationZone(
state.bearishConsolidationZones[i],
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Spikes ...
//
// Bullish ...
if (!ignoreBullishSpikes)
{
//
int count = state.CountBullishSpikes();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCBoxObject *iObj;
bool isCreated = DrawBox(
state.bullishSpikes[i],
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Bearish ...
if (!ignoreBearishSpikes)
{
//
int count = state.CountBearishSpikes();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCBoxObject *iObj;
bool isCreated = DrawBox(
state.bearishSpikes[i],
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Sharps ...
//
// Bullish ...
if (!ignoreBullishSharps)
{
//
int count = state.CountBullishSharps();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCBoxObject *iObj;
bool isCreated = DrawBox(
state.bullishSharps[i],
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
// Bearish ...
if (!ignoreBearishSharps)
{
//
int count = state.CountBearishSharps();
if (IsValidSize(count))
{
//
for (int i = 0; i < count; i++)
{
//
XCBoxObject *iObj;
bool isCreated = DrawBox(
state.bearishSharps[i],
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
//
result = ArraySize(drawnObjects);
//
return result;
}
//
protected:
//
//
private:
//
//
// Props ...
//
string mPrefix; // Prefix of Created Objects ...
long mChartIdentification; // Chart Id ...
int mSubWindowIdentification; // Sub Window ...
//
// XOHCL ...
int mBarWidth; // Bar Width ...
color mBarBullishColor; // Bar Bullish Color ...
color mBarBearishColor; // Bar Bearish Color ...
bool mBarFillHighShadow; // Fill Bar High Shadow ...
ENUM_LINE_STYLE mBarHighShadowStyle; // Bar High Shadow Style ...
bool mBarFillBody; // Fill Bar Body ...
ENUM_LINE_STYLE mBarBodyStyle; // Bar Body Style ...
bool mBarFillLowShadow; // Fill Bar Low Show ...
ENUM_LINE_STYLE mBarLowShadowStyle; // Bar Low Shadow Style ...
//
// Swing Low ...
int mSwingLowWidth; // Swing Low Width ...
int mSwingLowArrow; // Swing Low Arrow Code ...
color mSwingLowColor; // Swing Low Color ...
//
// Swing High ...
int mSwingHighWidth; // Swing High Width ...
int mSwingHighArrow; // Swing High Arrow Code ...
color mSwingHighColor; // Swing High Color ...
//
// Bullish Momentum Bar ...
int mBullishMomentumBarWidth; // Bullish Momentum Bar Width ...
int mBullishMomentumBarArrow; // Bullish Momentum Bar Arrow Code ...
color mBullishMomentumBarColor; // Bullish Momentum Bar Color ...
//
// Bearish Momentum Bar ...
int mBearishMomentumBarWidth; // Bearish Momentum Bar Width ...
int mBearishMomentumBarArrow; // Bearish Momentum Bar Arrow Code ...
color mBearishMomentumBarColor; // Bearish Momentum Bar Color ...
//
// Bullish Rejection Bar ...
int mBullishRejectionBarWidth; // Bullish Rejection Bar High Width ...
int mBullishRejectionBarArrow; // Bullish Rejection Bar High Arrow Code ...
color mBullishRejectionBarColor; // Bullish Rejection Bar High Color ...
//
// Bearish Rejection Bar ...
int mBearishRejectionBarWidth; // Bearish Rejection Bar Width ...
int mBearishRejectionBarArrow; // Bearish Rejection Bar Arrow Code ...
color mBearishRejectionBarColor; // Bearish Rejection Bar Color ...
//
// Supply Zone ...
bool mSupplyZoneFill; // Fill Supply Zone ...
int mSupplyZoneWidth; // Supply Zone Width ...
color mSupplyZoneColor; // Supply Zone Color ...
ENUM_LINE_STYLE mSupplyZoneStyle; // Supply Zone Style ...
//
// Demand Zone ...
bool mDemandZoneFill; // Fill Demand Zone ...
int mDemandZoneWidth; // Demand Zone Width ...
color mDemandZoneColor; // Demand Zone Color ...
ENUM_LINE_STYLE mDemandZoneStyle; // Demand Zone Style ...
//
// Resistance Zone ...
bool mResistanceZoneFill; // Fill Resistance Zone ...
int mResistanceZoneWidth; // Resistance Zone Width ...
color mResistanceZoneColor; // Resistance Zone Color ...
ENUM_LINE_STYLE mResistanceZoneStyle; // Resistance Zone Style ...
//
// Support Zone ...
bool mSupportZoneFill; // Fill Support Zone ...
int mSupportZoneWidth; // Support Zone Width ...
color mSupportZoneColor; // Support Zone Color ...
ENUM_LINE_STYLE mSupportZoneStyle; // Support Zone Style ...
//
// Bullish Order Block ...
bool mBullishOrderBlockFill; // Fill Bullish Order Block ...
int mBullishOrderBlockWidth; // Bullish Order Block Width ...
color mBullishOrderBlockColor; // Bullish Order Block Color ...
ENUM_LINE_STYLE mBullishOrderBlockStyle; // Bullish Order Block Style ...
//
// Bearish Order Block ...
bool mBearishOrderBlockFill; // Fill Bearish Order Block ...
int mBearishOrderBlockWidth; // Bearish Order Block Width ...
color mBearishOrderBlockColor; // Bearish Order Block Color ...
ENUM_LINE_STYLE mBearishOrderBlockStyle; // Bearish Order Block Style ...
//
// Bullish FVG ...
bool mBullishFVGFill; // Fill Bullish FVG ...
int mBullishFVGWidth; // Bullish FVG Width ...
color mBullishFVGColor; // Bullish FVG Color ...
ENUM_LINE_STYLE mBullishFVGStyle; // Bullish FVG Style ...
//
// Bearish FVG ...
bool mBearishFVGFill; // Fill Bearish FVG ...
int mBearishFVGWidth; // Bearish FVG Width ...
color mBearishFVGColor; // Bearish FVG Color ...
ENUM_LINE_STYLE mBearishFVGStyle; // Bearish FVG Style ...
//
// Ticks Zone ...
XTickZoneLevelSpecs mTicksZoneSpecs[]; // Zone Draw Specifications ...
//
};