well tested truge detecting ...

This commit is contained in:
2025-09-24 14:32:49 +03:30
parent 4b161771f2
commit e2b05b6455
4 changed files with 736 additions and 6 deletions
+5 -1
View File
@@ -285,7 +285,7 @@ class XCPOIDrawer : public XCBase
(IsValid(prefix)
? prefix + "_"
: prefix) +
barTag;
ToMD5(barTag);
//
object = new XCBarArrowObject();
@@ -784,6 +784,10 @@ class XCPOIDrawer : public XCBase
//
bool result = false;
//
// Prepare ...
object = NULL;
//
int count = ArraySize(swings);
result = HasChild(swings) &&
+25 -4
View File
@@ -147,8 +147,9 @@ XCXFIMAStrategy1Signaller *fima1Signaller; // XFIMA1 Signaller ...
XCXFIMAStrategy2Signaller *fima2Signaller; // XFIMA2 Signaller ...
//
XFIMAMarketStructure marketStructure; // POI Analysis Result ...
XFIMAPatternDetectorConfig detectorConfig; // POI Detector Config ...
XFIMAMarketStructure marketStructure; // POI Analysis Result ...
XFIMAPatternDetectorConfig detectorConfig; // POI Detector Config ...
XFIMAMarketStructureDrawerConfig marketStructureDrawerConfig; // POI Drawer Config ...
//
// Drawer and eaDraws ...
@@ -383,8 +384,10 @@ int OnInit()
}
//
// Configure XFIMA POI Detector ...
detectorConfig.Default();
// Configure XFIMA POI Detector / Drawer ...
detectorConfig.Clean();
detectorConfig.detectTrueGaped = true;
marketStructureDrawerConfig.FullDraw();
//
Print(ShortName, ": Initialized Successfully ...");
@@ -469,6 +472,24 @@ void OnTick()
marketStructure,
detectorConfig //
);
CArrayObj *iObjects;
int drawnsCount = fima2Signaller.poiDrawer.DrawMarketStructure(
marketStructure,
marketStructureDrawerConfig,
iObjects //
);
if (IsValidSize(drawnsCount))
{
//
AddObjects(
iObjects,
eaDraws //
);
}
if (HasDirection(marketStructure.trueGapedDir))
{
Print("true gap detected ...");
}
}
//
@@ -33,110 +33,740 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
public:
//
void DrawMarketStructure(
//
// 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;
}
/**
* 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 = 3;
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);
}
}
int DrawMarketStructure(
XFIMAMarketStructure &structure,
XFIMAMarketStructureDrawerConfig &config,
CArrayObj *&objects //
)
{
//
int result = 0;
//
// Normalize ...
if (objects == NULL)
{
objects = new CArrayObj();
}
//
// Prepare ...
objects.Clear();
//
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.drawSupports)
{
//
// 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, //
true, // Ray Right ...
false // 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.drawFIMAPVPivotsAnalysisPivots,
bearArrowCode,
bullArrowCode //
);
if (has)
{
objects.Add(iObj);
}
}
}
//
// XFIMA MA Analysis ...
if (config.drawFIMAMAPivotsAnalysis)
{
//
// Validate ...
has = structure.maAnalysis.IsValid();
if (has)
{
//
XCPivotAnalysisObject *iObj;
has = DrawPivotAnalysis(
structure.pvAnalysis,
iObj,
config.drawFIMAMAPivotsAnalysisPivots,
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.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.drawFIMAZigZagPivotsAnalysisPivots,
bearArrowCode,
bullArrowCode //
);
if (has)
{
objects.Add(iObj);
}
}
}
//
result = objects.Total();
//
return result;
}
//
@@ -264,6 +264,48 @@ struct XFIMAPatternDetectorConfig
maxAllowedLoopbackLengthForAnalysis = 1500;
}
/**
* Full Detection Model ...
*/
void FullDetect()
{
//
Default();
//
// OB / FVG ...
detectOB = true;
detectFVG = true;
//
// Support and Resistances ...
detectSupports = true;
detectResistance = true;
detectSwingTrend = true;
//
// Patterns ...
detectStarPattern = true;
detectFlagPattern = true;
detectRisingPattern = true;
detectPiercingPattern = true;
detectSignalKeyBarPattern = true;
//
// Bars ...
detectPinned = true;
detectMomentum = true;
detectEngulfed = true;
detectTrueGaped = true;
//
// Analysers ...
analyseFIMAPVPivots = true;
analyseFIMAMAPivots = true;
analyseFIMASARPivots = true;
analyseFIMAZigZagPivots = true;
}
//
};
@@ -479,5 +521,38 @@ struct XFIMAMarketStructureDrawerConfig
drawFIMAZigZagPivotsAnalysisPivots = false;
}
/**
* Configure for Full Drawing ...
*/
void FullDraw()
{
//
Default();
//
drawOB = true;
drawFVG = true;
drawPinned = true;
drawMomentum = true;
drawSupports = true;
drawEngulfed = true;
drawTrueGaped = true;
drawResistance = true;
drawSwingTrend = true;
drawStarPattern = true;
drawFlagPattern = true;
drawRisingPattern = true;
drawPiercingPattern = true;
drawSignalKeyBarPattern = true;
drawFIMAPVPivotsAnalysis = true;
drawFIMAMAPivotsAnalysis = true;
drawFIMASARPivotsAnalysis = true;
drawFIMAZigZagPivotsAnalysis = true;
drawFIMAPVPivotsAnalysisPivots = true;
drawFIMAMAPivotsAnalysisPivots = true;
drawFIMASARPivotsAnalysisPivots = true;
drawFIMAZigZagPivotsAnalysisPivots = true;
}
//
};