last works ...

This commit is contained in:
2025-09-27 19:49:17 +03:30
parent 21ce1ebf4f
commit 0d32543974
9 changed files with 1307 additions and 153 deletions
@@ -1227,6 +1227,40 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
);
}
//
// Supports ...
if (config.detectSupport)
{
//
Copy(
supports,
structure.supports //
);
Sort(
structure.supports,
iSortBy,
iSortDir,
config.recentlyPatternsMaxAllowedCollecting //
);
}
//
// Resistances ...
if (config.detectResistance)
{
//
Copy(
resistances,
structure.resistances //
);
Sort(
structure.resistances,
iSortBy,
iSortDir,
config.recentlyPatternsMaxAllowedCollecting //
);
}
//
// Loop through Items ...
for (int i = start; i < end; i++)
@@ -1312,7 +1346,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
iPrefix = "TruGapedBar";
has = IsTrueGapedBar(
forBar,
iBar,
iDir,
config.truwGapApprovedPointMultiplier //
);
@@ -1341,7 +1375,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
iPrefix = "PinBar";
has = IsPinnedBar(
forBar,
iBar,
iDir,
config.pinnedBaarShadowApprovedMultiplier,
config.pinnedBarMinimumPinBarRangeMultiplier,
@@ -1375,12 +1409,12 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
iPrefix = "Star";
has = IsStartPattern(
forBar,
iBar,
iDir //
);
has = has &&
ToBox(
forBar,
iBar,
iBox,
iDir,
iPrefix //
@@ -1403,12 +1437,12 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
iPrefix = "Piercing";
has = IsPiercingPattern(
forBar,
iBar,
iDir //
);
has = has &&
ToBox(
forBar,
iBar,
iBox,
iDir,
iPrefix //
@@ -1431,12 +1465,12 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
iPrefix = "Rising";
has = IsRisingPattern(
forBar,
iBar,
iDir //
);
has = has &&
ToBox(
forBar,
iBar,
iBox,
iDir,
iPrefix //
@@ -1460,14 +1494,14 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
iPrefix = "Flag";
XOHCL swingBar;
has = IsFlagPattern(
forBar,
iBar,
iDir,
swingBar,
config.flagPatternMinimumPullbackBars //
);
has = has &&
ToBox(
forBar,
iBar,
iBox,
iDir,
iPrefix //
@@ -1490,7 +1524,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
iPrefix = "SignalKeyBar";
has = IsSignalKeyBarPattern(
forBar,
iBar,
iDir,
config.signalKeyBarShadowApprovedMultiplier,
config.signalKeyBarMinimumPinBarRangeMultiplier,
@@ -1498,7 +1532,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
);
has = has &&
ToBox(
forBar,
iBar,
iBox,
iDir,
iPrefix //
@@ -230,6 +230,82 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
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 = 3;
style.style = STYLE_DASH;
//
return result;
}
/**
* Get Breaked Zone Style ...
*
@@ -450,6 +526,182 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
);
}
/**
* 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 ...
*
@@ -477,7 +729,7 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
//
// Prepare ...
objects.Clear();
// objects.Clear();
//
int count = 0;
@@ -556,7 +808,7 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
//
// Support ...
if (config.drawSupports)
if (config.drawSupport)
{
//
// Validate ...
@@ -1173,13 +1425,145 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
// 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))
{
//
// TODO: Complete this ...
count = DrawPivots(
structure.pinBars,
patternObjects,
baseArrowCode,
baseArrowCode //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPivotsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
@@ -1188,7 +1572,27 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.engulfBars))
{
//
// TODO: Complete this ...
count = DrawPivots(
structure.engulfBars,
patternObjects,
baseArrowCode,
baseArrowCode //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPivotsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
@@ -1197,16 +1601,56 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.trueGapBars))
{
//
// TODO: Complete this ...
count = DrawPivots(
structure.trueGapBars,
patternObjects,
baseArrowCode,
baseArrowCode //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPivotsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
// TrueGap Bars ...
// Momentum Bars ...
if (config.drawMomentum &&
HasChild(structure.momentumBars))
{
//
// TODO: Complete this ...
count = DrawPivots(
structure.momentumBars,
patternObjects,
baseArrowCode,
baseArrowCode //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPivotsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
@@ -1215,7 +1659,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.flagPatterns))
{
//
// TODO: Complete this ...
count = DrawBoxes(
structure.flagPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
@@ -1224,7 +1686,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.starPatterns))
{
//
// TODO: Complete this ...
count = DrawBoxes(
structure.starPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
@@ -1233,7 +1713,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.risingPatterns))
{
//
// TODO: Complete this ...
count = DrawBoxes(
structure.risingPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
@@ -1242,7 +1740,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.piercingPatterns))
{
//
// TODO: Complete this ...
count = DrawBoxes(
structure.piercingPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
@@ -1251,7 +1767,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.signalKeyBarPatterns))
{
//
// TODO: Complete this ...
count = DrawBoxes(
structure.signalKeyBarPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
}
+17 -13
View File
@@ -383,6 +383,8 @@ struct XFIMAMarketStructure
//
XBoxZone obs[];
XBoxZone fvgs[];
XBoxZone supports[];
XBoxZone resistances[];
//
XPivot pinBars[];
@@ -485,7 +487,9 @@ struct XFIMAMarketStructure
SpecifiedClean(obs);
SpecifiedClean(fvgs);
SpecifiedClean(pinBars);
SpecifiedClean(supports);
SpecifiedClean(engulfBars);
SpecifiedClean(resistances);
SpecifiedClean(trueGapBars);
SpecifiedClean(momentumBars);
SpecifiedClean(flagPatterns);
@@ -518,21 +522,21 @@ struct XFIMAMarketStructureDrawerConfig
// Props ...
//
bool drawOB; // Current Order Block ...
bool drawOB; // Current Order Block ...
bool drawFVG; // Current Fair Value Gap ...
//
bool drawSupports; // Detected Supports ...
bool drawSupport; // Detected Supports ...
bool drawResistance; // Detected Resistances ...
//
bool drawSwingTrend; // Swing Trend ...
bool swingTrendRayLeft; // Ray Left Swing Trend ...
bool drawSwingTrend; // Swing Trend ...
bool swingTrendRayLeft; // Ray Left Swing Trend ...
bool swingTrendRayRight; // Ray Right Swing Trend ...
//
// Draw Current Detected Patterns ...
//
bool drawPinned;
bool drawMomentum;
@@ -540,11 +544,11 @@ struct XFIMAMarketStructureDrawerConfig
bool drawTrueGaped;
//
bool drawStarPattern;
bool drawFlagPattern;
bool drawRisingPattern;
bool drawPiercingPattern;
bool drawSignalKeyBarPattern;
bool drawStarPattern;
bool drawFlagPattern;
bool drawRisingPattern;
bool drawPiercingPattern;
bool drawSignalKeyBarPattern;
//
// Draw Recently Zones ...
@@ -604,7 +608,7 @@ struct XFIMAMarketStructureDrawerConfig
drawFVG = false;
drawPinned = false;
drawMomentum = false;
drawSupports = false;
drawSupport = false;
drawEngulfed = false;
drawTrueGaped = false;
drawResistance = false;
@@ -660,7 +664,7 @@ struct XFIMAMarketStructureDrawerConfig
drawFVG = true;
drawPinned = true;
drawMomentum = true;
drawSupports = true;
drawSupport = true;
drawEngulfed = true;
drawTrueGaped = true;
drawResistance = true;
@@ -717,7 +721,7 @@ struct XFIMAMarketStructureDrawerConfig
drawFVG = true;
drawPinned = true;
drawMomentum = true;
drawSupports = true;
drawSupport = true;
drawEngulfed = true;
drawTrueGaped = true;
drawResistance = true;