This commit is contained in:
2025-10-08 18:47:29 +03:30
parent 96972931a7
commit d963ce8acf
10 changed files with 6108 additions and 3372 deletions
@@ -2303,10 +2303,286 @@ struct XPatternAnalysis
//
};
struct XPatternAnalysisConfig
{
//
// Props ...
//
// PV ...
int pvValidationLength;
ENUM_X_PRICE peakPriceType;
ENUM_X_PRICE valePriceType;
//
// Momentum ...
int momentumBarValidationLength;
double momentumBarApprovedMultiplier;
//
// TrueGap ...
double trueGapApprovedStrength;
//
// Pin ...
double pinBarShadowApprovedMultiplier;
double pinBarRangeMultiplier;
bool pinBarForceDirection;
//
// Flag ...
int flagPatternPullbackLength;
//
// FVG ...
bool fvgForceType;
//
// OB ...
bool obForceTwoBar;
//
// Support and Resistance ...
int supportAndResistanceValidationLength;
int supportAndResistanceLoopbackLength;
//
ENUM_X_DIRECTION allowedDirs[];
ENUM_X_BAR_PATTERN allowedPatterns[];
//
// Constructor ...
XPatternAnalysisConfig()
{
Clean();
}
//
// Tools ...
/**
* Cleanup ...
*/
void Clean()
{
//
// PV ...
pvValidationLength = 0;
peakPriceType = X_PRICE_NONE;
valePriceType = X_PRICE_NONE;
//
// Momentum ...
momentumBarValidationLength = 0;
momentumBarApprovedMultiplier = 0;
//
// TrueGap ...
trueGapApprovedStrength = 0;
//
// Pin ...
pinBarShadowApprovedMultiplier = 0;
pinBarRangeMultiplier = 0;
pinBarForceDirection = false;
//
// Flag ...
flagPatternPullbackLength = 0;
//
// FVG ...
fvgForceType = false;
//
// OB ...
obForceTwoBar = false;
//
// Support and Resistance ...
supportAndResistanceValidationLength = 0;
supportAndResistanceLoopbackLength = 0;
//
XClean(allowedDirs);
XClean(allowedPatterns);
//
ZeroMemory(this);
}
/**
* Default Configurations ...
*/
void Default()
{
//
// PV ...
pvValidationLength = 7;
peakPriceType = X_PRICE_HIGH;
valePriceType = X_PRICE_LOW;
//
// Momentum ...
momentumBarValidationLength = 3;
momentumBarApprovedMultiplier = 3;
//
// TrueGap ...
trueGapApprovedStrength = 1;
//
// Pin ...
pinBarShadowApprovedMultiplier = 3;
pinBarRangeMultiplier = 4;
pinBarForceDirection = false;
//
// Flag ...
flagPatternPullbackLength = 3;
//
// FVG ...
fvgForceType = false;
//
// OB ...
obForceTwoBar = false;
//
// Support and Resistance ...
supportAndResistanceValidationLength = 21;
supportAndResistanceLoopbackLength = 50;
}
//
// Permissions ...
/**
* Check Specified Patterns Detection is Allowed or not ...
*
* @param pattern: ENUM_X_BAR_PATTERN, Specified Pattern to Detect ...
* @param patternDir: ENUM_X_DIRECTION, which Pattern Direction to Detect ...
*
* @return ( bool )
*/
bool CanDetect(
ENUM_X_BAR_PATTERN pattern,
ENUM_X_DIRECTION patternDir = X_DIRECTION_NONE //
)
{
//
bool result = false;
//
// Validate Pattern and
// Check Pattern Exists ...
result = IsXValid(pattern) &&
HasChild(allowedPatterns) &&
Contains(pattern, allowedPatterns);
if (!result)
{
return result;
}
//
// Now Check Direction ...
int index = FindIndex(pattern, allowedPatterns);
result = IsValidIndex(index) &&
HasChild(allowedDirs) &&
(!HasDirection(patternDir)
? !HasDirection(allowedDirs[index])
: (!HasDirection(allowedDirs[index]) ||
patternDir == allowedDirs[index]));
//
return result;
}
//
// Collection Manipulations ...
/**
* Full Detect Patterns ...
*
* @param forDir: ENUM_X_DIRECTION, which Pattern Direction to Detect ...
*/
void FullPattern(
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int count = GetAllBarPatters(allowedPatterns);
for (int i = 0; i < count; i++)
{
//
Add(
forDir,
allowedDirs //
);
}
}
/**
* Add Specified Pattern to Detecte ...
*
* @param pattern: ENUM_X_BAR_PATTERN, Specified Pattern to Detect ...
* @param patternDir: ENUM_X_DIRECTION, which Pattern Direction to Detect ...
*/
void AddPattern(
ENUM_X_BAR_PATTERN pattern,
ENUM_X_DIRECTION patternDir = X_DIRECTION_NONE //
)
{
//
bool has = IsXValid(pattern);
if (!has)
{
return;
}
//
Add(
pattern,
allowedPatterns //
);
//
Add(
patternDir,
allowedDirs //
);
}
//
};
struct XPatternAnalysisDrawConfig
{
//
// Props ...
//
int zonesWidth;
bool fillZones;
int arrowsWidth;
bool ignoreZonesAt;
int arrowsThreshold;
ENUM_LINE_STYLE zonesStyle;
//
int bullishArrow;
int bearishArrow;
//
color bullishColor;
color bearishColor;
//
ENUM_X_PRICE arrowValePriceType;
ENUM_X_PRICE arrowPeakPriceType;
//
ENUM_X_BAR_PATTERN allowedDraws[]; // Allowed Draw Patterns
ENUM_X_BAR_PATTERN allowedDrawZones[]; // Allowed Draw Pattern Zones
ENUM_X_BAR_PATTERN allowedDrawPivots[]; // Allowed Draw Pattern Pivots
@@ -2326,6 +2602,20 @@ struct XPatternAnalysisDrawConfig
*/
void Clean()
{
//
arrowsWidth = 0;
zonesWidth = 0;
bullishArrow = 0;
bearishArrow = 0;
fillZones = false;
arrowsThreshold = 0;
ignoreZonesAt = false;
bullishColor = CLR_NONE;
bearishColor = CLR_NONE;
zonesStyle = STYLE_SOLID;
arrowValePriceType = X_PRICE_NONE;
arrowPeakPriceType = X_PRICE_NONE;
//
XClean(allowedDraws);
XClean(allowedDrawZones);
@@ -2337,6 +2627,20 @@ struct XPatternAnalysisDrawConfig
*/
void Default()
{
//
zonesWidth = 1;
arrowsWidth = 1;
arrowsThreshold = 2;
bullishArrow = 159;
bearishArrow = 159;
fillZones = false;
ignoreZonesAt = true;
bullishColor = clrAqua;
zonesStyle = STYLE_SOLID;
bearishColor = clrMagenta;
arrowValePriceType = X_PRICE_LOW;
arrowPeakPriceType = X_PRICE_HIGH;
//
FullDraw();