diff --git a/Classes/x-saherelm.x-poi.drawer.class.mq5 b/Classes/x-saherelm.x-poi.drawer.class.mq5 index 42b4ad45..de39646d 100644 --- a/Classes/x-saherelm.x-poi.drawer.class.mq5 +++ b/Classes/x-saherelm.x-poi.drawer.class.mq5 @@ -257,7 +257,8 @@ class XCPOIDrawer : public XCBase int width = 3, ENUM_ARROW_ANCHOR anchor = ANCHOR_BOTTOM, string name = NULL, - bool ignoreBarTag = true // + bool ignoreBarTag = true, + int threshold = 5 // ) { // @@ -300,7 +301,8 @@ class XCPOIDrawer : public XCBase window, arrow, bar, - priceType // + priceType, + threshold // ); if (result) { diff --git a/Experts/x-saherelm.xfima.backtester.ea.mq5 b/Experts/x-saherelm.xfima.backtester.ea.mq5 index 421d808a..b71c8d57 100644 --- a/Experts/x-saherelm.xfima.backtester.ea.mq5 +++ b/Experts/x-saherelm.xfima.backtester.ea.mq5 @@ -264,8 +264,6 @@ int OnInit() // This is Default Configuration ... fimaInputs.Default(); fimaInputs.Hide(); - fimaInputs.showPV = true; - fimaInputs.showZigZag = true; // // Here we Attach Inputs to Indicator ... @@ -840,7 +838,7 @@ void AnalyseMarket(int barIndex = 0) detectorConfig.analyseFIMAPVPivots = true; detectorConfig.analyseFIMAMAPivots = false; detectorConfig.analyseFIMASARPivots = false; - detectorConfig.analyseFIMAZigZagPivots = false; + detectorConfig.analyseFIMAZigZagPivots = true; // // Configure Drawer ... @@ -850,7 +848,7 @@ void AnalyseMarket(int barIndex = 0) marketStructureDrawerConfig.drawFVG = false; // - marketStructureDrawerConfig.drawPinned = true; + marketStructureDrawerConfig.drawPinned = false; marketStructureDrawerConfig.drawEngulfed = true; marketStructureDrawerConfig.drawTrueGaped = false; marketStructureDrawerConfig.drawMomentum = false; @@ -863,13 +861,13 @@ void AnalyseMarket(int barIndex = 0) // // Recents ... marketStructureDrawerConfig.drawRecentPatterns = false; - marketStructureDrawerConfig.drawFakeBreakedZone = true; + marketStructureDrawerConfig.drawFakeBreakedZone = false; marketStructureDrawerConfig.drawRecentlyTestedZones = false; marketStructureDrawerConfig.drawRecentlyBreakedZones = false; // // XPV ... - marketStructureDrawerConfig.drawFIMAPVPivotsAnalysis = false; + marketStructureDrawerConfig.drawFIMAPVPivotsAnalysis = true; marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisZones = true; marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisTrends = true; marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisPivots = true; @@ -890,8 +888,8 @@ void AnalyseMarket(int barIndex = 0) // // XZigZag ... - marketStructureDrawerConfig.drawFIMAZigZagPivotsAnalysis = false; - marketStructureDrawerConfig.drawFIMAZigZagPivotsAnalysisZones = false; + marketStructureDrawerConfig.drawFIMAZigZagPivotsAnalysis = true; + marketStructureDrawerConfig.drawFIMAZigZagPivotsAnalysisZones = true; marketStructureDrawerConfig.drawFIMAZigZagPivotsAnalysisTrends = false; marketStructureDrawerConfig.drawFIMAZigZagPivotsAnalysisPivots = false; @@ -904,7 +902,8 @@ void AnalyseMarket(int barIndex = 0) ); // - if (marketStructureObjects == NULL) { + if (marketStructureObjects == NULL) + { marketStructureObjects = new CArrayObj(); } @@ -916,11 +915,11 @@ void AnalyseMarket(int barIndex = 0) // // Draw Market Structure ... - int marketStructureObjectsCount = fima2Signaller.poiDrawer.DrawMarketStructure( - marketStructure, - marketStructureDrawerConfig, - marketStructureObjects // - ); + // int marketStructureObjectsCount = fima2Signaller.poiDrawer.DrawMarketStructure( + // marketStructure, + // marketStructureDrawerConfig, + // marketStructureObjects // + // ); // if (IsValidIndex(marketStructureObjectsCount)) // { // // @@ -931,8 +930,107 @@ void AnalyseMarket(int barIndex = 0) // // ); // } + // + HandleSignalLookup(bar); + // bar.Clean(); } +// +// Handle Signal Looking Up ... +void HandleSignalLookup(XOHCL &bar) +{ + // + bool has = + bar.IsValid(); + if (!has) + { + return; + } + + // + string iName = NULL; + bool isBullish = false; + int barIndex = bar.Index(); + double iPrice = EMPTY_VALUE; + ENUM_X_PRICE iPriceType = X_PRICE_NONE; + ENUM_X_DIRECTION iDir = X_DIRECTION_NONE; + + // + // Check Required Pattern Exists ... + bool hasEngulfedBar = HasDirection(marketStructure.engulfedDir); + bool hasSignalKeyBar = HasDirection(marketStructure.signalKeyBarPatternDir); + + // + // Selecting Price Type of Bar based on Dir ... + has = hasEngulfedBar || + hasSignalKeyBar; + if (has) + { + // + // Retrieve Direction ... + if (hasEngulfedBar) + { + // + iDir = marketStructure.engulfedDir; + iName = "XEngulf_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time)); + } + else + { + iDir = marketStructure.signalKeyBarPatternDir; + iName = "XEngulf_" + ToXString(iDir) + ToXString(TimeToSeconds(bar.time)); + } + + // + isBullish = IsSpecifiedBullish(iDir); + + // + // Retrieve Price Type for Validate ... + iPriceType = isBullish + ? X_PRICE_LOW + : X_PRICE_HIGH; + iPrice = bar.GetPrice(iPriceType); + + // + // Retrieve MA Band for Validation ... + double iMABandUpper = fima2Signaller.fimaHelper.GetMABandUpper(barIndex); + double iMABandLower = fima2Signaller.fimaHelper.GetMABandLower(barIndex); + + // + // Validate ... + has = isBullish + ? iPrice < iMABandLower + : iPrice > iMABandUpper; + if (has) + { + // + int iWidth = 1; + int iCode = 159; + color iClr = isBullish + ? clrYellow + : clrDarkOrange; + ENUM_ARROW_ANCHOR iAnchor = isBullish + ? ANCHOR_TOP + : ANCHOR_BOTTOM; + XCBarArrowObject *iObj; + has = fima2Signaller.poiDrawer.DrawBarArrow( + bar, + iObj, + iPriceType, + iCode, + iClr, + iWidth, + iAnchor, + iName, + true, // Ignore Bar Tag ... + 10 // Threshold ... + ); + + // + Print("Detect a Potential Place for Price Movement: ", ToXString(iDir), ", Time: ", bar.time); + } + } +} + // \ No newline at end of file diff --git a/XFIMAEA/Classes/x-saherelm.xfima.x-poi.drawer.class.mq5 b/XFIMAEA/Classes/x-saherelm.xfima.x-poi.drawer.class.mq5 index 27a8276c..4e04321b 100644 --- a/XFIMAEA/Classes/x-saherelm.xfima.x-poi.drawer.class.mq5 +++ b/XFIMAEA/Classes/x-saherelm.xfima.x-poi.drawer.class.mq5 @@ -299,7 +299,7 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer ); // - style.width = 3; + style.width = 2; style.style = STYLE_DASH; // @@ -414,7 +414,7 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer // // Prepare ... arrowCode = 159; - arrowWidth = 3; + arrowWidth = 2; arrowColor = CLR_NONE; arrowAnchor = ANCHOR_BOTTOM; arrowPriceType = X_PRICE_CLOSE;