Files
xMQL5/BKPS/14041018/Documents/BKP/test.fima.conditions.mq5
T
2026-01-08 11:39:42 +03:30

296 lines
5.7 KiB
Plaintext

// //
// isBullish =
// //
// // Vales Same ...
// sameVales >= 7 &&
// //
// // PBar Patterns ...
// isBarPatternsPassed &&
// isPBarCloseOverFast &&
// //
// // Validate PullBack based on HK Bond ...
// isPullbackBullish &&
// pBar.close > pHKBondLower;
//
// poiDrawer.DrawPatternAnalysis(
// pBarAnalysis,
// structureDrawConfig.barAnalysisDrawConfig //
// );
// //
// if (IsValidSize(zonesCount))
// {
// //
// poiDrawer.DrawZones(
// zones,
// structureDrawConfig.drawConfig //
// );
// }
// //
// if (IsValidSize(affectedZonesCount))
// {
// //
// poiDrawer.DrawZones(
// affectedZones,
// structureDrawConfig.drawConfig //
// );
// }
//
// poiDrawer.DrawZones(
// affectedZonesBullish,
// structureDrawConfig.drawConfig //
// );
// //
// poiDrawer.DrawZones(
// affectedZonesBearish,
// structureDrawConfig.drawConfig //
// );
// //
// // Update POI Zones ...
// ENUM_X_DETECTOR_ZONE_ACTION zoneActions[];
// poiDetector.UpdateZones(
// iBar,
// zoneActions //
// // Validation Length ...
// // Required Zones ...
// // Loopback ...
// );
//
// Retrieve Conditions ...
// conditions.Clean();
// has = fimaHelper.GetConditions(
// conditions,
// barIndex,
// 10 // Loopback ...
// );
// if (!has)
// {
// //
// iBar.Clean();
// conditions.Clean();
// //
// return;
// }
//
// structure.Clean();
// poiDetector.AnalyseMarket(
// structure,
// structureConfig,
// barIndex //
// );
// poiDrawer.drawnObjects.Clear();
// poiDrawer.DrawMarketStructure(
// structure,
// structureDrawConfig //
// );
/**
* Check Bar Has Signal Based on Strategy X ...
*
* @param bar: XOHCL, reference to Bar ...
* @param zone: XBoxZone, reference to holds affected zone ...
* @param targets: XTarget, reference to detected Signal's Targets collections ...
* @param dir: ENUM_X_DIRECTION, detected Signal's direction ...
*
* @return ( bool )
*/
bool StrategyXHasSignal(
XOHCL &bar,
XBoxZone &zone,
XTarget &targets[],
ENUM_X_DIRECTION &dir //
)
{
//
bool result = false;
//
// Prepare ...
zone.Clean();
XClean(targets);
dir = X_DIRECTION_NONE;
//
// Validate ...
result = bar.IsValid();
if (!result)
{
return result;
}
//
// Define Requirements ...
//
XOHCL pBar;
XOHCL p2Bar;
bool isBullish = false;
bool isBearish = false;
XOHCL continuationalBar;
XBoxZone continuationalZones[];
//
// Read PBar ...
result = bar.GetPreviousBar(pBar);
result = result &&
pBar.GetPreviousBar(p2Bar);
if (!result)
{
//
pBar.Clean();
p2Bar.Clean();
//
return result;
}
//
// Reading pBar Patterns ...
XPatternAnalysis pBarAnalysis;
poiDetector.AnalyseBarPatterns(
pBar,
pBarAnalysis,
structureConfig.barsAnalysisConfig //
);
//
// Check Continuational Pullback ...
bool isContinuationPullBack = poiDetector.IsContinuationPullbackPattern(
pBar,
zone,
continuationalZones,
dir,
continuationalBar,
3, // Continuational Length ...
true, // Force Continuational Loopback Has Zones ...
true, // Force Continuational Loopback Has Patterns ...
2, // Pullback Length ...
false // Force Pullback Break ...
);
//
// Do ...
//
isBullish =
//
IsXBullish(dir) &&
isContinuationPullBack &&
continuationalBar.GetUp() < pBar.GetDown() &&
true
// isPBarHasBullishPatterns
//
;
//
isBearish =
//
IsXBearish(dir) &&
isContinuationPullBack &&
continuationalBar.GetDown() > pBar.GetUp() &&
true
// isPBarHasBearishPatterns
//
;
//
// Validate ...
result = isBullish ||
isBearish;
if (result)
{
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
result = HasDirection(dir);
}
//
// Prepare Zone ...
if (result)
{
//
// zone.to = bar.time;
// poiDrawer.DrawZone(zone, structureDrawConfig.drawConfig);
//
// Draw Continuational Zones ...
UpdateToTime(continuationalZones, bar.time);
poiDrawer.DrawZones(continuationalZones, structureDrawConfig.drawConfig);
//
zone.Clean();
//
int idx = -1;
if (isBullish)
{
idx = GetHighestBelow(bar.GetDown(), continuationalZones);
}
else
{
idx = GetLowestAbove(bar.GetUp(), continuationalZones);
}
result = IsValidIndex(idx);
if (result)
{
zone = continuationalZones[idx];
}
//
if (zone.IsValid())
{
//
XPOIDrawConfig iConfig = structureDrawConfig.drawConfig;
iConfig.bullishColor = clrYellow;
iConfig.bearishColor = clrYellow;
poiDrawer.DrawZones(continuationalZones, iConfig);
}
//
// Manage Stops ...
if (result)
{
}
//
result = zone.IsValid();
}
//
// Prepare Targets ...
if (result)
{
}
//
// Cleanup ...
if (!result)
{
//
zone.Clean();
XClean(targets);
dir = X_DIRECTION_NONE;
}
pBar.Clean();
p2Bar.Clean();
continuationalBar.Clean();
XClean(continuationalZones);
//
return result;
}