last works on xki ...

This commit is contained in:
2025-12-30 21:38:58 +03:30
parent 5850164aab
commit b1731af03c
8 changed files with 6662 additions and 66 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,973 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class
// -------------------------------------------------
// Name: XCX121XKIPoiDetector ...
// Description: X121XKI POI Detector 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 X121XKI POI Detector Class"
#property strict
//
// Imports ...
#include "../../Classes/x-saherelm.base.class.mq5"
#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5"
#include "../../Classes/x-saherelm.x-market.pattern.class.mq5"
#include "../../Helpers/x-saherelm.x121.xki.helper.mq5"
#include "../Classes/x-saherelm.x121.xki.parser.class.mq5"
//
// Definitions ...
//
// Implementation ...
class XCX121XKIPOIDetector : public XCMarketPatternDetector
{
//
// Public ...
public:
//
// Props ...
//
string symbol;
ENUM_TIMEFRAMES period;
//
XCBarAnalyser *barAnalyser; // Bar Analyser ...
XCX121XKIHelper *kiHelper; // X121XKI Helper ...
XCX121XKIHelperParser *kiParser; // X121XKI Helper Parser ...
//
// Constructor ...
XCX121XKIPOIDetector(
XCX121XKIHelper *_kiHelper,
XCX121XKIHelperParser *_kiParser //
) : XCMarketPatternDetector()
{
//
barAnalyser = new XCBarAnalyser();
kiHelper = _kiHelper;
kiParser = _kiParser;
//
symbol = kiHelper.GetSymbol();
period = kiHelper.GetPeriod();
}
//
// Deconstructor ...
~XCX121XKIPOIDetector()
{
Destroy();
}
//
// Actions and Tools ...
// #region POI Detectors ...
bool NearestKIFastBullish(
int &index,
int barIndex = 0,
int loopback = 50 //
)
{
//
bool result = false;
//
index = -1;
//
// Normalize ...
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Loop Back ...
bool isPassed = false;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
isPassed = kiParser.IsKIFastBullish(i);
if (isPassed)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
bool NearestKIFastBearish(
int &index,
int barIndex = 0,
int loopback = 50 //
)
{
//
bool result = false;
//
index = -1;
//
// Normalize ...
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Loop Back ...
bool isPassed = false;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
isPassed = kiParser.IsKIFastBearish(i);
if (isPassed)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
bool NearestKIFastSwitchedToBullish(
int &index,
int barIndex = 0,
int loopback = 50 //
)
{
//
bool result = false;
//
index = -1;
//
// Normalize ...
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Loop Back ...
bool isPassed = false;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
isPassed = kiParser.IsKIFastSwitchedToBullish(i);
if (isPassed)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
bool NearestKIFastSwitchedToBearish(
int &index,
int barIndex = 0,
int loopback = 50 //
)
{
//
bool result = false;
//
index = -1;
//
// Normalize ...
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Loop Back ...
bool isPassed = false;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
isPassed = kiParser.IsKIFastSwitchedToBearish(i);
if (isPassed)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
bool NearestKISlowBullish(
int &index,
int barIndex = 0,
int loopback = 50 //
)
{
//
bool result = false;
//
index = -1;
//
// Normalize ...
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Loop Back ...
bool isPassed = false;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
isPassed = kiParser.IsKISlowBullish(i);
if (isPassed)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
bool NearestKISlowBearish(
int &index,
int barIndex = 0,
int loopback = 50 //
)
{
//
bool result = false;
//
index = -1;
//
// Normalize ...
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Loop Back ...
bool isPassed = false;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
isPassed = kiParser.IsKISlowBearish(i);
if (isPassed)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
bool NearestKISlowSwitchedToBullish(
int &index,
int barIndex = 0,
int loopback = 50 //
)
{
//
bool result = false;
//
index = -1;
//
// Normalize ...
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Loop Back ...
bool isPassed = false;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
isPassed = kiParser.IsKISlowSwitchedToBullish(i);
if (isPassed)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
bool NearestKISlowSwitchedToBearish(
int &index,
int barIndex = 0,
int loopback = 50 //
)
{
//
bool result = false;
//
index = -1;
//
// Normalize ...
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Loop Back ...
bool isPassed = false;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
isPassed = kiParser.IsKISlowSwitchedToBearish(i);
if (isPassed)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
// #endregion
// #region Detectors ...
bool IsBullishPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsTrendBullish(barIndex) &&
kiParser.IsRSIBullish(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsPinnedBar(bar, dir) &&
IsXBullish(dir);
//
bar.Clean();
//
return result;
}
bool IsBearishPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsTrendBearish(barIndex) &&
kiParser.IsRSIBearish(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsPinnedBar(bar, dir) &&
IsXBearish(dir);
//
bar.Clean();
//
return result;
}
bool IsBullishBreakoutPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsBullishBreakout(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsMomentumBar(bar, dir) &&
IsXBullish(dir);
//
bar.Clean();
//
return result;
}
bool IsBearishBreakoutPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsBearishBreakout(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsMomentumBar(bar, dir) &&
IsXBearish(dir);
//
bar.Clean();
//
return result;
}
bool IsBullishReversalPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsBullishReversal(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsStarPattern(bar, dir) &&
IsXBullish(dir);
//
bar.Clean();
//
return result;
}
bool IsBearishReversalPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsBearishReversal(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsStarPattern(bar, dir) &&
IsXBearish(dir);
//
bar.Clean();
//
return result;
}
bool IsBullishContinuationPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsTrendStrongBullish(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
XOHCL swingBar;
result = result &&
IsFlagPattern(bar, dir, swingBar) &&
IsXBullish(dir);
//
bar.Clean();
swingBar.Clean();
//
return result;
}
bool IsBearishContinuationPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsTrendStrongBearish(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
XOHCL swingBar;
result = result &&
IsFlagPattern(bar, dir, swingBar) &&
IsXBearish(dir);
//
bar.Clean();
swingBar.Clean();
//
return result;
}
bool IsBullishExhaustionPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsTrendStrongBullish(barIndex) &&
kiParser.IsRSIOverbought(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsPiercingPattern(bar, dir) &&
IsXBullish(dir);
//
bar.Clean();
//
return result;
}
bool IsBearishExhaustionPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsTrendStrongBearish(barIndex) &&
kiParser.IsRSIOversold(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsPiercingPattern(bar, dir) &&
IsXBearish(dir);
//
bar.Clean();
//
return result;
}
bool IsBullishTrendExhaustedPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsTrendStrongBullish(barIndex) &&
kiParser.IsVolatilityLow(barIndex, 20) &&
kiParser.IsRSIOverbought(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsPiercingPattern(bar, dir) &&
IsXBullish(dir);
//
bar.Clean();
//
return result;
}
bool IsBearishTrendExhaustedPOI(int barIndex = 0)
{
//
bool result = false;
//
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
result = kiParser.IsTrendStrongBearish(barIndex) &&
kiParser.IsVolatilityLow(barIndex, 20) &&
kiParser.IsRSIOversold(barIndex);
if (!result)
{
return result;
}
//
// Add candlestick confirmation ...
XOHCL bar;
ENUM_X_DIRECTION dir;
result = result &&
bar.Init(symbol, period, barIndex);
if (!result)
{
return result;
}
//
result = result &&
IsPiercingPattern(bar, dir) &&
IsXBearish(dir);
//
bar.Clean();
//
return result;
}
// #endregion
// #region XDetectors ...
bool IsKISignal(
ENUM_X_DIRECTION &dir, //
int barIndex = 0 //
)
{
//
bool result = false;
//
dir = X_DIRECTION_NONE;
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
// Retrieve KI State ...
bool isBullish = kiParser.IsKIFastSwitchedToBullish(barIndex + 1) &&
kiParser.IsKIFastBullish(barIndex) &&
kiParser.IsKISlowBullish(barIndex);
bool isBearish = kiParser.IsKIFastSwitchedToBearish(barIndex + 1) &&
kiParser.IsKIFastBearish(barIndex) &&
kiParser.IsKISlowBearish(barIndex);
result = isBullish ||
isBearish;
if (!result)
{
return result;
}
//
dir = isBullish
? X_DIRECTION_BULLISH
: isBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
result = HasDirection(dir);
if (!result)
{
return result;
}
//
XOHCL bar;
result = bar.Init(symbol, period, barIndex + 1);
if (!result)
{
return result;
}
//
// Bar Direction Same as Dir ...
//
// Price Place Check ...
double kiFast = kiHelper.GetKIFast(barIndex + 1);
double kiSlow = kiHelper.GetKISlow(barIndex + 1);
isBullish =
isBullish &&
bar.close > kiFast &&
kiFast > kiSlow &&
(kiParser.IsKIFastOverLast(barIndex + 1) ||
kiParser.IsKISlowOverLast(barIndex + 1));
isBearish =
isBearish &&
bar.close < kiFast &&
kiFast < kiSlow &&
(kiParser.IsKIFastUnderLast(barIndex + 1) ||
kiParser.IsKISlowUnderLast(barIndex + 1));
//
result =
result &&
(isBullish ||
isBearish);
//
// Cleanup Resources ...
bar.Clean();
//
return result;
}
// #endregion
//
// Others ...
/**
* Destroy ...
*/
void Destroy()
{
//
delete barAnalyser;
ZeroMemory(barAnalyser);
//
ZeroMemory(kiHelper);
ZeroMemory(kiParser);
}
//
// Testers ...
//
// Protected ...
protected:
//
// Props ...
//
// Private ...
private:
//
//
};
//
@@ -0,0 +1,707 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class
// -------------------------------------------------
// Name: XCX121XKIPoiDrawer ...
// Description: X121XKI 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 X121XKI POI Drawer Class"
#property strict
//
// Imports ...
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
//
// Implementation ...
class XCX121XKIPOIDrawer : public XCPOIDrawer
{
//
public:
//
// Props ...
//
// Tested Zones ...
color testedBullishColor;
color testedBearishColor;
//
// Breaked Zones ...
color breakedBullishColor;
color breakedBearishColor;
//
// FakeBreaked Zones ...
color fakeBreakedBullishColor;
color fakeBreakedBearishColor;
//
// Constructor ...
XCX121XKIPOIDrawer() : XCPOIDrawer()
{
Default();
}
//
// Deconstructor ...
~XCX121XKIPOIDrawer()
{
}
//
// 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);
}
}
//
};
//