// // X Signal ... bool DetectXSignal( X121SMCStrategyConditions &conditions // ) { // bool result = false; // bool isBullish = false; bool isBearish = false; // int zIndex = 0; int cIndex = zIndex + 1; int pIndex = cIndex + 1; int ppIndex = pIndex + 1; // string symbol = GetSymbol(); ENUM_TIMEFRAMES period = GetPeriod(); // 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 cLL = cBar.FindLowest(7, MODE_LOW); double cHH = cBar.FindHighest(7, MODE_HIGH); // datetime cTime = TimeCurrent(); // ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_X; string providerStr = ToString(provider); // // Detect Setup Conditions ... datetime setupTime = mXConditions.setupTime; bool isSetuped = mXConditions.IsSetuped(); ENUM_X_DIRECTION setupDir = mXConditions.dir; if (!isSetuped) { // // Detect Signal Setup ... isSetuped = DetectX121SMCXSiganlSetup( symbol, period, mXConditions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // setupDir = mXConditions.dir; setupTime = mXConditions.setupTime; // // // bool hasPivot = mXConditions.pivotZone.IsValid(); // if (hasPivot) // { // // // XCBaseObject *drawnObjects[]; // int drawnCount = DrawX121SMCXConditions( // mXConditions, // drawnObjects, // mPOIDrawer // // ); // if (IsValidSize(drawnCount)) // { // AddObjectsIfNotExists(drawnObjects); // } // } // if (isSetuped) { // int items = AddX121SMCXConditionsIfNotExists( mXConditions, mXConditionsCollection // ); // mXConditions.Clean(); } } // int conditionsCount = ArraySize(mXConditionsCollection); result = IsValidSize(conditionsCount); if (!result) { return result; } // // Looking For Conditions ... int selectedIndex = 0; X121SMCStrategyXSignalConditions mTmpConditions[]; Copy( mXConditionsCollection, mTmpConditions // ); X121SMCStrategyXSignalConditions mConditions; for (int i = 0; i < conditionsCount; i++) { // // Check Triggers ... bool canTrigger = mTmpConditions[i].CanTrigger(); datetime triggerTime = mTmpConditions[i].triggerTime; if (!canTrigger) { // // Detect Signal Trigger ... canTrigger = DetectX121SMCXSiganlTrigger( mTmpConditions[i], symbol, period, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // result = canTrigger; if (!result) { // bool isISetuped = mTmpConditions[i].IsSetuped(); if (!isISetuped) { // ArrayRemove( mXConditionsCollection, i, 1 // ); } continue; } // triggerTime = mTmpConditions[i].triggerTime; } // if (canTrigger) { // selectedIndex = i; mConditions = mTmpConditions[i]; break; } } // result = IsValid(mConditions.setupTime) && HasDirection(mConditions.dir); if (!result) { return result; } // // Remove Selected Index from Main Collection ... ArrayRemove( mXConditionsCollection, selectedIndex, 1 // ); // // Check Signal Direction ... isBullish = IsBullish(mConditions.dir); isBearish = IsBearish(mConditions.dir); result = isBullish || isBearish; if (!result) { return result; } // // Issues Signal on Conditions ... conditions.sl = mConditions.sl; conditions.provider = providerStr; conditions.signalDir = mConditions.dir; conditions.target = mConditions.target; // return result; } // // XPZ Signal ... bool DetectXPZSignal( X121SMCStrategyConditions &conditions // ) { // bool result = false; // bool isBullish = false; bool isBearish = false; // int zIndex = 0; int cIndex = zIndex + 1; int pIndex = cIndex + 1; int ppIndex = pIndex + 1; // string symbol = GetSymbol(); ENUM_TIMEFRAMES period = GetPeriod(); // 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 cLL = cBar.FindLowest(7, MODE_LOW); double cHH = cBar.FindHighest(7, MODE_HIGH); // datetime cTime = TimeCurrent(); // ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XPZ; string providerStr = ToString(provider); // // Detect Setup Conditions ... datetime setupTime = mXPZConditions.setupTime; bool isSetuped = mXPZConditions.IsSetuped(); ENUM_X_DIRECTION setupDir = mXPZConditions.dir; if (!isSetuped) { // // Detect Signal Setup ... isSetuped = DetectX121SMCXPZSiganlSetup( symbol, period, mXPZConditions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // setupDir = mXPZConditions.dir; setupTime = mXPZConditions.setupTime; // if (isSetuped) { // int items = AddX121SMCXPZConditionsIfNotExists( mXPZConditions, mXPZConditionsCollection // ); // mXPZConditions.Clean(); } } // int conditionsCount = ArraySize(mXPZConditionsCollection); result = IsValidSize(conditionsCount); if (!result) { return result; } // // Looking For Conditions ... int selectedIndex = 0; X121SMCStrategyXPZSignalConditions mTmpConditions[]; Copy( mXPZConditionsCollection, mTmpConditions // ); X121SMCStrategyXPZSignalConditions mConditions; for (int i = 0; i < conditionsCount; i++) { // // Check Triggers ... bool canTrigger = mTmpConditions[i].CanTrigger(); datetime triggerTime = mTmpConditions[i].triggerTime; if (!canTrigger) { // // Detect Signal Trigger ... canTrigger = DetectX121SMCXPZSiganlTrigger( mTmpConditions[i], symbol, period, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // result = canTrigger; if (!result) { // bool isISetuped = mTmpConditions[i].IsSetuped(); if (!isISetuped) { // ArrayRemove( mXPZConditionsCollection, i, 1 // ); } continue; } // triggerTime = mTmpConditions[i].triggerTime; } // if (canTrigger) { // selectedIndex = i; mConditions = mTmpConditions[i]; break; } } // result = IsValid(mConditions.setupTime) && HasDirection(mConditions.dir); if (!result) { return result; } // // Remove Selected Index from Main Collection ... ArrayRemove( mXPZConditionsCollection, selectedIndex, 1 // ); // // Check Signal Direction ... isBullish = IsBullish(mConditions.dir); isBearish = IsBearish(mConditions.dir); result = isBullish || isBearish; if (!result) { return result; } // // Issues Signal on Conditions ... conditions.sl = mConditions.sl; conditions.provider = providerStr; conditions.signalDir = mConditions.dir; conditions.target = mConditions.target; // return result; } // // XPVT Signal ... bool DetectXPVTSignal( X121SMCStrategyConditions &conditions // ) { // bool result = false; // bool isBullish = false; bool isBearish = false; // int zIndex = 0; int cIndex = zIndex + 1; int pIndex = cIndex + 1; int ppIndex = pIndex + 1; // string symbol = GetSymbol(); ENUM_TIMEFRAMES period = GetPeriod(); // 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 cLL = cBar.FindLowest(7, MODE_LOW); double cHH = cBar.FindHighest(7, MODE_HIGH); // datetime cTime = TimeCurrent(); // ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XPVT; string providerStr = ToString(provider); // // Detect Setup Conditions ... datetime setupTime = mXPVTConditions.setupTime; bool isSetuped = mXPVTConditions.IsSetuped(); ENUM_X_DIRECTION setupDir = mXPVTConditions.dir; if (!isSetuped) { // // Detect Signal Setup ... isSetuped = DetectX121SMCXPVTSiganlSetup( symbol, period, mXPVTConditions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // setupDir = mXPVTConditions.dir; setupTime = mXPVTConditions.setupTime; // if (isSetuped) { // int items = AddX121SMCXPVTConditionsIfNotExists( mXPVTConditions, mXPVTConditionsCollection // ); // mXPVTConditions.Clean(); } } // int conditionsCount = ArraySize(mXPVTConditionsCollection); result = IsValidSize(conditionsCount); if (!result) { return result; } // // Looking For Conditions ... int selectedIndex = 0; X121SMCStrategyXPVTSignalConditions mTmpConditions[]; Copy( mXPVTConditionsCollection, mTmpConditions // ); X121SMCStrategyXPVTSignalConditions mConditions; for (int i = 0; i < conditionsCount; i++) { // // Check Triggers ... bool canTrigger = mTmpConditions[i].CanTrigger(); datetime triggerTime = mTmpConditions[i].triggerTime; if (!canTrigger) { // // Detect Signal Trigger ... canTrigger = DetectX121SMCXPVTSiganlTrigger( mTmpConditions[i], symbol, period, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // result = canTrigger; if (!result) { // bool isISetuped = mTmpConditions[i].IsSetuped(); if (!isISetuped) { // ArrayRemove( mXPVTConditionsCollection, i, 1 // ); } continue; } // triggerTime = mTmpConditions[i].triggerTime; } // if (canTrigger) { // selectedIndex = i; mConditions = mTmpConditions[i]; break; } } // result = IsValid(mConditions.setupTime) && HasDirection(mConditions.dir); if (!result) { return result; } // // Remove Selected Index from Main Collection ... ArrayRemove( mXPVTConditionsCollection, selectedIndex, 1 // ); // // Check Signal Direction ... isBullish = IsBullish(mConditions.dir); isBearish = IsBearish(mConditions.dir); result = isBullish || isBearish; if (!result) { return result; } // // Issues Signal on Conditions ... conditions.sl = mConditions.sl; conditions.provider = providerStr; conditions.signalDir = mConditions.dir; conditions.target = mConditions.target; // return result; } // // XSTRPV Signal ... bool DetectXSTRPVSignal( X121SMCStrategyConditions &conditions // ) { // bool result = false; // bool isBullish = false; bool isBearish = false; // int zIndex = 0; int cIndex = zIndex + 1; int pIndex = cIndex + 1; int ppIndex = pIndex + 1; // string symbol = GetSymbol(); ENUM_TIMEFRAMES period = GetPeriod(); // 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 cLL = cBar.FindLowest(7, MODE_LOW); double cHH = cBar.FindHighest(7, MODE_HIGH); // datetime cTime = TimeCurrent(); // ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XSTRPV; string providerStr = ToString(provider); // // Detect Setup Conditions ... datetime setupTime = mXSTRPVConditions.setupTime; bool isSetuped = mXSTRPVConditions.IsSetuped(); ENUM_X_DIRECTION setupDir = mXSTRPVConditions.dir; if (!isSetuped) { // // Detect Signal Setup ... isSetuped = DetectX121SMCXSTRPVSiganlSetup( symbol, period, mXSTRPVConditions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // setupDir = mXSTRPVConditions.dir; setupTime = mXSTRPVConditions.setupTime; // if (isSetuped) { // int items = AddX121SMCXSTRPVConditionsIfNotExists( mXSTRPVConditions, mXSTRPVConditionsCollection // ); // mXSTRPVConditions.Clean(); } } // int conditionsCount = ArraySize(mXSTRPVConditionsCollection); result = IsValidSize(conditionsCount); if (!result) { return result; } // // Looking For Conditions ... int selectedIndex = 0; X121SMCStrategyXSTRPVSignalConditions mTmpConditions[]; Copy( mXSTRPVConditionsCollection, mTmpConditions // ); X121SMCStrategyXSTRPVSignalConditions mConditions; for (int i = 0; i < conditionsCount; i++) { // // Check Triggers ... bool canTrigger = mTmpConditions[i].CanTrigger(); datetime triggerTime = mTmpConditions[i].triggerTime; if (!canTrigger) { // // Detect Signal Trigger ... canTrigger = DetectX121SMCXSTRPVSiganlTrigger( mTmpConditions[i], symbol, period, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // result = canTrigger; if (!result) { // bool isISetuped = mTmpConditions[i].IsSetuped(); if (!isISetuped) { // ArrayRemove( mXSTRPVConditionsCollection, i, 1 // ); } continue; } // triggerTime = mTmpConditions[i].triggerTime; } // if (canTrigger) { // selectedIndex = i; mConditions = mTmpConditions[i]; break; } } // result = IsValid(mConditions.setupTime) && HasDirection(mConditions.dir); if (!result) { return result; } // // Remove Selected Index from Main Collection ... ArrayRemove( mXSTRPVConditionsCollection, selectedIndex, 1 // ); // // Check Signal Direction ... isBullish = IsBullish(mConditions.dir); isBearish = IsBearish(mConditions.dir); result = isBullish || isBearish; if (!result) { return result; } // // Issues Signal on Conditions ... conditions.sl = mConditions.sl; conditions.provider = providerStr; conditions.signalDir = mConditions.dir; conditions.target = mConditions.target; // return result; } // // XRSPVI Signal ... bool DetectXRSPVISignal( X121SMCStrategyConditions &conditions // ) { // bool result = false; // bool isBullish = false; bool isBearish = false; // int zIndex = 0; int cIndex = zIndex + 1; int pIndex = cIndex + 1; int ppIndex = pIndex + 1; // string symbol = GetSymbol(); ENUM_TIMEFRAMES period = GetPeriod(); // 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 cLL = cBar.FindLowest(7, MODE_LOW); double cHH = cBar.FindHighest(7, MODE_HIGH); // datetime cTime = TimeCurrent(); // ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XRSPVI; string providerStr = ToString(provider); // // Detect Setup Conditions ... datetime setupTime = mXRSPVIConditions.setupTime; bool isSetuped = mXRSPVIConditions.IsSetuped(); ENUM_X_DIRECTION setupDir = mXRSPVIConditions.dir; if (!isSetuped) { // // Detect Signal Setup ... isSetuped = DetectX121SMCXRSPVISiganlSetup( symbol, period, mXRSPVIConditions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // setupDir = mXRSPVIConditions.dir; setupTime = mXRSPVIConditions.setupTime; // if (isSetuped) { // int items = AddX121SMCXRSPVIConditionsIfNotExists( mXRSPVIConditions, mXRSPVIConditionsCollection // ); // mXRSPVIConditions.Clean(); } } // int conditionsCount = ArraySize(mXRSPVIConditionsCollection); result = IsValidSize(conditionsCount); if (!result) { return result; } // // Looking For Conditions ... int selectedIndex = 0; X121SMCStrategyXRSPVISignalConditions mTmpConditions[]; Copy( mXRSPVIConditionsCollection, mTmpConditions // ); X121SMCStrategyXRSPVISignalConditions mConditions; for (int i = 0; i < conditionsCount; i++) { // // Check Triggers ... bool canTrigger = mTmpConditions[i].CanTrigger(); datetime triggerTime = mTmpConditions[i].triggerTime; if (!canTrigger) { // // Detect Signal Trigger ... canTrigger = DetectX121SMCXRSPVISiganlTrigger( mTmpConditions[i], symbol, period, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); // result = canTrigger; if (!result) { // bool isISetuped = mTmpConditions[i].IsSetuped(); if (!isISetuped) { // ArrayRemove( mXRSPVIConditionsCollection, i, 1 // ); } continue; } // triggerTime = mTmpConditions[i].triggerTime; } // if (canTrigger) { // selectedIndex = i; mConditions = mTmpConditions[i]; break; } } // result = IsValid(mConditions.setupTime) && HasDirection(mConditions.dir); if (!result) { return result; } // // Remove Selected Index from Main Collection ... ArrayRemove( mXRSPVIConditionsCollection, selectedIndex, 1 // ); // // Check Signal Direction ... isBullish = IsBullish(mConditions.dir); isBearish = IsBearish(mConditions.dir); result = isBullish || isBearish; if (!result) { return result; } // // Issues Signal on Conditions ... conditions.sl = mConditions.sl; conditions.provider = providerStr; conditions.signalDir = mConditions.dir; conditions.target = mConditions.target; // return result; } //////////////////////////////////////////////////////// // // X Signal ... if (useXSignal && !hasSignal) { // hasXSignal = DetectXSignal(conditions); hasSignal = hasXSignal; } // // XPZ Signal ... if (useXPZSignal && !hasSignal) { // hasXPZSignal = DetectXPZSignal(conditions); hasSignal = hasXPZSignal; } // // XPVT Signal ... if (useXPVTSignal && !hasSignal) { // hasXPVTSignal = DetectXPVTSignal(conditions); hasSignal = hasXPVTSignal; } // // XRSPVI Signal ... if (useXRSPVISignal && !hasSignal) { // hasXRSPVISignal = DetectXRSPVISignal(conditions); hasSignal = hasXRSPVISignal; } // // XSTRPV Signal ... if (useXSTRPVSignal && !hasSignal) { // hasXSTRPVSignal = DetectXSTRPVSignal(conditions); hasSignal = hasXSTRPVSignal; } ///////////////////////////////////////////////////////////////// // // X Guard Detection ... if (useXSignal) { // bool hasGuard = DetectX121SMCXGuards( guards, positions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); } // // XPZ Guard Detection ... if (useXPZSignal) { // bool hasGuard = DetectX121SMCXPZGuards( guards, positions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); } // // XPVT Guard Detection ... if (useXPVTSignal) { // bool hasGuard = DetectX121SMCXPVTGuards( guards, positions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); } // // XSTRPV Guard Detection ... if (useXSTRPVSignal) { // bool hasGuard = DetectX121SMCXSTRPVGuards( guards, positions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); } // // XRSPVI Guard Detection ... if (useXRSPVISignal) { // bool hasGuard = DetectX121SMCXRSPVIGuards( guards, positions, mTriggerCycleHelper, mDecisionCycleHelper, mAnalyseCycleHelper, mVerificationCycleHelper, mConsolidationCycleHelper, mVisionCycleHelper // ); } ////////////////////////////////////////////////// const string X121SMCXPVTToken = "X121XPVT"; const string X121SMCXRSPVIToken = "X121XRSPVI"; const string X121SMCXSTRPVToken = "X121XSTRPV"; const string X121SMCXPZToken = "X121XPZ"; // switch (value) { // case X_121_SMC_PROVIDER_X: result = X121SMCXToken; break; // case X_121_SMC_PROVIDER_XPZ: result = X121SMCXOBPVToken; break; // case X_121_SMC_PROVIDER_XPVT: result = X121SMCXPVTToken; break; // case X_121_SMC_PROVIDER_XRSPVI: result = X121SMCXRSPVIToken; break; // case X_121_SMC_PROVIDER_XSTRPV: result = X121SMCXSTRPVToken; break; } // if (Contains(X121SMCXToken, value)) { result = X_121_SMC_PROVIDER_X; } else if (Contains(X121SMCXOBPVToken, value)) { result = X_121_SMC_PROVIDER_XOBPV; } else if (Contains(X121SMCXPVTToken, value)) { result = X_121_SMC_PROVIDER_XPVT; } else if (Contains(X121SMCXRSPVIToken, value)) { result = X_121_SMC_PROVIDER_XRSPVI; } else if (Contains(X121SMCXSTRPVToken, value)) { result = X_121_SMC_PROVIDER_XSTRPV; }