1949 lines
46 KiB
Plaintext
1949 lines
46 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Class
|
|
// -------------------------------------------------
|
|
// Name: XCXFIMAPoiDrawer ...
|
|
// Description: XFIMA POI Drawer Class ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property library
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://saherelm.ir"
|
|
#property version "1.00"
|
|
#property description "SaherElm XFIMA POI Drawer Class"
|
|
#property strict
|
|
|
|
//
|
|
// Imports ...
|
|
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
|
#include "../Libraries/x-saherelm.xfima.lib.mq5"
|
|
|
|
//
|
|
// Implementation ...
|
|
class XCXFIMAPOIDrawer : public XCPOIDrawer
|
|
{
|
|
//
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Tested Zones ...
|
|
color testedBullishColor;
|
|
color testedBearishColor;
|
|
|
|
//
|
|
// Breaked Zones ...
|
|
color breakedBullishColor;
|
|
color breakedBearishColor;
|
|
|
|
//
|
|
// FakeBreaked Zones ...
|
|
color fakeBreakedBullishColor;
|
|
color fakeBreakedBearishColor;
|
|
|
|
//
|
|
// Constructor ...
|
|
XCXFIMAPOIDrawer() : XCPOIDrawer()
|
|
{
|
|
Default();
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCXFIMAPOIDrawer()
|
|
{
|
|
}
|
|
|
|
//
|
|
// Overrides ...
|
|
|
|
/**
|
|
* Do additional Configurations for Child Classes ...
|
|
*/
|
|
void virtual Default() override
|
|
{
|
|
//
|
|
// Apply Default Props ...
|
|
|
|
//
|
|
Prefix(NULL);
|
|
ChartIdentification(0);
|
|
SubWindowIdentification(0);
|
|
|
|
//
|
|
defaultBullishStyle.width = 1;
|
|
defaultBullishStyle.clr = clrAqua;
|
|
defaultBullishStyle.style = STYLE_SOLID;
|
|
|
|
//
|
|
defaultBearishStyle.width = 1;
|
|
defaultBearishStyle.clr = clrMagenta;
|
|
defaultBearishStyle.style = STYLE_SOLID;
|
|
|
|
//
|
|
boxBullishStyle = defaultBullishStyle;
|
|
boxBearishStyle = defaultBearishStyle;
|
|
|
|
//
|
|
testedBullishColor = clrLime;
|
|
breakedBullishColor = clrGreen;
|
|
fakeBreakedBullishColor = clrYellow;
|
|
|
|
//
|
|
testedBearishColor = clrRed;
|
|
breakedBearishColor = clrDarkRed;
|
|
fakeBreakedBearishColor = clrDarkOrange;
|
|
}
|
|
|
|
//
|
|
// Get Specified Directional Arrow Anchor ...
|
|
ENUM_ARROW_ANCHOR GetArrowAnchor(ENUM_X_DIRECTION forDir)
|
|
{
|
|
//
|
|
ENUM_ARROW_ANCHOR result = ANCHOR_BOTTOM;
|
|
|
|
//
|
|
if (HasDirection(forDir))
|
|
{
|
|
//
|
|
result =
|
|
IsSpecifiedBullish(forDir)
|
|
? ANCHOR_TOP
|
|
: ANCHOR_BOTTOM;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Get Specified Directional Arrow Code ...
|
|
int GetArrowCode(ENUM_X_DIRECTION forDir)
|
|
{
|
|
//
|
|
int result = 159;
|
|
|
|
//
|
|
if (HasDirection(forDir))
|
|
{
|
|
//
|
|
result =
|
|
IsSpecifiedBullish(forDir)
|
|
? 233
|
|
: 234;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Get Specified Directional Arrow Code ...
|
|
color GetArrowColor(ENUM_X_DIRECTION forDir)
|
|
{
|
|
//
|
|
color result = clrYellow;
|
|
|
|
//
|
|
if (HasDirection(forDir))
|
|
{
|
|
//
|
|
result =
|
|
IsSpecifiedBullish(forDir)
|
|
? clrAqua
|
|
: clrMagenta;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Get Specified Directional Arrow Price Type ...
|
|
ENUM_X_PRICE GetArrowPriceType(ENUM_X_DIRECTION forDir)
|
|
{
|
|
//
|
|
ENUM_X_PRICE result = X_PRICE_CLOSE;
|
|
|
|
//
|
|
if (HasDirection(forDir))
|
|
{
|
|
//
|
|
result =
|
|
IsSpecifiedBullish(forDir)
|
|
? X_PRICE_LOW
|
|
: X_PRICE_HIGH;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Get Tested Zone Style ...
|
|
*
|
|
* @param style: reference to hold result ...
|
|
* @param zone: Specified Zone ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool GetTestedStyle(
|
|
XPOIStyle &style,
|
|
XBoxZone &zone //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
style.Clean();
|
|
|
|
//
|
|
result = zone.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
GetBoxStyle(
|
|
style,
|
|
zone.dir //
|
|
);
|
|
|
|
//
|
|
style.width = 3;
|
|
style.clr =
|
|
zone.IsBullish()
|
|
? testedBullishColor
|
|
: testedBearishColor;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Get Patterns Zone Style ...
|
|
*
|
|
* @param style: reference to hold result ...
|
|
* @param zone: Specified Zone ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool GetPatternStyle(
|
|
XPOIStyle &style,
|
|
XBoxZone &zone //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
style.Clean();
|
|
|
|
//
|
|
result = zone.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
GetPatternStyle(
|
|
style,
|
|
zone.dir //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Get Patterns Zone Style ...
|
|
*
|
|
* @param style: reference to hold result ...
|
|
* @param forDir: Specified Direction ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool GetPatternStyle(
|
|
XPOIStyle &style,
|
|
ENUM_X_DIRECTION forDir //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
style.Clean();
|
|
|
|
//
|
|
result = HasDirection(forDir);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
GetBoxStyle(
|
|
style,
|
|
forDir //
|
|
);
|
|
|
|
//
|
|
style.width = 2;
|
|
style.style = STYLE_DASH;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Get Breaked Zone Style ...
|
|
*
|
|
* @param style: reference to hold result ...
|
|
* @param zone: Specified Zone ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool GetBreakedStyle(
|
|
XPOIStyle &style,
|
|
XBoxZone &zone //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
style.Clean();
|
|
|
|
//
|
|
result = zone.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
GetBoxStyle(
|
|
style,
|
|
zone.dir //
|
|
);
|
|
|
|
//
|
|
style.width = 3;
|
|
style.clr =
|
|
zone.IsBullish()
|
|
? breakedBullishColor
|
|
: breakedBearishColor;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Get Fake Breaked Zone Style ...
|
|
*
|
|
* @param style: reference to hold result ...
|
|
* @param zone: Specified Zone ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool GetFakeBreakedStyle(
|
|
XPOIStyle &style,
|
|
XBoxZone &zone //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
style.Clean();
|
|
|
|
//
|
|
result = zone.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
GetBoxStyle(
|
|
style,
|
|
zone.dir //
|
|
);
|
|
|
|
//
|
|
style.width = 3;
|
|
style.clr =
|
|
zone.IsBullish()
|
|
? fakeBreakedBullishColor
|
|
: fakeBreakedBearishColor;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Fill Arrow Based Drawing Specs ...
|
|
*
|
|
* @param forDir: Specified Direction ...
|
|
* @param arrowPriceType: ENUM_X_PRICE, refrence for Arrow Price ...
|
|
* @param arrowCode: int, reference for Arrow Code ...
|
|
* @param arrowWidth: int, reference for Arrow Width ...
|
|
* @param arrowColor: color, reference for Arrow Color ...
|
|
* @param arrowAnchor: ENUM_ARROW_ANCHOR, reference for Arrow Anchor ...
|
|
*/
|
|
void FillArrowSpecs(
|
|
ENUM_X_DIRECTION forDir,
|
|
ENUM_X_PRICE &arrowPriceType,
|
|
int &arrowCode,
|
|
int &arrowWidth,
|
|
color &arrowColor,
|
|
ENUM_ARROW_ANCHOR &arrowAnchor //
|
|
)
|
|
{
|
|
//
|
|
// Prepare ...
|
|
arrowCode = 159;
|
|
arrowWidth = 2;
|
|
arrowColor = CLR_NONE;
|
|
arrowAnchor = ANCHOR_BOTTOM;
|
|
arrowPriceType = X_PRICE_CLOSE;
|
|
|
|
//
|
|
if (HasDirection(forDir))
|
|
{
|
|
//
|
|
arrowCode = GetArrowCode(forDir);
|
|
arrowColor = GetArrowColor(forDir);
|
|
arrowAnchor = GetArrowAnchor(forDir);
|
|
arrowPriceType = GetArrowPriceType(forDir);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Apply Tested Style ...
|
|
*
|
|
* @param object: reference pointer to Object ...
|
|
* @param zone: reference to Zone ...
|
|
*/
|
|
void ApplyTestedStyle(
|
|
XCBoxObject *&object,
|
|
XBoxZone &zone //
|
|
)
|
|
{
|
|
//
|
|
if (!zone.IsValid() ||
|
|
object == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
XPOIStyle style;
|
|
if (!GetTestedStyle(style, zone))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
ApplyBoxStyle(
|
|
object,
|
|
style //
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Apply Breaked Style ...
|
|
*
|
|
* @param object: reference pointer to Object ...
|
|
* @param zone: reference to Zone ...
|
|
*/
|
|
void ApplyBreakedStyle(
|
|
XCBoxObject *&object,
|
|
XBoxZone &zone //
|
|
)
|
|
{
|
|
//
|
|
if (!zone.IsValid() ||
|
|
object == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
XPOIStyle style;
|
|
if (!GetBreakedStyle(style, zone))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
ApplyBoxStyle(
|
|
object,
|
|
style //
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Apply Tested Style ...
|
|
*
|
|
* @param object: reference pointer to Object ...
|
|
* @param zone: reference to Zone ...
|
|
*/
|
|
void ApplyFakeBreakStyle(
|
|
XCBoxObject *&object,
|
|
XBoxZone &zone //
|
|
)
|
|
{
|
|
//
|
|
if (!zone.IsValid() ||
|
|
object == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
XPOIStyle style;
|
|
if (!GetFakeBreakedStyle(style, zone))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
ApplyBoxStyle(
|
|
object,
|
|
style //
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Apply Pattern Style ...
|
|
*
|
|
* @param object: reference pointer to Object ...
|
|
* @param zone: reference to Zone ...
|
|
*/
|
|
void ApplyPatternStyle(
|
|
XCBoxObject *&object,
|
|
XBoxZone &zone //
|
|
)
|
|
{
|
|
//
|
|
if (!zone.IsValid() ||
|
|
object == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
XPOIStyle style;
|
|
if (!GetPatternStyle(style, zone))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
ApplyBoxStyle(
|
|
object,
|
|
style //
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Apply Patterns Style ...
|
|
*
|
|
* @param object: reference pointer to Object ...
|
|
*/
|
|
void ApplyPatternsStyle(
|
|
CArrayObj *&objects //
|
|
)
|
|
{
|
|
//
|
|
if (objects == NULL ||
|
|
objects.Total() == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
bool has = false;
|
|
XPOIStyle iStyle;
|
|
string iName = NULL;
|
|
XCBoxObject *iBoxObj = NULL;
|
|
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
|
for (int i = 0; i < objects.Total(); i++)
|
|
{
|
|
//
|
|
iBoxObj = (XCBoxObject *)objects.At(i);
|
|
iName = iBoxObj.ObjName();
|
|
|
|
//
|
|
iDir =
|
|
IsSpecifiedValid(iName) &&
|
|
Contains(
|
|
"BULL",
|
|
iName //
|
|
)
|
|
? X_DIRECTION_BULLISH
|
|
: IsSpecifiedValid(iName) &&
|
|
Contains(
|
|
"BEAR",
|
|
iName //
|
|
)
|
|
? X_DIRECTION_BEARISH
|
|
: X_DIRECTION_NONE;
|
|
|
|
//
|
|
has = GetPatternStyle(iStyle, iDir);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyBoxStyle(
|
|
iBoxObj,
|
|
iStyle //
|
|
);
|
|
}
|
|
|
|
//
|
|
iStyle.Clean();
|
|
ZeroMemory(iBoxObj);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Apply Style to Specified Pivot Object ...
|
|
*
|
|
* @param object: reference pointer to Object ...
|
|
* @param zone: reference to Zone ...
|
|
*/
|
|
void ApplyPivotStyle(
|
|
XCBarArrowObject *&object,
|
|
XPOIStyle &style //
|
|
)
|
|
{
|
|
//
|
|
if (object == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
object.ArrowColor(style.clr);
|
|
object.ArrowWidth(style.width);
|
|
}
|
|
|
|
/**
|
|
* Apply Patterns Style ...
|
|
*
|
|
* @param object: reference pointer to Object ...
|
|
*/
|
|
void ApplyPivotsStyle(
|
|
CArrayObj *&objects //
|
|
)
|
|
{
|
|
//
|
|
if (objects == NULL ||
|
|
objects.Total() == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
bool has = false;
|
|
XPOIStyle iStyle;
|
|
string iName = NULL;
|
|
XCBarArrowObject *iObj = NULL;
|
|
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
|
for (int i = 0; i < objects.Total(); i++)
|
|
{
|
|
//
|
|
iObj = (XCBarArrowObject *)objects.At(i);
|
|
iName = iObj.ObjName();
|
|
|
|
//
|
|
iDir =
|
|
IsSpecifiedValid(iName) &&
|
|
Contains(
|
|
"BULL",
|
|
iName //
|
|
)
|
|
? X_DIRECTION_BULLISH
|
|
: IsSpecifiedValid(iName) &&
|
|
Contains(
|
|
"BEAR",
|
|
iName //
|
|
)
|
|
? X_DIRECTION_BEARISH
|
|
: X_DIRECTION_NONE;
|
|
|
|
//
|
|
has = GetPatternStyle(iStyle, iDir);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPivotStyle(
|
|
iObj,
|
|
iStyle //
|
|
);
|
|
}
|
|
|
|
//
|
|
iStyle.Clean();
|
|
ZeroMemory(iObj);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Draw Specified Market Structure Based on Given Configs ...
|
|
*
|
|
* @param structure: XFIMAMarketStructure, reference to Provide Specifid Market Structure ...
|
|
* @param config: XFIMAMarketStructureDrawerConfig, reference to Provide Drawing Configurations ...
|
|
* @param objects: CArrayObj, pointer reference to Holds drawn Objects instances ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int DrawMarketStructure(
|
|
XFIMAMarketStructure &structure,
|
|
XFIMAMarketStructureDrawerConfig &config,
|
|
CArrayObj *&objects //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
// Normalize ...
|
|
if (objects == NULL)
|
|
{
|
|
objects = new CArrayObj();
|
|
}
|
|
|
|
//
|
|
// Prepare ...
|
|
// objects.Clear();
|
|
|
|
//
|
|
int count = 0;
|
|
bool has = false;
|
|
int arrowCode = -1;
|
|
int arrowWidth = 3;
|
|
string arrowName = NULL;
|
|
color arrowColor = CLR_NONE;
|
|
ENUM_X_PRICE arrowPriceType = X_PRICE_CLOSE;
|
|
ENUM_ARROW_ANCHOR arrowAnchor = ANCHOR_BOTTOM;
|
|
|
|
//
|
|
int bullArrowCode = GetArrowCode(X_DIRECTION_BULLISH);
|
|
int bearArrowCode = GetArrowCode(X_DIRECTION_BEARISH);
|
|
|
|
//
|
|
// Validate ...
|
|
has = structure.bar.IsValid();
|
|
if (!has)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Apply Drawing Methods ...
|
|
|
|
//
|
|
// OB ...
|
|
if (config.drawOB)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = structure.ob.IsValid();
|
|
if (has)
|
|
{
|
|
//
|
|
XCBoxObject *iObj;
|
|
has = DrawBox(
|
|
structure.ob,
|
|
iObj //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(iObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// FVG ...
|
|
if (config.drawFVG)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = structure.fvg.IsValid();
|
|
if (has)
|
|
{
|
|
//
|
|
XCBoxObject *iObj;
|
|
has = DrawBox(
|
|
structure.fvg,
|
|
iObj //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(iObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Support ...
|
|
if (config.drawSupport)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = structure.support.IsValid();
|
|
if (has)
|
|
{
|
|
//
|
|
XCBoxObject *iObj;
|
|
has = DrawBox(
|
|
structure.support,
|
|
iObj //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(iObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Resistance ...
|
|
if (config.drawResistance)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = structure.resistance.IsValid();
|
|
if (has)
|
|
{
|
|
//
|
|
XCBoxObject *iObj;
|
|
has = DrawBox(
|
|
structure.resistance,
|
|
iObj //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(iObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Swing Trend ...
|
|
if (config.drawSwingTrend)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.trendDir) &&
|
|
HasChild(structure.trendSwings);
|
|
if (has)
|
|
{
|
|
//
|
|
CChartObjectTrend *iObj;
|
|
has = DrawSwingTrend(
|
|
structure.trendSwings,
|
|
structure.trendDir,
|
|
iObj, //
|
|
config.swingTrendRayRight, // Ray Right ...
|
|
config.swingTrendRayLeft // Ray Left ...
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(iObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Start Pattern ...
|
|
if (config.drawStarPattern)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.starPatternDir);
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.starPatternDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XStar_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Flag Pattern ...
|
|
if (config.drawFlagPattern)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.flagPatternDir) &&
|
|
structure.flagSwing.IsValid();
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.flagPatternDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XFlag_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Rising Pattern ...
|
|
if (config.drawRisingPattern)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.risingPatternDir);
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.risingPatternDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XRise_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Piercing Pattern ...
|
|
if (config.drawPiercingPattern)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.piercingPatternDir);
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.piercingPatternDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XPiercing_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Signal Key Bar Pattern ...
|
|
if (config.drawSignalKeyBarPattern)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.signalKeyBarPatternDir);
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.signalKeyBarPatternDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XSignalKey_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Pinned Bar ...
|
|
if (config.drawPinned)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.pinnedDir);
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.pinnedDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XPin_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Momentum Bar ...
|
|
if (config.drawMomentum)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.momentumDir);
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.momentumDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XMomentum_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Engulfed Bar ...
|
|
if (config.drawEngulfed)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.engulfedDir);
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.engulfedDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XEngulf_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// True Gaped Bar ...
|
|
if (config.drawTrueGaped)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = HasDirection(structure.trueGapedDir);
|
|
if (has)
|
|
{
|
|
//
|
|
FillArrowSpecs(
|
|
structure.trueGapedDir,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowWidth,
|
|
arrowColor,
|
|
arrowAnchor //
|
|
);
|
|
XCBarArrowObject *iObj;
|
|
arrowName = "XTrueGap_" + ToMD5(structure.bar.time);
|
|
has = DrawBarArrow(
|
|
structure.bar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor,
|
|
arrowName //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// XFIMA PV Analysis ...
|
|
if (config.drawFIMAPVPivotsAnalysis)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = structure.pvAnalysis.IsValid();
|
|
if (has)
|
|
{
|
|
//
|
|
XCPivotAnalysisObject *iObj;
|
|
has = DrawPivotAnalysis(
|
|
structure.pvAnalysis,
|
|
iObj,
|
|
config.drawFIMAPVPivotsAnalysisTrends,
|
|
config.drawFIMAPVPivotsAnalysisZones,
|
|
config.drawFIMAPVPivotsAnalysisPivots,
|
|
bearArrowCode,
|
|
bullArrowCode //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// XFIMA Sar Analysis ...
|
|
if (config.drawFIMASARPivotsAnalysis)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = structure.sarAnalysis.IsValid();
|
|
if (has)
|
|
{
|
|
//
|
|
XCPivotAnalysisObject *iObj;
|
|
has = DrawPivotAnalysis(
|
|
structure.pvAnalysis,
|
|
iObj,
|
|
config.drawFIMASARPivotsAnalysisTrends,
|
|
config.drawFIMASARPivotsAnalysisZones,
|
|
config.drawFIMASARPivotsAnalysisPivots,
|
|
bearArrowCode,
|
|
bullArrowCode //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// XFIMA ZigZag Analysis ...
|
|
if (config.drawFIMAZigZagPivotsAnalysis)
|
|
{
|
|
//
|
|
// Validate ...
|
|
has = structure.zigzagAnalysis.IsValid();
|
|
if (has)
|
|
{
|
|
//
|
|
XCPivotAnalysisObject *iObj;
|
|
has = DrawPivotAnalysis(
|
|
structure.pvAnalysis,
|
|
iObj,
|
|
config.drawFIMAZigZagPivotsAnalysisTrends,
|
|
config.drawFIMAZigZagPivotsAnalysisZones,
|
|
config.drawFIMAZigZagPivotsAnalysisPivots,
|
|
bearArrowCode,
|
|
bullArrowCode //
|
|
);
|
|
if (has)
|
|
{
|
|
objects.Add(iObj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Fake Breaked Zone ...
|
|
if (config.drawFakeBreakedZone &&
|
|
structure.fakeBreakedZone.IsValid())
|
|
{
|
|
//
|
|
XCBoxObject *iObj;
|
|
has = DrawBox(
|
|
structure.fakeBreakedZone,
|
|
iObj //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
// Apply Style ...
|
|
ApplyFakeBreakStyle(
|
|
iObj,
|
|
structure.fakeBreakedZone //
|
|
);
|
|
|
|
//
|
|
objects.Add(iObj);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(iObj);
|
|
}
|
|
|
|
//
|
|
// Recently Tested Zones ...
|
|
if (config.drawRecentlyTestedZones &&
|
|
HasChild(structure.recentlyTestedZones))
|
|
{
|
|
//
|
|
XCBoxObject *iObj;
|
|
count = ArraySize(structure.recentlyTestedZones);
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
// Draw Box ...
|
|
has = DrawBox(
|
|
structure.recentlyTestedZones[i],
|
|
iObj //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyTestedStyle(
|
|
iObj,
|
|
structure.recentlyTestedZones[i] //
|
|
);
|
|
|
|
//
|
|
objects.Add(iObj);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(iObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Recently Breaked Zones ...
|
|
if (config.drawRecentlyBreakedZones &&
|
|
HasChild(structure.recentlyBreakedZones))
|
|
{
|
|
//
|
|
XCBoxObject *iObj;
|
|
count = ArraySize(structure.recentlyBreakedZones);
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
// Draw Box ...
|
|
has = DrawBox(
|
|
structure.recentlyBreakedZones[i],
|
|
iObj //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyBreakedStyle(
|
|
iObj,
|
|
structure.recentlyBreakedZones[i] //
|
|
);
|
|
|
|
//
|
|
objects.Add(iObj);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(iObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Draw Recent Patterns ...
|
|
if (config.drawRecentPatterns)
|
|
{
|
|
//
|
|
int baseArrowCode = 159;
|
|
CArrayObj *patternObjects;
|
|
|
|
//
|
|
// Order Blocs ...
|
|
if (config.drawOB &&
|
|
HasChild(structure.obs))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.obs,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
if (config.drawFVG &&
|
|
HasChild(structure.fvgs))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.fvgs,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Supports ...
|
|
if (config.drawSupport &&
|
|
HasChild(structure.supports))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.supports,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Resistances ...
|
|
if (config.drawResistance &&
|
|
HasChild(structure.obs))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.resistances,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Pin Bars ...
|
|
if (config.drawPinned &&
|
|
HasChild(structure.pinBars))
|
|
{
|
|
//
|
|
count = DrawPivots(
|
|
structure.pinBars,
|
|
patternObjects,
|
|
baseArrowCode,
|
|
baseArrowCode //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPivotsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Engulf Bars ...
|
|
if (config.drawEngulfed &&
|
|
HasChild(structure.engulfBars))
|
|
{
|
|
//
|
|
count = DrawPivots(
|
|
structure.engulfBars,
|
|
patternObjects,
|
|
baseArrowCode,
|
|
baseArrowCode //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPivotsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// TrueGap Bars ...
|
|
if (config.drawTrueGaped &&
|
|
HasChild(structure.trueGapBars))
|
|
{
|
|
//
|
|
count = DrawPivots(
|
|
structure.trueGapBars,
|
|
patternObjects,
|
|
baseArrowCode,
|
|
baseArrowCode //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPivotsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Momentum Bars ...
|
|
if (config.drawMomentum &&
|
|
HasChild(structure.momentumBars))
|
|
{
|
|
//
|
|
count = DrawPivots(
|
|
structure.momentumBars,
|
|
patternObjects,
|
|
baseArrowCode,
|
|
baseArrowCode //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPivotsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Flag Pattern ...
|
|
if (config.drawFlagPattern &&
|
|
HasChild(structure.flagPatterns))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.flagPatterns,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Star Pattern ...
|
|
if (config.drawStarPattern &&
|
|
HasChild(structure.starPatterns))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.starPatterns,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Rising Pattern ...
|
|
if (config.drawRisingPattern &&
|
|
HasChild(structure.risingPatterns))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.risingPatterns,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// Piercing Pattern ...
|
|
if (config.drawPiercingPattern &&
|
|
HasChild(structure.piercingPatterns))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.piercingPatterns,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
|
|
//
|
|
// SignalKeyBar Pattern ...
|
|
if (config.drawSignalKeyBarPattern &&
|
|
HasChild(structure.signalKeyBarPatterns))
|
|
{
|
|
//
|
|
count = DrawBoxes(
|
|
structure.signalKeyBarPatterns,
|
|
patternObjects //
|
|
);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
ApplyPatternsStyle(patternObjects);
|
|
|
|
//
|
|
AddObjects(
|
|
patternObjects,
|
|
objects //
|
|
);
|
|
}
|
|
|
|
//
|
|
ZeroMemory(patternObjects);
|
|
}
|
|
}
|
|
|
|
//
|
|
result = objects.Total();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
/**
|
|
* Draw Pivot Analysis ...
|
|
*
|
|
* @param analysis: XPivotAnalysis, referece Specified Pivot Analysis ...
|
|
* @param object: XCPivotAnalysisObject, pointer reference for Drawn Object ...
|
|
* @param drawTrends: Specified to Draw Trends or not ...
|
|
* @param drawZones: Specified to Draw Support and Resistance Zones or not ...
|
|
* @param drawPivots: Specified to Draw Pivots or not ...
|
|
* @param peakArrow: int, Specified Arrow Code for Peak Pivots ...
|
|
* @param valeArrow: int, Specified Arrow Code for Vale Pivots ...
|
|
* @param threshold: int, distance between price and arrow in Point ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool DrawPivotAnalysis(
|
|
XPivotAnalysis &analysis,
|
|
XCPivotAnalysisObject *&object,
|
|
bool drawTrends = true,
|
|
bool drawZones = true,
|
|
bool drawPivots = true,
|
|
int peakArrow = 159,
|
|
int valeArrow = 159,
|
|
int threshold = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Prepare ...
|
|
object = NULL;
|
|
|
|
//
|
|
// Normalize ...
|
|
|
|
//
|
|
// Validate ...
|
|
result = analysis.IsValid() &&
|
|
analysis.IsAnalysed();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
object = new XCPivotAnalysisObject();
|
|
result = object.Create(
|
|
ChartIdentification(),
|
|
SubWindowIdentification(),
|
|
analysis,
|
|
drawTrends,
|
|
drawZones,
|
|
drawPivots,
|
|
peakArrow,
|
|
valeArrow,
|
|
threshold //
|
|
);
|
|
if (result)
|
|
{
|
|
//
|
|
ApplyPivotAnalysisStyle(
|
|
object,
|
|
analysis //
|
|
);
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Apply Specified Style to Specified Object ...
|
|
*
|
|
* @param object: CChartObject, pointer reference of Object ...
|
|
* @param model: XPivotAnalysis, referece to access requirements ...
|
|
*/
|
|
void ApplyPivotAnalysisStyle(
|
|
XCPivotAnalysisObject *&object,
|
|
XPivotAnalysis &model //
|
|
)
|
|
{
|
|
//
|
|
// Validate ...
|
|
bool has = model.IsValid() &&
|
|
model.IsAnalysed() &&
|
|
object != NULL;
|
|
if (!has)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
XPOIStyle style;
|
|
|
|
//
|
|
// Support ...
|
|
style = defaultBullishStyle;
|
|
object.SupportColor(style.clr);
|
|
object.SupportWidth(style.width);
|
|
object.SupportStyle(style.style);
|
|
|
|
//
|
|
// Resistance ...
|
|
style = defaultBearishStyle;
|
|
object.ResistanceColor(style.clr);
|
|
object.ResistanceWidth(style.width);
|
|
object.ResistanceStyle(style.style);
|
|
|
|
//
|
|
// Upper ...
|
|
if (model.IsPeakAnalysed())
|
|
{
|
|
//
|
|
GetStyle(
|
|
style,
|
|
model.peakDir //
|
|
);
|
|
if (!HasDirection(model.peakDir))
|
|
{
|
|
//
|
|
style.Default();
|
|
style.clr = clrGray;
|
|
}
|
|
|
|
//
|
|
object.UpperColor(style.clr);
|
|
object.UpperWidth(style.width);
|
|
object.UpperStyle(style.style);
|
|
object.UpperRayLeft(false);
|
|
object.UpperRayRight(true);
|
|
}
|
|
|
|
//
|
|
// Lower ...
|
|
if (model.IsValeAnalysed())
|
|
{
|
|
//
|
|
GetStyle(
|
|
style,
|
|
model.valeDir //
|
|
);
|
|
if (!HasDirection(model.valeDir))
|
|
{
|
|
//
|
|
style.Default();
|
|
style.clr = clrGray;
|
|
}
|
|
|
|
//
|
|
object.LowerColor(style.clr);
|
|
object.LowerWidth(style.width);
|
|
object.LowerStyle(style.style);
|
|
object.UpperRayLeft(false);
|
|
object.LowerRayRight(true);
|
|
}
|
|
|
|
//
|
|
// Peak Pivots ...
|
|
style = defaultBearishStyle;
|
|
object.PeaksColor(style.clr);
|
|
object.PeaksWidth(style.width);
|
|
object.PeaksAnchor(ANCHOR_BOTTOM);
|
|
|
|
//
|
|
// Vale Pivots ...
|
|
style = defaultBullishStyle;
|
|
object.ValesColor(style.clr);
|
|
object.ValesWidth(style.width);
|
|
object.ValesAnchor(ANCHOR_TOP);
|
|
|
|
//
|
|
style.Clean();
|
|
}
|
|
|
|
// |