From 587d2088239c1216f74ddc8638c8c894768bc61b Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 19 May 2025 19:19:33 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x-bar.analyser.class.mq5 | 401 +++++++- Experts/test.mq5 | 976 +++++--------------- Helpers/x-saherelm.x121.x3ma.helper.mq5 | 10 + Helpers/x-saherelm.x121.xca.helper.mq5 | 30 + Helpers/x-saherelm.x121.xcc.helper.mq5 | 9 +- Helpers/x-saherelm.x121.xct.helper.mq5 | 9 +- Libraries/x-saherelm.x-poi.lib.mq5 | 40 + XCAEA/Helpers/xcaea.helper.mq5 | 11 + 8 files changed, 707 insertions(+), 779 deletions(-) diff --git a/Classes/x-saherelm.x-bar.analyser.class.mq5 b/Classes/x-saherelm.x-bar.analyser.class.mq5 index a089b1a3..e82603b4 100644 --- a/Classes/x-saherelm.x-bar.analyser.class.mq5 +++ b/Classes/x-saherelm.x-bar.analyser.class.mq5 @@ -2043,9 +2043,17 @@ class XCBarAnalyser : public XCBase bool IsTrigger( XOHCL &bar, XBoxZone &box, + XBoxZone &ob, + XBoxZone &fvg, + XBoxZone &liquidity, + XOHCL &swingBar, + int loopback = 10, + bool forceLiquidity = true, + bool forceLiquidityUsed = true, + bool forceEntryBar = true, + bool forceEntryBarPower = true, bool forceFVGBarType = false, - bool forceOBTwoBar = false, // - int loopback = 5 // + bool forceOBTwoBar = false // ) { // @@ -2053,7 +2061,11 @@ class XCBarAnalyser : public XCBase // // Normalize Args ... + ob.Clean(); + fvg.Clean(); box.Clean(); + swingBar.Clean(); + liquidity.Clean(); loopback = NormalizeInt(loopback, 5); // @@ -2070,16 +2082,21 @@ class XCBarAnalyser : public XCBase XOHCL iPBar; int barIndex; int pBarIndex; + ENUM_X_DIRECTION iDir; // result = bar.GetPreviousBar(pBar); if (!result) { // + ob.Clean(); + fvg.Clean(); box.Clean(); pBar.Clean(); iBar.Clean(); iPBar.Clean(); + swingBar.Clean(); + liquidity.Clean(); // return result; @@ -2109,13 +2126,47 @@ class XCBarAnalyser : public XCBase // Detect Block ... result = IsOB( iBar, - box, + ob, forceFVGBarType, forceOBTwoBar // ); if (result) { - break; + // + // Validate Block Last Bars ... + XOHCL fromBar; + XOHCL fromBarPrev; + result = ob.FromBar(fromBar); + result = + result && + fromBar.GetPreviousBar(fromBarPrev); + result = + result && + (ob.IsBullish() + ? fromBarPrev.IsBearish() + : fromBarPrev.IsBullish()); + if (result) + { + // + // Detect FVG ... + result = IsFVG( + iBar, + fvg, + forceFVGBarType // + ); + if (result) + { + // + box.Clone(ob); + box.type = "XTRG"; + box.from = fromBarPrev.time; + break; + } + } + + // + fromBar.Clean(); + fromBarPrev.Clean(); } // @@ -2129,10 +2180,14 @@ class XCBarAnalyser : public XCBase if (!result) { // + ob.Clean(); + fvg.Clean(); box.Clean(); pBar.Clean(); iBar.Clean(); iPBar.Clean(); + swingBar.Clean(); + liquidity.Clean(); // return result; @@ -2146,29 +2201,32 @@ class XCBarAnalyser : public XCBase // // Detect Swing Bar ... - XOHCL swingBar; int swingBarIDX = -1; - int swingLoopback = fromIDX - barIndex; + int swingLoopback = fromIDX - pBarIndex; if (isBullish) { // // Looking for Swing Low ... - swingBarIDX = bar.FindLowestIndex(swingLoopback, MODE_LOW); + swingBarIDX = pBar.FindLowestIndex(swingLoopback, MODE_LOW); } else if (isBearish) { // // Looking for Swing High ... - swingBarIDX = bar.FindLowestIndex(swingLoopback, MODE_LOW); + swingBarIDX = pBar.FindHighestIndex(swingLoopback, MODE_LOW); } result = IsValidIndex(swingBarIDX); if (!result) { // + ob.Clean(); + fvg.Clean(); box.Clean(); + pBar.Clean(); iBar.Clean(); iPBar.Clean(); swingBar.Clean(); + liquidity.Clean(); // return result; @@ -2184,15 +2242,30 @@ class XCBarAnalyser : public XCBase if (!result) { // + ob.Clean(); + fvg.Clean(); box.Clean(); + pBar.Clean(); iBar.Clean(); iPBar.Clean(); swingBar.Clean(); + liquidity.Clean(); // return result; } + // + // Update Trigger Box ... + if (isBullish) + { + box.lower = MathMin(box.lower, swingBar.GetDown()); + } + else if (isBearish) + { + box.upper = MathMin(box.upper, swingBar.GetUp()); + } + // // Now we Have to Check Spike from Swing Bar Next till Current Bar ... // To Validate Highs and Lows ... @@ -2236,32 +2309,338 @@ class XCBarAnalyser : public XCBase } iBar.Clean(); iPBar.Clean(); - - // - // Ensure Spike Happens ... if (!result) { // + ob.Clean(); + fvg.Clean(); box.Clean(); pBar.Clean(); iBar.Clean(); iPBar.Clean(); + swingBar.Clean(); + liquidity.Clean(); // return result; } + // + // We Have to Make sure Bars until Spikes Closed ... + // for Bullish: bars must Close Above box.upper ... + // for Bearish: bars must Close Below box.lower ... + for (int i = pBarIndex; i < toIDX; i++) + { + // + // Initialize iBar ... + result = iBar.Init( + bar.symbol, + bar.period, + i // + ); + result = + result && + (isBullish + ? iBar.close > box.upper + : iBar.close < box.lower); + + // + if (!result) + { + break; + } + + // + iBar.Clean(); + } + iBar.Clean(); + if (!result) + { + // + ob.Clean(); + fvg.Clean(); + box.Clean(); + pBar.Clean(); + iBar.Clean(); + iPBar.Clean(); + swingBar.Clean(); + liquidity.Clean(); + + // + return result; + } + + // + // Now we Have to Detect Spike Breake Ruls ... + // for Bullish: bar.low goes Below of pBar.low ... + // for Bearish: bar.high goes Above of pBar.high ... + if (isBullish) + { + result = bar.low < pBar.low; + } + else if (isBearish) + { + result = bar.high > pBar.high; + } + if (!result) + { + // + ob.Clean(); + fvg.Clean(); + box.Clean(); + pBar.Clean(); + iBar.Clean(); + iPBar.Clean(); + swingBar.Clean(); + liquidity.Clean(); + + // + return result; + } + + // + // Update Box ... + if (isBullish) + { + box.upper = MathMax(box.upper, bar.GetDown()); + } + else if (isBearish) + { + box.lower = MathMin(box.lower, bar.GetUp()); + } + box.to = bar.time; + + // + toIDX = box.ToIndex(); + fromIDX = box.FromIndex(); + + // + // Liquidity ... + if (forceLiquidity) + { + // + // Now we Have to Detect Liquidity Zone ... + for (int i = fromIDX; i < fromIDX + loopback; i++) + { + // + // Initialize iBar + result = iBar.Init( + bar.symbol, + bar.period, + i // + ); + result = + result && + IsRejected( + iBar, + iDir, + false, // Force Bar Type ... + true // Force Fibo Pressure ... + ) && + iDir == box.dir && + (isBullish + ? iBar.low < box.lower + : iBar.high > box.upper); + if (result) + { + // + // Filling Liquidity ... + liquidity.dir = iDir; + liquidity.to = box.to; + liquidity.type = "XLQ"; + liquidity.from = iBar.time; + liquidity.symbol = iBar.symbol; + liquidity.period = iBar.period; + liquidity.upper = isBullish + ? iBar.GetDown() + : iBar.high; + liquidity.lower = isBullish + ? iBar.low + : iBar.GetUp(); + + // + result = liquidity.IsValid(); + if (result) + { + break; + } + } + + // + iBar.Clean(); + } + iBar.Clean(); + result = liquidity.IsValid(); + if (!result) + { + // + ob.Clean(); + fvg.Clean(); + box.Clean(); + pBar.Clean(); + iBar.Clean(); + iPBar.Clean(); + swingBar.Clean(); + liquidity.Clean(); + + // + return result; + } + + // + // Check Liquidity Usage ... + if (forceLiquidityUsed) + { + // + // now We have to Ensure Detected Liqudity is Used ... + toIDX = box.ToIndex(); + fromIDX = liquidity.FromIndex(); + for (int i = fromIDX - 1; i >= toIDX; i--) + { + // + // Initialize iBar ... + result = iBar.Init( + bar.symbol, + bar.period, + i // + ); + result = + result && + (isBullish + ? iBar.low < liquidity.upper + : iBar.high > liquidity.lower); + if (result) + { + break; + } + + // + iBar.Clean(); + } + if (!result) + { + // + ob.Clean(); + fvg.Clean(); + box.Clean(); + pBar.Clean(); + iBar.Clean(); + iPBar.Clean(); + swingBar.Clean(); + liquidity.Clean(); + + // + return result; + } + } + } + + // + // Entry Bar ... + if (forceEntryBar) + { + // + // Validate Bar is Not Opposit Powered Bar ... + + // + // Momentum ... + bool isMomentum = IsMomentum( + bar, + iDir, + 1 // + ); + bool isBullishMomentum = + isMomentum && + IsBullish(iDir); + bool isBearishMomentum = + isMomentum && + IsBearish(iDir); + + // + // Engulfed ... + bool isEngulfed = IsEngulfed( + bar, + iDir // + ); + bool isBullishEngulfed = + isEngulfed && + IsBullish(iDir); + bool isBearishEngulfed = + isEngulfed && + IsBearish(iDir); + + // + // Rejected ... + bool isRejected = IsRejected( + bar, + iDir, + false, + true // + ); + bool isBullishRejected = + isRejected && + IsBullish(iDir); + bool isBearishRejected = + isRejected && + IsBearish(iDir); + + // + bool isBullishPowered = + isBullishMomentum || + isBullishEngulfed || + isBullishRejected; + + // + bool isBearishPowered = + isBearishMomentum || + isBearishEngulfed || + isBearishRejected; + + // + // Make Sure Entry Bar is a Valid Bar ... + result = + isBullish + ? !isBearishPowered && (!forceEntryBarPower + ? true + : isBullishPowered) + : !isBullishPowered && (!forceEntryBarPower + ? true + : isBearishPowered); + if (!result) + { + // + ob.Clean(); + fvg.Clean(); + box.Clean(); + pBar.Clean(); + iBar.Clean(); + iPBar.Clean(); + swingBar.Clean(); + liquidity.Clean(); + + // + return result; + } + } + // // Cleanup Resources ... // iBar.Clean(); + pBar.Clean(); + iPBar.Clean(); swingBar.Clean(); // if (!result) { + // + ob.Clean(); + fvg.Clean(); box.Clean(); + swingBar.Clean(); + liquidity.Clean(); } // diff --git a/Experts/test.mq5 b/Experts/test.mq5 index d9cb3d33..e2c050ca 100644 --- a/Experts/test.mq5 +++ b/Experts/test.mq5 @@ -9,122 +9,55 @@ #property description "EA based on X121 XCA and X3MA indicators" #property strict -// Include Common Library +// +// Include Common Library ... #include "../Libraries/x-saherelm.common.lib.mq5" -#include +#include "../XCAEA/Helpers/xcaea.helper.mq5" -// Indicator handles -int xcaHandle = INVALID_HANDLE; -int x3maHandle = INVALID_HANDLE; +// +// Variables ... +XCAEAInputs eaInputs; +XCXCAEAHelper *eaHelper; +XBarTracker eaBarTraker; -// Indicator buffers for XCA -double xcaTrendBuffer[]; -double xcaTrendColorBuffer[]; -double xcaKIBuffer[]; -double xcaKIColorBuffer[]; -double xcaVidyaBuffer[]; -double xcaVidyaColorBuffer[]; -double xcaSwingLowBuffer[]; -double xcaSwingHighBuffer[]; -double xcaSupportBuffer[]; -double xcaResistanceBuffer[]; -double xcaSLBuffer[]; // Short Cycle Low -double xcaSHBuffer[]; // Short Cycle High -double xcaMLBuffer[]; // Medium Cycle Low -double xcaMHBuffer[]; // Medium Cycle High -double xcaFiboLevel2Buffer[]; // 50% Fibo level - -// Indicator buffers for X3MA -double x3maFastBuffer[]; -double x3maFastColorBuffer[]; -double x3maMediumBuffer[]; -double x3maMediumColorBuffer[]; -double x3maSlowBuffer[]; -double x3maSlowColorBuffer[]; - -// Trade parameters -input group "Trade Settings" input double LotSize = 0.1; // Fixed Lot Size -input bool UseAutoLotSize = false; // Use Auto Lot Size -input double RiskPercent = 1.0; // Risk Percent (for Auto Lot) -input int StopLoss = 100; // Stop Loss in points -input int TakeProfit = 200; // Take Profit in points -input bool UseTrailingStop = true; // Use Trailing Stop -input int TrailingStop = 50; // Trailing Stop in points -input int TrailingStep = 10; // Trailing Step in points - -input group "Strategy Parameters" input bool UseSwingPoints = true; // Use Swing Points for Entry -input bool UseFiboLevels = true; // Use Fibonacci Levels -input bool UseMAAlignment = true; // Require All MAs Alignment -input bool UseKIConfirmation = true; // Require KI Confirmation -input bool UseVidyaConfirmation = true; // Require VIDYA Confirmation -input bool UseTrendConfirmation = true; // Require Trend Confirmation - -input group "Money Management" input bool UseMultipleTargets = true; // Use Multiple Profit Targets -input double Target1Percent = 33.0; // First Target Percentage -input double Target2Percent = 33.0; // Second Target Percentage -input double Target3Percent = 34.0; // Third Target Percentage - -input group "Time Filter" input bool UseTimeFilter = false; // Use Time Filter -input string StartTradeTime = "08:00"; // Start Trading Time (Server Time) -input string EndTradeTime = "16:00"; // End Trading Time (Server Time) - -// Global variables -int magicNumber = 12121; -bool isTradingAllowed = true; -datetime lastBarTime = 0; -int barsTotalPrev = 0; - -// Trade objects -CTrade trade; +CArrayObj eaObjects; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { - // Initialize trade object - trade.SetExpertMagicNumber(magicNumber); + // + // Initial Bar Tracker ... + eaBarTraker.Init( + _Symbol, + _Period // + ); - // Initialize XCA indicator - xcaHandle = iCustom(_Symbol, _Period, "x-saherelm.x121.xca"); - if (xcaHandle == INVALID_HANDLE) + // + // Configure XCA ... + eaInputs.Default(); + + // + // Hide all Visible Buffers ... + eaInputs.Hide(); + + // + // we Can make Show all requirements here ... + + // + eaHelper = new XCXCAEAHelper(); + bool isInited = eaHelper.Init( + _Symbol, + _Period, + eaInputs // + ); + if (!isInited) { - Print("Failed to create handle of the XCA indicator"); return (INIT_FAILED); } - // Initialize X3MA indicator - x3maHandle = iCustom(_Symbol, _Period, "x-saherelm.x121.x3ma"); - if (x3maHandle == INVALID_HANDLE) - { - Print("Failed to create handle of the X3MA indicator"); - return (INIT_FAILED); - } - - // Set up arrays as series - ArraySetAsSeries(xcaTrendBuffer, true); - ArraySetAsSeries(xcaTrendColorBuffer, true); - ArraySetAsSeries(xcaKIBuffer, true); - ArraySetAsSeries(xcaKIColorBuffer, true); - ArraySetAsSeries(xcaVidyaBuffer, true); - ArraySetAsSeries(xcaVidyaColorBuffer, true); - ArraySetAsSeries(xcaSwingLowBuffer, true); - ArraySetAsSeries(xcaSwingHighBuffer, true); - ArraySetAsSeries(xcaSupportBuffer, true); - ArraySetAsSeries(xcaResistanceBuffer, true); - ArraySetAsSeries(xcaSLBuffer, true); - ArraySetAsSeries(xcaSHBuffer, true); - ArraySetAsSeries(xcaMLBuffer, true); - ArraySetAsSeries(xcaMHBuffer, true); - ArraySetAsSeries(xcaFiboLevel2Buffer, true); - - ArraySetAsSeries(x3maFastBuffer, true); - ArraySetAsSeries(x3maFastColorBuffer, true); - ArraySetAsSeries(x3maMediumBuffer, true); - ArraySetAsSeries(x3maMediumColorBuffer, true); - ArraySetAsSeries(x3maSlowBuffer, true); - ArraySetAsSeries(x3maSlowColorBuffer, true); - + // return (INIT_SUCCEEDED); } @@ -133,12 +66,15 @@ int OnInit() //+------------------------------------------------------------------+ void OnDeinit(const int reason) { - // Release indicator handles - if (xcaHandle != INVALID_HANDLE) - IndicatorRelease(xcaHandle); + // + eaObjects.Clear(); - if (x3maHandle != INVALID_HANDLE) - IndicatorRelease(x3maHandle); + // + eaBarTraker.Clean(); + + // + // delete eaHelper; + // ZeroMemory(eaHelper); } //+------------------------------------------------------------------+ @@ -146,671 +82,179 @@ void OnDeinit(const int reason) //+------------------------------------------------------------------+ void OnTick() { - // Check if we're allowed to trade based on time filter - if (UseTimeFilter && !IsTradeTimeAllowed()) + // + // Check Bar Processing ... + if (!eaBarTraker.CanProcessBar()) + { return; + } - // Get current bar time - datetime currentBarTime = iTime(_Symbol, _Period, 0); + // + bool has = false; - // Only process on new bar - if (currentBarTime == lastBarTime) + // + // Required Chart Identification ... + ulong chartId = eaHelper.poiDrawer.ChartIdentification(); + int subWindow = eaHelper.poiDrawer.SubWindowIdentification(); + + // + // Retrieve Bars ... + XOHCL zBar; + XOHCL cBar; + has = zBar.Init( + _Symbol, + _Period, + 0 // + ); + has = + has && + zBar.GetPreviousBar(cBar); + if (!has) + { + // + zBar.Clean(); + cBar.Clean(); + + // return; + } - lastBarTime = currentBarTime; + // + // Here Do What we Want ... + XOHCL swingBar; + XBoxZone ob; + XBoxZone fvg; + XBoxZone trigger; + XBoxZone liquidity; + has = eaHelper + .barAnalyser + .IsTrigger( + cBar, + trigger, + ob, + fvg, + liquidity, + swingBar, + 10 // + ); + if (has) + { + // + bool isBullish = trigger.IsBullish(); - // Update indicator buffers - if (!UpdateIndicatorBuffers()) - return; + // + // ob.to = zBar.time; + // fvg.to = zBar.time; + trigger.to = zBar.time; + liquidity.to = zBar.time; - // Check for open positions and manage them - ManageOpenPositions(); + // + // Draw OB ... + XCBoxObject *iOBObj; + has = eaHelper.poiDrawer.DrawBox( + ob, + iOBObj // + ); + if (has) + { + eaObjects.Add(iOBObj); + } + ZeroMemory(iOBObj); - // Check for new trade signals - CheckForTradeSignals(); -} - -//+------------------------------------------------------------------+ -//| Update all indicator buffers | -//+------------------------------------------------------------------+ -bool UpdateIndicatorBuffers() -{ - // Copy XCA indicator buffers - if (CopyBuffer(xcaHandle, 18, 0, 3, xcaTrendBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 19, 0, 3, xcaTrendColorBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 20, 0, 3, xcaKIBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 21, 0, 3, xcaKIColorBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 26, 0, 3, xcaVidyaBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 27, 0, 3, xcaVidyaColorBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 22, 0, 3, xcaSwingLowBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 23, 0, 3, xcaSwingHighBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 8, 0, 3, xcaSupportBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 9, 0, 3, xcaResistanceBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 0, 0, 3, xcaSHBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 1, 0, 3, xcaSLBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 2, 0, 3, xcaMHBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 3, 0, 3, xcaMLBuffer) < 3) - return false; - if (CopyBuffer(xcaHandle, 15, 0, 3, xcaFiboLevel2Buffer) < 3) - return false; - - // Copy X3MA indicator buffers - if (CopyBuffer(x3maHandle, 0, 0, 3, x3maFastBuffer) < 3) - return false; - if (CopyBuffer(x3maHandle, 1, 0, 3, x3maFastColorBuffer) < 3) - return false; - if (CopyBuffer(x3maHandle, 2, 0, 3, x3maMediumBuffer) < 3) - return false; - if (CopyBuffer(x3maHandle, 3, 0, 3, x3maMediumColorBuffer) < 3) - return false; - if (CopyBuffer(x3maHandle, 4, 0, 3, x3maSlowBuffer) < 3) - return false; - if (CopyBuffer(x3maHandle, 5, 0, 3, x3maSlowColorBuffer) < 3) - return false; - - return true; -} - -//+------------------------------------------------------------------+ -//| Check if current time is within allowed trading hours | -//+------------------------------------------------------------------+ -bool IsTradeTimeAllowed() -{ - // If time filter is not enabled, always allow trading - if (!UseTimeFilter) - return true; - - // Get current server time - datetime serverTime = TimeCurrent(); - MqlDateTime currentTime; - TimeToStruct(serverTime, currentTime); - - // Convert start and end time strings to hours and minutes - int startHour = 0, startMinute = 0; - int endHour = 0, endMinute = 0; - - // Parse start time - string startTimeParts[]; - if (StringSplit(StartTradeTime, ':', startTimeParts) == 2) - { - startHour = (int)StringToInteger(startTimeParts[0]); - startMinute = (int)StringToInteger(startTimeParts[1]); - } - - // Parse end time - string endTimeParts[]; - if (StringSplit(EndTradeTime, ':', endTimeParts) == 2) - { - endHour = (int)StringToInteger(endTimeParts[0]); - endMinute = (int)StringToInteger(endTimeParts[1]); - } - - // Convert current time, start time and end time to minutes for easy comparison - int currentTimeInMinutes = currentTime.hour * 60 + currentTime.min; - int startTimeInMinutes = startHour * 60 + startMinute; - int endTimeInMinutes = endHour * 60 + endMinute; - - // Check if current time is within trading hours - bool isAllowed = false; - - // If end time is greater than start time (same day trading session) - if (endTimeInMinutes > startTimeInMinutes) - { - isAllowed = (currentTimeInMinutes >= startTimeInMinutes && - currentTimeInMinutes <= endTimeInMinutes); - } - // If end time is less than start time (overnight trading session) - else if (endTimeInMinutes < startTimeInMinutes) - { - isAllowed = (currentTimeInMinutes >= startTimeInMinutes || - currentTimeInMinutes <= endTimeInMinutes); - } - // If start time equals end time (24-hour trading) - else - { - isAllowed = true; - } - - return isAllowed; -} - -//+------------------------------------------------------------------+ -//| Check for new trade signals | -//+------------------------------------------------------------------+ -void CheckForTradeSignals() -{ - // Don't open new trades if we already have open positions - if (CountOpenPositions() > 0) - return; - - // Check for buy signal - if (IsBuySignal()) - { - OpenBuyPosition(); - } - // Check for sell signal - else if (IsSellSignal()) - { - OpenSellPosition(); - } -} - -//+------------------------------------------------------------------+ -//| Check if we have a valid buy signal | -//+------------------------------------------------------------------+ -bool IsBuySignal() -{ - // 1. Trend Confirmation - bool trendConfirmation = true; - if (UseTrendConfirmation) - { - // X3MA: Fast MA crosses above Medium MA - bool fastCrossingAboveMedium = x3maFastBuffer[1] <= x3maMediumBuffer[1] && - x3maFastBuffer[0] > x3maMediumBuffer[0]; - - // X3MA: All three MAs are in bullish alignment - bool maAlignment = true; - if (UseMAAlignment) - { - maAlignment = x3maFastBuffer[0] > x3maMediumBuffer[0] && - x3maMediumBuffer[0] > x3maSlowBuffer[0]; - } - - // XCA: VIDYA line shows bullish color - bool vidyaBullish = true; - if (UseVidyaConfirmation) - { - vidyaBullish = xcaVidyaColorBuffer[0] == 1; // 1 is bullish color index - } - - // XCA: Trend line shows bullish color - bool trendBullish = xcaTrendColorBuffer[0] == 1; // 1 is bullish color index - - trendConfirmation = (fastCrossingAboveMedium || maAlignment) && - (vidyaBullish || !UseVidyaConfirmation) && - trendBullish; - } - - // 2. Cycle Analysis - bool cycleAnalysis = true; - { - // XCA: Price is above the Short Cycle low - double currentPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID); - bool priceAboveSL = currentPrice > xcaSLBuffer[0]; - - // XCA: Medium Cycle is in uptrend phase - bool mediumCycleUptrend = xcaMLBuffer[0] > xcaMLBuffer[1]; - - // XCA: Support level is established and holding - bool supportHolding = currentPrice > xcaSupportBuffer[0]; - - cycleAnalysis = priceAboveSL && mediumCycleUptrend && supportHolding; - } - - // 3. Entry Timing - bool entryTiming = true; - { - // XCA: A swing low is identified - bool swingLowFound = UseSwingPoints ? xcaSwingLowBuffer[0] != 0 : true; - - // XCA: Price is near but above the Fibonacci level 2 (50% retracement) - bool nearFiboLevel = true; - if (UseFiboLevels) - { - double currentPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID); - double fiboLevel = xcaFiboLevel2Buffer[0]; - double priceDiff = MathAbs(currentPrice - fiboLevel); - double priceRange = xcaResistanceBuffer[0] - xcaSupportBuffer[0]; - nearFiboLevel = priceDiff < priceRange * 0.1 && currentPrice > fiboLevel; - } - - // XCA: KI line shows bullish color - bool kiBullish = true; - if (UseKIConfirmation) - { - kiBullish = xcaKIColorBuffer[0] == 1; // 1 is bullish color index - } - - entryTiming = swingLowFound && (nearFiboLevel || !UseFiboLevels) && - (kiBullish || !UseKIConfirmation); - } - - return trendConfirmation && cycleAnalysis && entryTiming; -} - -//+------------------------------------------------------------------+ -//| Check if we have a valid sell signal | -//+------------------------------------------------------------------+ -bool IsSellSignal() -{ - // 1. Trend Confirmation - bool trendConfirmation = true; - if (UseTrendConfirmation) - { - // X3MA: Fast MA crosses below Medium MA - bool fastCrossingBelowMedium = x3maFastBuffer[1] >= x3maMediumBuffer[1] && - x3maFastBuffer[0] < x3maMediumBuffer[0]; - - // X3MA: All three MAs are in bearish alignment - bool maAlignment = true; - if (UseMAAlignment) - { - maAlignment = x3maFastBuffer[0] < x3maMediumBuffer[0] && - x3maMediumBuffer[0] < x3maSlowBuffer[0]; - } - - // XCA: VIDYA line shows bearish color - bool vidyaBearish = true; - if (UseVidyaConfirmation) - { - vidyaBearish = xcaVidyaColorBuffer[0] == 2; // 2 is bearish color index - } - - // XCA: Trend line shows bearish color - bool trendBearish = xcaTrendColorBuffer[0] == 2; // 2 is bearish color index - - trendConfirmation = (fastCrossingBelowMedium || maAlignment) && - (vidyaBearish || !UseVidyaConfirmation) && - trendBearish; - } - - // 2. Cycle Analysis - bool cycleAnalysis = true; - { - // XCA: Price is below the Short Cycle high - double currentPrice = SymbolInfoDouble(_Symbol, SYMBOL_ASK); - bool priceBelowSH = currentPrice < xcaSHBuffer[0]; - - // XCA: Medium Cycle is in downtrend phase - bool mediumCycleDowntrend = xcaMHBuffer[0] < xcaMHBuffer[1]; - - // XCA: Resistance level is established and holding - bool resistanceHolding = currentPrice < xcaResistanceBuffer[0]; - - cycleAnalysis = priceBelowSH && mediumCycleDowntrend && resistanceHolding; - } - - // 3. Entry Timing - bool entryTiming = true; - { - // XCA: A swing high is identified - bool swingHighFound = UseSwingPoints ? xcaSwingHighBuffer[0] != 0 : true; - - // XCA: Price is near but below the Fibonacci level 2 (50% retracement) - bool nearFiboLevel = true; - if (UseFiboLevels) - { - double currentPrice = SymbolInfoDouble(_Symbol, SYMBOL_ASK); - double fiboLevel = xcaFiboLevel2Buffer[0]; - double priceDiff = MathAbs(currentPrice - fiboLevel); - double priceRange = xcaResistanceBuffer[0] - xcaSupportBuffer[0]; - nearFiboLevel = priceDiff < priceRange * 0.1 && currentPrice < fiboLevel; - } - - // XCA: KI line shows bearish color - bool kiBearish = true; - if (UseKIConfirmation) - { - kiBearish = xcaKIColorBuffer[0] == 2; // 2 is bearish color index - } - - entryTiming = swingHighFound && (nearFiboLevel || !UseFiboLevels) && - (kiBearish || !UseKIConfirmation); - } - - return trendConfirmation && cycleAnalysis && entryTiming; -} - -//+------------------------------------------------------------------+ -//| Count open positions with our magic number | -//+------------------------------------------------------------------+ -int CountOpenPositions() -{ - int count = 0; - int total = PositionsTotal(); - - for (int i = 0; i < total; i++) - { - ulong ticket = PositionGetTicket(i); - if (ticket <= 0) - continue; - - // Check if position belongs to current symbol and our EA - if (PositionGetString(POSITION_SYMBOL) == _Symbol && - PositionGetInteger(POSITION_MAGIC) == magicNumber) - { - count++; - } - } - - return count; -} - -//+------------------------------------------------------------------+ -//| Manage open positions (trailing stops, partial closes) | -//+------------------------------------------------------------------+ -void ManageOpenPositions() -{ - int total = PositionsTotal(); - - // Loop through all open positions - for (int i = total - 1; i >= 0; i--) - { - ulong ticket = PositionGetTicket(i); - if (ticket <= 0) - continue; - - // Check if position belongs to current symbol and our EA - if (PositionGetString(POSITION_SYMBOL) != _Symbol || - PositionGetInteger(POSITION_MAGIC) != magicNumber) - continue; - - // Get position details - double openPrice = PositionGetDouble(POSITION_PRICE_OPEN); - double currentPrice = PositionGetDouble(POSITION_PRICE_CURRENT); - double stopLoss = PositionGetDouble(POSITION_SL); - double takeProfit = PositionGetDouble(POSITION_TP); - double positionVolume = PositionGetDouble(POSITION_VOLUME); - ENUM_POSITION_TYPE positionType = (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE); - - // Check for exit signals - bool exitSignal = false; - - // For BUY positions - if (positionType == POSITION_TYPE_BUY) - { - // Exit if Fast MA crosses below Medium MA - if (x3maFastBuffer[1] > x3maMediumBuffer[1] && x3maFastBuffer[0] <= x3maMediumBuffer[0]) - exitSignal = true; - - // Apply trailing stop if enabled - if (UseTrailingStop && !exitSignal) - { - // Calculate new stop loss level - double newStopLoss = 0; - - // Use the most recent swing low as trailing stop if available - if (xcaSwingLowBuffer[0] > 0 && xcaSwingLowBuffer[0] < currentPrice) - { - newStopLoss = xcaSwingLowBuffer[0] - 5 * _Point; - } - else - { - // Traditional trailing stop - double trailingLevel = currentPrice - TrailingStop * _Point; - if (trailingLevel > stopLoss + TrailingStep * _Point) - newStopLoss = trailingLevel; - } - - // Update stop loss if we have a better level - if (newStopLoss > stopLoss && newStopLoss > 0) - { - trade.PositionModify(ticket, newStopLoss, takeProfit); - Print("Updated BUY trailing stop to: ", newStopLoss); - } - } - - // Handle multiple targets - if (UseMultipleTargets && positionVolume > LotSize * 0.5) - { - // First target: When price reaches resistance or initial TP - if (currentPrice >= xcaResistanceBuffer[0] && xcaResistanceBuffer[0] > openPrice) - { - double closeVolume = NormalizeDouble(positionVolume * Target1Percent / 100, 2); - if (closeVolume > 0) - { - trade.PositionClosePartial(ticket, closeVolume); - Print("First target reached for BUY position. Partially closed: ", closeVolume); - } - } - - // Second target: When price reaches Fibonacci level 3 (76.4%) - double fiboLevel3Buffer[]; - ArraySetAsSeries(fiboLevel3Buffer, true); - if (CopyBuffer(xcaHandle, 16, 0, 1, fiboLevel3Buffer) > 0) - { - double fiboLevel3 = fiboLevel3Buffer[0]; - if (fiboLevel3 > 0 && currentPrice >= fiboLevel3 && fiboLevel3 > openPrice) - { - double closeVolume = NormalizeDouble(positionVolume * Target2Percent / 100, 2); - if (closeVolume > 0) - { - trade.PositionClosePartial(ticket, closeVolume); - Print("Second target reached for BUY position. Partially closed: ", closeVolume); - } - } - } - } - } - // For SELL positions - else if (positionType == POSITION_TYPE_SELL) - { - // Exit if Fast MA crosses above Medium MA - if (x3maFastBuffer[1] < x3maMediumBuffer[1] && x3maFastBuffer[0] >= x3maMediumBuffer[0]) - exitSignal = true; - - // Apply trailing stop if enabled - if (UseTrailingStop && !exitSignal) - { - // Calculate new stop loss level - double newStopLoss = 0; - - // Use the most recent swing high as trailing stop if available - if (xcaSwingHighBuffer[0] > 0 && xcaSwingHighBuffer[0] > currentPrice) - { - newStopLoss = xcaSwingHighBuffer[0] + 5 * _Point; - } - else - { - // Traditional trailing stop - double trailingLevel = currentPrice + TrailingStop * _Point; - if (trailingLevel < stopLoss - TrailingStep * _Point || stopLoss == 0) - newStopLoss = trailingLevel; - } - - // Update stop loss if we have a better level - if ((newStopLoss < stopLoss || stopLoss == 0) && newStopLoss > 0) - { - trade.PositionModify(ticket, newStopLoss, takeProfit); - Print("Updated SELL trailing stop to: ", newStopLoss); - } - } - - // Handle multiple targets - if (UseMultipleTargets && positionVolume > LotSize * 0.5) - { - // First target: When price reaches support or initial TP - if (currentPrice <= xcaSupportBuffer[0] && xcaSupportBuffer[0] < openPrice) - { - double closeVolume = NormalizeDouble(positionVolume * Target1Percent / 100, 2); - if (closeVolume > 0) - { - trade.PositionClosePartial(ticket, closeVolume); - Print("First target reached for SELL position. Partially closed: ", closeVolume); - } - } - - // Second target: When price reaches Fibonacci level 3 (76.4%) - double fiboLevel3Buffer[]; - ArraySetAsSeries(fiboLevel3Buffer, true); - if (CopyBuffer(xcaHandle, 16, 0, 1, fiboLevel3Buffer) > 0) - { - double fiboLevel3 = fiboLevel3Buffer[0]; - if (fiboLevel3 > 0 && currentPrice <= fiboLevel3 && fiboLevel3 < openPrice) - { - double closeVolume = NormalizeDouble(positionVolume * Target2Percent / 100, 2); - if (closeVolume > 0) - { - trade.PositionClosePartial(ticket, closeVolume); - Print("Second target reached for SELL position. Partially closed: ", closeVolume); - } - } - } - } - } - - // Close position if exit signal is triggered - if (exitSignal) - { - trade.PositionClose(ticket); - Print("Exit signal triggered. Position closed."); - } - } -} - -//+------------------------------------------------------------------+ -//| Open a buy position with proper risk management | -//+------------------------------------------------------------------+ -void OpenBuyPosition() -{ - double entryPrice = SymbolInfoDouble(_Symbol, SYMBOL_ASK); - double stopLossPrice = 0; - double takeProfitPrice = 0; - - // Calculate stop loss price - if (StopLoss > 0) - { - // Use either the specified stop loss or the swing low, whichever is closer - double swingLowPrice = xcaSwingLowBuffer[0]; - double slByPoints = entryPrice - StopLoss * _Point; - - // If we have a valid swing low and it's not too far - if (swingLowPrice > 0 && entryPrice - swingLowPrice < StopLoss * 2 * _Point) - stopLossPrice = swingLowPrice - 5 * _Point; // Place SL slightly below swing low - else - stopLossPrice = slByPoints; - } - - // Calculate take profit price - if (TakeProfit > 0) - { - // If using multiple targets, we'll set the first one here and manage the rest in position management - if (UseMultipleTargets) - { - // Use resistance level as first target if available - if (xcaResistanceBuffer[0] > entryPrice) - takeProfitPrice = xcaResistanceBuffer[0]; - else - takeProfitPrice = entryPrice + TakeProfit * _Point; - } - else - { - takeProfitPrice = entryPrice + TakeProfit * _Point; - } - } - - // Calculate position size - double volume = LotSize; - if (UseAutoLotSize && stopLossPrice > 0) - { - double riskAmount = AccountInfoDouble(ACCOUNT_BALANCE) * RiskPercent / 100; - double pipValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE) * - (SymbolInfoDouble(_Symbol, SYMBOL_POINT) / SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE)); - double pipDistance = MathAbs(entryPrice - stopLossPrice) / SymbolInfoDouble(_Symbol, SYMBOL_POINT); - - if (pipDistance > 0 && pipValue > 0) - volume = NormalizeDouble(riskAmount / (pipDistance * pipValue), 2); - - // Ensure volume is within allowed limits - double minVolume = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); - double maxVolume = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX); - double volumeStep = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP); - - volume = MathMax(minVolume, MathMin(maxVolume, volume)); - volume = NormalizeDouble(volume / volumeStep, 0) * volumeStep; - } - - // Execute the trade - trade.Buy(volume, _Symbol, 0, stopLossPrice, takeProfitPrice, "X121 Strategy Buy"); - - // Log the trade - Print("BUY Signal: Opening position at ", entryPrice, - ", SL: ", stopLossPrice, - ", TP: ", takeProfitPrice, - ", Volume: ", volume); -} - -//+------------------------------------------------------------------+ -//| Open a sell position with proper risk management | -//+------------------------------------------------------------------+ -void OpenSellPosition() -{ - double entryPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID); - double stopLossPrice = 0; - double takeProfitPrice = 0; - - // Calculate stop loss price - if (StopLoss > 0) - { - // Use either the specified stop loss or the swing high, whichever is closer - double swingHighPrice = xcaSwingHighBuffer[0]; - double slByPoints = entryPrice + StopLoss * _Point; - - // If we have a valid swing high and it's not too far - if (swingHighPrice > 0 && swingHighPrice - entryPrice < StopLoss * 2 * _Point) - stopLossPrice = swingHighPrice + 5 * _Point; // Place SL slightly above swing high - else - stopLossPrice = slByPoints; - } - - // Calculate take profit price - if (TakeProfit > 0) - { - // If using multiple targets, we'll set the first one here and manage the rest in position management - if (UseMultipleTargets) - { - // Use support level as first target if available - if (xcaSupportBuffer[0] > 0 && xcaSupportBuffer[0] < entryPrice) - takeProfitPrice = xcaSupportBuffer[0]; - else - takeProfitPrice = entryPrice - TakeProfit * _Point; - } - else - { - takeProfitPrice = entryPrice - TakeProfit * _Point; - } - } - - // Calculate position size - double volume = LotSize; - if (UseAutoLotSize && stopLossPrice > 0) - { - double riskAmount = AccountInfoDouble(ACCOUNT_BALANCE) * RiskPercent / 100; - double pipValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE) * - (SymbolInfoDouble(_Symbol, SYMBOL_POINT) / SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE)); - double pipDistance = MathAbs(entryPrice - stopLossPrice) / SymbolInfoDouble(_Symbol, SYMBOL_POINT); - - if (pipDistance > 0 && pipValue > 0) - volume = NormalizeDouble(riskAmount / (pipDistance * pipValue), 2); - - // Ensure volume is within allowed limits - double minVolume = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); - double maxVolume = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX); - double volumeStep = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP); - - volume = MathMax(minVolume, MathMin(maxVolume, volume)); - volume = NormalizeDouble(volume / volumeStep, 0) * volumeStep; - } - - // Execute the trade - trade.Sell(volume, _Symbol, 0, stopLossPrice, takeProfitPrice, "X121 Strategy Sell"); - - // Log the trade - Print("SELL Signal: Opening position at ", entryPrice, - ", SL: ", stopLossPrice, - ", TP: ", takeProfitPrice, - ", Volume: ", volume); + // + // Draw FVG ... + XCBoxObject *iFVGObj; + has = eaHelper.poiDrawer.DrawBox( + fvg, + iFVGObj // + ); + if (has) + { + // + // Style Object ... + color clr = + isBullish + ? clrAqua + : clrMagenta; + iFVGObj.BoxWidth(2); + iFVGObj.BoxColor(clr); + iFVGObj.BoxStyle(STYLE_SOLID); + + // + // Store Object ... + eaObjects.Add(iFVGObj); + } + ZeroMemory(iFVGObj); + + // + // Draw Trigger ... + XCBoxObject *iTriggerObj; + has = eaHelper.poiDrawer.DrawBox( + trigger, + iTriggerObj // + ); + if (has) + { + eaObjects.Add(iTriggerObj); + } + ZeroMemory(iTriggerObj); + + // + // Draw Liquidity ... + XCBoxObject *iLiqObj; + has = eaHelper.poiDrawer.DrawBox( + liquidity, + iLiqObj // + ); + if (has) + { + eaObjects.Add(iLiqObj); + } + ZeroMemory(iLiqObj); + + // + // Draw Swing Bar ... + color swingColor = + isBullish + ? clrAqua + : clrMagenta; + ENUM_X_PRICE swingPType = + isBullish + ? X_PRICE_LOW + : X_PRICE_HIGH; + + // + XCBarArrowObject *swingObj; + has = eaHelper.poiDrawer.CreateBarArrow( + swingBar, + swingObj, + swingPType, + 159, + swingColor // + ); + if (has) + { + eaObjects.Add(swingObj); + } + + // + Print("Trigger Box Detected ..."); + } + + // + // Do What we Want ... + // When we Need Waits Until Next Bar ... + eaBarTraker.Waits(); + + // + // Cleanup Resources ... + + // + ob.Clean(); + fvg.Clean(); + zBar.Clean(); + cBar.Clean(); + trigger.Clean(); + swingBar.Clean(); + liquidity.Clean(); } diff --git a/Helpers/x-saherelm.x121.x3ma.helper.mq5 b/Helpers/x-saherelm.x121.x3ma.helper.mq5 index ac54b463..54cefa50 100644 --- a/Helpers/x-saherelm.x121.x3ma.helper.mq5 +++ b/Helpers/x-saherelm.x121.x3ma.helper.mq5 @@ -163,6 +163,16 @@ struct X121X3MAInputs showMedium = true; } + // + // Hide all Visible Buffers ... + void Hide() + { + // + showFast = false; + showSlow = false; + showMedium = false; + } + // // Validate ... bool IsValid() diff --git a/Helpers/x-saherelm.x121.xca.helper.mq5 b/Helpers/x-saherelm.x121.xca.helper.mq5 index 06878806..f7f1edb2 100644 --- a/Helpers/x-saherelm.x121.xca.helper.mq5 +++ b/Helpers/x-saherelm.x121.xca.helper.mq5 @@ -403,6 +403,36 @@ struct X121XCAInputs swingHighArrowCode = 226; // Swing High Arrow Code } + // + // Hide all Visible Buffers ... + void Hide() + { + // + showSar = false; // Show Sar + showKI = false; // Show KI + showTKI = false; // Show TKI + showMAH = false; // Show MAH + showMAL = false; // Show MAL + showMAC = false; // Show MAC + showVidya = false; // Show Vidya + showTrend = false; // Show Trend + showSwings = false; // Show Swings + showFiboLevel1 = false; // Show Fibo Level 1 + showFiboLevel2 = false; // Show Fibo Level 2 + showFiboLevel3 = false; // Show Fibo Level 3 + showFiboLevel4 = false; // Show Fibo Level 4 + showFiboLevel5 = false; // Show Fibo Level 5 + showPeaksAndVales = false; // Show Peaks And Vales + showPeakAndValeGolden = false; // Show Peak and Vale Golden + showSupportAndResistance = false; // Show Support and Resistance + + // + showShortCycle = false; // Show Short Cycle + showMediumCycle = false; // Show Medium Cycle + showLongCycle = false; // Show Long Cycle + showHindCycle = false; // Show Hind Cycle + } + // // Validate ... bool IsValid() diff --git a/Helpers/x-saherelm.x121.xcc.helper.mq5 b/Helpers/x-saherelm.x121.xcc.helper.mq5 index 1663ae72..67710361 100644 --- a/Helpers/x-saherelm.x121.xcc.helper.mq5 +++ b/Helpers/x-saherelm.x121.xcc.helper.mq5 @@ -99,6 +99,13 @@ struct X121XCCInputs showCandles = true; } + // + // Hide all Visible Buffers ... + void Hide() + { + showCandles = false; + } + // // Validate ... bool IsValid() @@ -161,7 +168,7 @@ class XCX121XCCHelper : public XCBaseHelper bool Init( string symbol, // Trading Symbol ENUM_TIMEFRAMES period, // Trading Period - X121XCCInputs &inputs // Inputs + X121XCCInputs &inputs // Inputs ) { // diff --git a/Helpers/x-saherelm.x121.xct.helper.mq5 b/Helpers/x-saherelm.x121.xct.helper.mq5 index c444481a..6c5284e2 100644 --- a/Helpers/x-saherelm.x121.xct.helper.mq5 +++ b/Helpers/x-saherelm.x121.xct.helper.mq5 @@ -87,6 +87,13 @@ struct X121XCTInputs showCandleTime = true; } + // + // Hide all Visible Buffers ... + void Hide() + { + showCandleTime = false; + } + // // Validate ... bool IsValid() @@ -149,7 +156,7 @@ class XCX121XCTHelper : public XCBaseHelper bool Init( string symbol, // Trading Symbol ENUM_TIMEFRAMES period, // Trading Period - X121XCTInputs &inputs // Inputs + X121XCTInputs &inputs // Inputs ) { // diff --git a/Libraries/x-saherelm.x-poi.lib.mq5 b/Libraries/x-saherelm.x-poi.lib.mq5 index dc06f660..02d1fd29 100644 --- a/Libraries/x-saherelm.x-poi.lib.mq5 +++ b/Libraries/x-saherelm.x-poi.lib.mq5 @@ -5511,6 +5511,46 @@ struct XBoxZone IsBearish(dir); } + /** + * Clone Box by Provided Source ... + * + * @return ( bool ) + */ + bool Clone(XBoxZone &source) + { + // + bool result = false; + + // + Clean(); + result = source.IsValid(); + if (!result) + { + return result; + } + + // + // Filling Props ... + to = source.to; + dir = source.dir; + from = source.from; + type = source.type; + upper = source.upper; + lower = source.lower; + symbol = source.symbol; + period = source.period; + + // + result = IsValid(); + if (!result) + { + Clean(); + } + + // + return result; + } + /** * Check Box is Same as Other ... * diff --git a/XCAEA/Helpers/xcaea.helper.mq5 b/XCAEA/Helpers/xcaea.helper.mq5 index b5e155c9..b5f44c00 100644 --- a/XCAEA/Helpers/xcaea.helper.mq5 +++ b/XCAEA/Helpers/xcaea.helper.mq5 @@ -107,6 +107,17 @@ struct XCAEAInputs oscsInputs.Default(); } + /** + * Hide all Visibles ... + */ + void Hide() + { + // + ctInputs.Hide(); + caInputs.Hide(); + x3maInputs.Hide(); + } + /** * Validate ... *