From e43aa6e6f8d6704ea0bd0c627be6f1384a64e50c Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 9 Jan 2025 13:18:03 +0330 Subject: [PATCH] last ... --- X121SMCEA/Libraries/x-121.smc.lib.mq5 | 12 +- .../Signals/x-121.smc.xobgpv.signal.lib.mq5 | 1007 +++++++++++++++++ ...q5 => x-121.smc.xtwpv.signal.lib copy.mq5} | 0 .../Strategy/x-121.smc.strategy.class.mq5 | 60 +- 4 files changed, 1043 insertions(+), 36 deletions(-) create mode 100644 X121SMCEA/Signals/x-121.smc.xobgpv.signal.lib.mq5 rename X121SMCEA/Signals/{x-121.smc.xtwpv.signal.lib.mq5 => x-121.smc.xtwpv.signal.lib copy.mq5} (100%) diff --git a/X121SMCEA/Libraries/x-121.smc.lib.mq5 b/X121SMCEA/Libraries/x-121.smc.lib.mq5 index 4ceca0b2..d1ac52ea 100644 --- a/X121SMCEA/Libraries/x-121.smc.lib.mq5 +++ b/X121SMCEA/Libraries/x-121.smc.lib.mq5 @@ -36,7 +36,7 @@ const string X121SMCStrategyToken = "X121SMC"; // const string X121SMCXTestToken = "X121XTest"; -const string X121SMCXTWPVToken = "X121XTWPV"; +const string X121SMCXOBGPVToken = "X121XOBGPV"; // // X121 SMC Providers ... @@ -45,7 +45,7 @@ enum ENUM_X_121_SMC_PROVIDERS // X_121_SMC_PROVIDER_NONE, X_121_SMC_PROVIDER_XTEST, - X_121_SMC_PROVIDER_XTWPV, + X_121_SMC_PROVIDER_XOBGPV, }; // @@ -674,8 +674,8 @@ string ToString(ENUM_X_121_SMC_PROVIDERS value) break; // - case X_121_SMC_PROVIDER_XTWPV: - result = X121SMCXTWPVToken; + case X_121_SMC_PROVIDER_XOBGPV: + result = X121SMCXOBGPVToken; break; } @@ -706,9 +706,9 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value) { result = X_121_SMC_PROVIDER_XTEST; } - else if (Contains(X121SMCXTWPVToken, value)) + else if (Contains(X121SMCXOBGPVToken, value)) { - result = X_121_SMC_PROVIDER_XTWPV; + result = X_121_SMC_PROVIDER_XOBGPV; } // diff --git a/X121SMCEA/Signals/x-121.smc.xobgpv.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xobgpv.signal.lib.mq5 new file mode 100644 index 00000000..a4f961d0 --- /dev/null +++ b/X121SMCEA/Signals/x-121.smc.xobgpv.signal.lib.mq5 @@ -0,0 +1,1007 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 X121 SMC Signal Class +// ------------------------------------------------- +// Name: +// Description: provide all Signalling functions ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-121.smc.market.cycle.helper.class.mq5" +#include "../Libraries/x-121.smc.lib.mq5" + +// +// Definitions ... +struct X121SMCStrategyXOBGPVSignalConditions +{ + // + // Props ... + + // + string symbol; + ENUM_TIMEFRAMES period; + + // + double sl; + double target; + ENUM_X_DIRECTION dir; + ENUM_X_POSITION_TYPES type; + + // + // Setup Props ... + + // + datetime setupTime; + datetime triggerTime; + + // + XFVGOrderBlock fvgOB; + + // + // Constructor ... + X121SMCStrategyXOBGPVSignalConditions() + { + Clean(); + } + + // + // Tools ... + + /** + * Cleaning Up ... + */ + void Clean() + { + // + sl = 0; + target = 0; + + // + dir = X_DIRECTION_NONE; + type = X_POSITION_TYPE_NONE; + + // + symbol = NULL; + period = NULL; + setupTime = NULL; + triggerTime = NULL; + + // + ExtensionClean(); + } + + /** + * Check Condition is Setting Up ... + * + * @param dir: ENUM_X_DIRECTION member, Setting Up Direction ... + * + * @return ( bool ) + */ + bool IsSetuped() + { + // + bool result = false; + + // + result = IsValid(setupTime) && + HasDirection(dir); + if (!result) + { + return result; + } + + // + return result; + } + + /** + * Calculate Setup Age ... + * + * @return ( int ) + */ + int GetSetupAge() + { + // + int result = 0; + + // + if (!IsSetuped()) + { + return result; + } + + // + result = (int)(TimeCurrent() - setupTime) / PeriodSeconds(period); + + // + return result; + } + + /** + * Detect How we Can Trigger Signal ... + * + * @return ( bool ) + */ + bool CanTrigger() + { + // + bool result = false; + + // + result = + // + sl > 0 && + IsValid(symbol) && + IsValid(period) && + IsValid(triggerTime) && + type != X_POSITION_TYPE_ALL && + type != X_POSITION_TYPE_NONE + // + ; + + // + return result; + } + + // + // Extensions ... + + /** + * Clean Additional Properties ... + */ + void ExtensionClean() + { + fvgOB.Clean(); + } + + /** + * Update Order Blocks Date ... + */ + void UpdateOrderBlocks() + { + // + datetime cTime = TimeCurrent(); + + // + fvgOB.orderBlock.To(cTime); + fvgOB.fairValueGap.To(cTime); + } + + // +}; + +// +// Extension Functions ... + +// +// Detect Setup Conditions ... +bool DetectX121SMCXOBGPVSiganlSetup( + string _symbol, + ENUM_TIMEFRAMES _period, + // + X121SMCStrategyXOBGPVSignalConditions &conditions, + // + XC121SMCCycleHelper *triggerCycleHelper, + XC121SMCCycleHelper *decisionCycleHelper, + XC121SMCCycleHelper *analyseCycleHelper, + XC121SMCCycleHelper *verificationCycleHelper, + XC121SMCCycleHelper *consolidationCycleHelper, + XC121SMCCycleHelper *visionCycleHelper + // +) +{ + // + bool result = false; + + // + bool isBullish = false; + bool isBearish = false; + + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + int ppIndex = pIndex + 1; + + // + int loopback = 10; + + // + string symbol = _symbol; + ENUM_TIMEFRAMES period = _period; + + // + conditions.symbol = symbol; + conditions.period = period; + + // + XOHCL zBar; + result = zBar.Init( + symbol, + period, + zIndex // + ); + if (!result) + { + return result; + } + + // + XOHCL cBar; + result = cBar.Init( + symbol, + period, + cIndex // + ); + if (!result) + { + return result; + } + + // + XOHCL pBar; + result = pBar.Init( + symbol, + period, + pIndex // + ); + if (!result) + { + return result; + } + + // + double ask = GetAsk(symbol); + double bid = GetBid(symbol); + datetime cTime = TimeCurrent(); + double points = GetPoints(symbol); + + // + int swingLoopback = 9; + double ll = cBar.FindLowest(swingLoopback, MODE_LOW); + double hh = cBar.FindHighest(swingLoopback, MODE_HIGH); + double llDown = cBar.FindLowesttDown(swingLoopback); + double hhUp = cBar.FindHighestUp(swingLoopback); + + // + // Cycles Conditions ... + + // + // Trigger ... + ENUM_XPOI_EVENTS triggerPoiEvents[]; + ENUM_X_CYCLE_EVENTS triggerCycleEvents[]; + X121SMCCycleConditions triggerConditions; + result = triggerCycleHelper.GetConditions( + triggerCycleEvents, + triggerPoiEvents, + triggerConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Decision ... + ENUM_XPOI_EVENTS decisionPoiEvents[]; + ENUM_X_CYCLE_EVENTS decisionCycleEvents[]; + X121SMCCycleConditions decisionConditions; + result = decisionCycleHelper.GetConditions( + decisionCycleEvents, + decisionPoiEvents, + decisionConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Analyse ... + ENUM_XPOI_EVENTS analysePoiEvents[]; + ENUM_X_CYCLE_EVENTS analyseCycleEvents[]; + X121SMCCycleConditions analyseConditions; + result = analyseCycleHelper.GetConditions( + analyseCycleEvents, + analysePoiEvents, + analyseConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Verification ... + ENUM_XPOI_EVENTS verificationPoiEvents[]; + ENUM_X_CYCLE_EVENTS verificationCycleEvents[]; + X121SMCCycleConditions verificationConditions; + result = verificationCycleHelper.GetConditions( + verificationCycleEvents, + verificationPoiEvents, + verificationConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Consolidation ... + ENUM_XPOI_EVENTS consolidationPoiEvents[]; + ENUM_X_CYCLE_EVENTS consolidationCycleEvents[]; + X121SMCCycleConditions consolidationConditions; + result = consolidationCycleHelper.GetConditions( + consolidationCycleEvents, + consolidationPoiEvents, + consolidationConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Vision ... + ENUM_XPOI_EVENTS visionPoiEvents[]; + ENUM_X_CYCLE_EVENTS visionCycleEvents[]; + X121SMCCycleConditions visionConditions; + result = visionCycleHelper.GetConditions( + visionCycleEvents, + visionPoiEvents, + visionConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Cycles POI States ... + XPOIState triggerState = triggerConditions.state; + XPOIState decisionState = decisionConditions.state; + XPOIState analyseState = analyseConditions.state; + XPOIState verificationState = verificationConditions.state; + XPOIState consolidationState = consolidationConditions.state; + XPOIState visionState = visionConditions.state; + + // + // Setup Conditions ... + + // + ENUM_X_DIRECTION forDir; + XFVGOrderBlock bullishOrderBlocks[]; + XFVGOrderBlock bearishOrderBlocks[]; + bool isTested = DetectFVGOB( + forDir, + bullishOrderBlocks, + bearishOrderBlocks, + consolidationState, + analyseState // + ); + + // + isBullish = + isTested && + IsBullish(forDir); + // + isBearish = + isTested && + IsBearish(forDir); + + // + result = isBullish || + isBearish; + if (!result) + { + return result; + } + + // + conditions.dir = forDir; + if (isBullish) + { + conditions.fvgOB = bullishOrderBlocks[0]; + } + else + { + conditions.fvgOB = bearishOrderBlocks[0]; + } + + // + conditions.setupTime = cTime; + conditions.dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + return result; +} + +// +// Detect Trigger Conditions ... +bool DetectX121SMCXOBGPVSiganlTrigger( + // + X121SMCStrategyXOBGPVSignalConditions &conditions, + // + string _symbol, + ENUM_TIMEFRAMES _period, + // + XC121SMCCycleHelper *triggerCycleHelper, + XC121SMCCycleHelper *decisionCycleHelper, + XC121SMCCycleHelper *analyseCycleHelper, + XC121SMCCycleHelper *verificationCycleHelper, + XC121SMCCycleHelper *consolidationCycleHelper, + XC121SMCCycleHelper *visionCycleHelper, + // + int maxAllowedSetupAge = 576 // + // +) +{ + // + bool result = false; + + // + result = conditions.IsSetuped(); + if (!result) + { + return result; + } + + // + datetime setupTime = conditions.setupTime; + ENUM_X_DIRECTION setupDir = conditions.dir; + + // + bool isBullish = IsBullish(setupDir); + bool isBearish = IsBearish(setupDir); + + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + int ppIndex = pIndex + 1; + + // + int loopback = 10; + + // + string symbol = _symbol; + ENUM_TIMEFRAMES period = _period; + + // + XOHCL zBar; + result = zBar.Init( + symbol, + period, + zIndex // + ); + if (!result) + { + return result; + } + + // + XOHCL cBar; + result = cBar.Init( + symbol, + period, + cIndex // + ); + if (!result) + { + return result; + } + + // + XOHCL pBar; + result = pBar.Init( + symbol, + period, + pIndex // + ); + if (!result) + { + return result; + } + + // + double ask = GetAsk(symbol); + double bid = GetBid(symbol); + datetime cTime = TimeCurrent(); + double points = GetPoints(symbol); + + // + int swingLoopback = 9; + double ll = cBar.FindLowest(swingLoopback, MODE_LOW); + double hh = cBar.FindHighest(swingLoopback, MODE_HIGH); + double llDown = cBar.FindLowesttDown(swingLoopback); + double hhUp = cBar.FindHighestUp(swingLoopback); + + // + // Cycles Conditions ... + + // + // Trigger ... + ENUM_XPOI_EVENTS triggerPoiEvents[]; + ENUM_X_CYCLE_EVENTS triggerCycleEvents[]; + X121SMCCycleConditions triggerConditions; + result = triggerCycleHelper.GetConditions( + triggerCycleEvents, + triggerPoiEvents, + triggerConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Decision ... + ENUM_XPOI_EVENTS decisionPoiEvents[]; + ENUM_X_CYCLE_EVENTS decisionCycleEvents[]; + X121SMCCycleConditions decisionConditions; + result = decisionCycleHelper.GetConditions( + decisionCycleEvents, + decisionPoiEvents, + decisionConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Analyse ... + ENUM_XPOI_EVENTS analysePoiEvents[]; + ENUM_X_CYCLE_EVENTS analyseCycleEvents[]; + X121SMCCycleConditions analyseConditions; + result = analyseCycleHelper.GetConditions( + analyseCycleEvents, + analysePoiEvents, + analyseConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Verification ... + ENUM_XPOI_EVENTS verificationPoiEvents[]; + ENUM_X_CYCLE_EVENTS verificationCycleEvents[]; + X121SMCCycleConditions verificationConditions; + result = verificationCycleHelper.GetConditions( + verificationCycleEvents, + verificationPoiEvents, + verificationConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Consolidation ... + ENUM_XPOI_EVENTS consolidationPoiEvents[]; + ENUM_X_CYCLE_EVENTS consolidationCycleEvents[]; + X121SMCCycleConditions consolidationConditions; + result = consolidationCycleHelper.GetConditions( + consolidationCycleEvents, + consolidationPoiEvents, + consolidationConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Vision ... + ENUM_XPOI_EVENTS visionPoiEvents[]; + ENUM_X_CYCLE_EVENTS visionCycleEvents[]; + X121SMCCycleConditions visionConditions; + result = visionCycleHelper.GetConditions( + visionCycleEvents, + visionPoiEvents, + visionConditions, + zIndex, + loopback // + ); + if (!result) + { + return result; + } + + // + // Cycles POI States ... + XPOIState triggerState = triggerConditions.state; + XPOIState decisionState = decisionConditions.state; + XPOIState analyseState = analyseConditions.state; + XPOIState verificationState = verificationConditions.state; + XPOIState consolidationState = consolidationConditions.state; + XPOIState visionState = visionConditions.state; + + // + // Trigger Conditions ... + + // + double decisionPeak = decisionConditions.x121Conditions.peaksBuffer[1]; + double isNewDecisionPeak = decisionConditions.x121Conditions.isNewPeak; + + // + double decisionVale = decisionConditions.x121Conditions.valesBuffer[1]; + double isNewDecisionVale = decisionConditions.x121Conditions.isNewVale; + + // + bool isTriggerRSICrossedOverOverSold = triggerConditions.x121Conditions.isRSICrossedOverOverSold; + bool isTriggerRSICrossedUnderOverBought = triggerConditions.x121Conditions.isRSICrossedUnderOverBought; + + // + bool isDecisionRSICrossedOverOverSold = decisionConditions.x121Conditions.isRSICrossedOverOverSold; + bool isDecisionRSICrossedUnderOverBought = decisionConditions.x121Conditions.isRSICrossedUnderOverBought; + + // + // Waits For Price to Go Inside FVG ... + bool isPriceInsideOB = IsPriceInsideZone( + cBar, + conditions.fvgOB.orderBlock // + ); + + // + bool isPriceInsideFVG = IsPriceInsideZone( + cBar, + conditions.fvgOB.fairValueGap // + ); + + // + result = isPriceInsideOB && + isPriceInsideFVG && + conditions.fvgOB.IsValid(); + if (!result) + { + return result; + } + + // + double fvgOBUpper = 0; + double fvgOBLower = 0; + bool hasBoundary = conditions.fvgOB.GetBoundary( + fvgOBUpper, + fvgOBLower // + ); + result = hasBoundary; + if (!result) + { + return result; + } + + // + // Detect Bullish Conditions ... + isBullish = + isBullish && + cBar.IsBullish() && + decisionVale < fvgOBUpper && + decisionVale > fvgOBLower + // && + // isTriggerRSICrossedOverOverSold + ; + + // + // Detect Bearish Conditions ... + isBearish = + isBearish && + cBar.IsBearish() && + decisionPeak < fvgOBUpper && + decisionPeak > fvgOBLower + // && + // isTriggerRSICrossedUnderOverBought + ; + + // + result = isBullish || + isBearish; + if (!result) + { + // + // Cleanup Setup Conditions ... + + // + return result; + } + + // + // Detect Nearest Pivot Point ... + + // + // Detect Target ... + double target = CalculateTarget( + cBar, + analyseState, + setupDir // + ); + if (target == 0) + { + // + target = CalculateTarget( + cBar, + verificationState, + setupDir // + ); + } + + // + double oppositTarget = CalculateTarget( + cBar, + analyseState, + Opposit(setupDir) // + ); + + // + double entry = GetEntry( + conditions.symbol, + setupDir // + ); + + // + // Filling SL Candidates ... + + // + double sls[]; + + // + double atr = triggerConditions.x121Conditions.atrBuffer[1]; + double peak = triggerConditions.x121Conditions.peaksBuffer[1]; + double vale = triggerConditions.x121Conditions.valesBuffer[1]; + + // + if (conditions.fvgOB.IsValid()) + { + // + Add( + fvgOBUpper, + sls // + ); + + // + Add( + fvgOBLower, + sls // + ); + } + + // + if (isBullish) + { + // + double lowerVale = triggerCycleHelper.mX121Helper.xpvHelper.GetLowerVale(vale); + if (lowerVale > 0) + { + // + Add( + lowerVale, + sls // + ); + } + + // + Add( + vale, + sls // + ); + } + else if (isBearish) + { + // + double higherPeak = triggerCycleHelper.mX121Helper.xpvHelper.GetHigherPeak(peak); + if (higherPeak > 0) + { + // + Add( + higherPeak, + sls // + ); + } + + // + Add( + peak, + sls // + ); + } + + // + double slsMin = GetMin(sls); + double slsMax = GetMax(sls); + + // + double sl = isBullish + ? slsMin - atr + : slsMax + atr; + double risk = MathAbs(entry - sl); + double targetDelta = 2 * (risk / 3); + if (target == 0) + { + // + int minTargetPint = 50; + double minTargetPointValue = minTargetPint * points; + if (targetDelta < minTargetPointValue) + { + targetDelta = minTargetPointValue; + } + + // + // Force Target On Half Risk ... + target = + isBullish + ? entry + targetDelta + : entry - targetDelta; + + // + target = 0; + + // + } + + // + // Ignore Target ... + target = 0; + + // + // Filling Conditions Props ... + conditions.sl = sl; + conditions.target = target; + conditions.triggerTime = cTime; + conditions.type = isBullish + ? X_POSITION_TYPE_LONG + : X_POSITION_TYPE_SHORT; + + // + return result; +} + +// +int AddX121SMCXOBGPVConditionsIfNotExists( + X121SMCStrategyXOBGPVSignalConditions &item, + X121SMCStrategyXOBGPVSignalConditions &items[], + int maxAllowed = 10 // +) +{ + // + int result = 0; + + // + bool isSetuped = IsValid(item.setupTime) && + HasDirection(item.dir); + if (!isSetuped) + { + return result; + } + + // + int count = ArraySize(items); + bool canAdd = !IsValidSize(count); + if (!canAdd) + { + // + // Prese Item Data ... + bool isBullish = IsBullish(item.dir); + + // + bool hasSame = false; + for (int i = 0; i < count; i++) + { + // + X121SMCStrategyXOBGPVSignalConditions iItem = items[i]; + + // + hasSame = iItem.fvgOB.IsSameAs(item.fvgOB); + if (hasSame) + { + break; + } + } + + // + canAdd = !hasSame; + } + + // + if (canAdd) + { + // + AddRef( + item, + items // + ); + + // + // Remove Olds ... + CleanupArray( + items, + maxAllowed // + ); + + // + result = ArraySize(items); + } + + // + return result; +} + +// +// Draw Signal ... +int DrawX121SMCXOBGPVSiganl( + X121SMCStrategyXOBGPVSignalConditions &conditions, + XCBaseObject *&drawnObjects[], + XCPOIDrawer *drawer // +) +{ + // + int result = 0; + + // + Clean(drawnObjects); + + // + if (drawer == NULL) + { + return result; + } + + // + bool isSetuped = conditions.IsSetuped(); + if (!isSetuped) + { + return result; + } + + // + bool isBullish = IsBullish(conditions.dir); + + // + result = ArraySize(drawnObjects); + + // + return result; +} + +// diff --git a/X121SMCEA/Signals/x-121.smc.xtwpv.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xtwpv.signal.lib copy.mq5 similarity index 100% rename from X121SMCEA/Signals/x-121.smc.xtwpv.signal.lib.mq5 rename to X121SMCEA/Signals/x-121.smc.xtwpv.signal.lib copy.mq5 diff --git a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 index 02da18d5..2f21148c 100644 --- a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 +++ b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 @@ -28,7 +28,7 @@ // #include "../Signals/x-121.smc.test.signal.lib.mq5" -#include "../Signals/x-121.smc.xtwpv.signal.lib.mq5" +#include "../Signals/x-121.smc.xobgpv.signal.lib.mq5" // // Definitions ... @@ -184,11 +184,11 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // bool useTestSignal = false; - bool useXTWPVSignal = true; + bool useXOBGPVSignal = true; // bool hasTestSignal = false; - bool hasXTWPVSignal = false; + bool hasXOBGPVSignal = false; // // Test Signal ... @@ -200,12 +200,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy } // - // XTWPV Signal ... - if (useXTWPVSignal && !hasSignal) + // XOBGPV Signal ... + if (useXOBGPVSignal && !hasSignal) { // - hasXTWPVSignal = DetectXTWPVSignal(conditions); - hasSignal = hasXTWPVSignal; + hasXOBGPVSignal = DetectXOBGPVSignal(conditions); + hasSignal = hasXOBGPVSignal; } // @@ -476,10 +476,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy } // - // XTWPV Signal ... - X121SMCStrategyXTWPVSignalConditions mXTWPVConditions; - X121SMCStrategyXTWPVSignalConditions mXTWPVConditionsCollection[]; - bool DetectXTWPVSignal( + // XOBGPV Signal ... + X121SMCStrategyXOBGPVSignalConditions mXOBGPVConditions; + X121SMCStrategyXOBGPVSignalConditions mXOBGPVConditionsCollection[]; + bool DetectXOBGPVSignal( X121SMCStrategyConditions &conditions // ) { @@ -544,22 +544,22 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy datetime cTime = TimeCurrent(); // - ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XTWPV; + ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XOBGPV; string providerStr = ToString(provider); // // Detect Setup Conditions ... - datetime setupTime = mXTWPVConditions.setupTime; - bool isSetuped = mXTWPVConditions.IsSetuped(); - ENUM_X_DIRECTION setupDir = mXTWPVConditions.dir; + datetime setupTime = mXOBGPVConditions.setupTime; + bool isSetuped = mXOBGPVConditions.IsSetuped(); + ENUM_X_DIRECTION setupDir = mXOBGPVConditions.dir; if (!isSetuped) { // // Detect Signal Setup ... - isSetuped = DetectX121SMCXTWPVSiganlSetup( + isSetuped = DetectX121SMCXOBGPVSiganlSetup( symbol, period, - mXTWPVConditions, + mXOBGPVConditions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, @@ -569,25 +569,25 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy ); // - setupDir = mXTWPVConditions.dir; - setupTime = mXTWPVConditions.setupTime; + setupDir = mXOBGPVConditions.dir; + setupTime = mXOBGPVConditions.setupTime; // if (isSetuped) { // - int items = AddX121SMCXTWPVConditionsIfNotExists( - mXTWPVConditions, - mXTWPVConditionsCollection // + int items = AddX121SMCXOBGPVConditionsIfNotExists( + mXOBGPVConditions, + mXOBGPVConditionsCollection // ); // - mXTWPVConditions.Clean(); + mXOBGPVConditions.Clean(); } } // - int conditionsCount = ArraySize(mXTWPVConditionsCollection); + int conditionsCount = ArraySize(mXOBGPVConditionsCollection); result = IsValidSize(conditionsCount); if (!result) { @@ -597,12 +597,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // Looking For Conditions ... int selectedIndex = 0; - X121SMCStrategyXTWPVSignalConditions mTmpConditions[]; + X121SMCStrategyXOBGPVSignalConditions mTmpConditions[]; Copy( - mXTWPVConditionsCollection, + mXOBGPVConditionsCollection, mTmpConditions // ); - X121SMCStrategyXTWPVSignalConditions mConditions; + X121SMCStrategyXOBGPVSignalConditions mConditions; for (int i = 0; i < conditionsCount; i++) { // @@ -648,7 +648,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy { // ArrayRemove( - mXTWPVConditionsCollection, + mXOBGPVConditionsCollection, i, 1 // ); @@ -665,7 +665,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy { // // Detect Signal Trigger ... - canTrigger = DetectX121SMCXTWPVSiganlTrigger( + canTrigger = DetectX121SMCXOBGPVSiganlTrigger( mTmpConditions[i], symbol, period, @@ -709,7 +709,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // Remove Selected Index from Main Collection ... ArrayRemove( - mXTWPVConditionsCollection, + mXOBGPVConditionsCollection, selectedIndex, 1 // );