//////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 X12 Conditions Parser Library // ----------------------------------------------------- // Name: X121ConditionsParser // Description: provides Market Conditions // Parsing Requirements ... // // // 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 // #include "../Libraries/x-saherelm.common.lib.mq5" #include "../Libraries/x-saherelm.models.lib.mq5" #include "../Classes/x-saherelm.x121.provider.class.mq5" // // START Functions ... // // // PARSE STATES ... // // // SSLC ... // // bool IsSSLCBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.sslcUps[index] > conditions.xmanInfo.sslcDowns[index] // ; // return result; } // bool IsSSLCSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSSLCBullish(conditions, index) && !IsSSLCBullish(conditions, index + 1) // ; // return result; } // bool IsSSLCBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.sslcUps[index] < conditions.xmanInfo.sslcDowns[index] // ; // return result; } // bool IsSSLCSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSSLCBearish(conditions, index) && !IsSSLCBearish(conditions, index + 1) // ; // return result; } // // HULL ... // // bool IsHullBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullUpBullish(conditions, index) && IsHullDownBullish(conditions, index) // ; // return result; } // bool IsHullSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullBullish(conditions, index) && !IsHullBullish(conditions, index + 1) // ; // return result; } // bool IsHullBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullUpBearish(conditions, index) && IsHullDownBearish(conditions, index) // ; // return result; } // bool IsHullSwitchedBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullBearish(conditions, index) && !IsHullBearish(conditions, index + 1) // ; // return result; } // // UP ... // // BULLISH ... // bool IsHullUpBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hullUps[index] > conditions.xmanInfo.hullUps[index + 1] // ; // return result; } // bool IsHullUpSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullUpBullish(conditions, index) && !IsHullUpBullish(conditions, index + 1) // ; // return result; } // // BEARISH ... // bool IsHullUpBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hullUps[index] < conditions.xmanInfo.hullUps[index + 1] // ; // return result; } // bool IsHullUpSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullUpBearish(conditions, index) && !IsHullUpBearish(conditions, index + 1) // ; // return result; } // // DOWN ... // // BULLISH ... // bool IsHullDownBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hullDowns[index] > conditions.xmanInfo.hullDowns[index + 1] // ; // return result; } // bool IsHullDownSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullDownBullish(conditions, index) && !IsHullDownBullish(conditions, index + 1) // ; // return result; } // // BEARISH ... // bool IsHullDownBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hullDowns[index] < conditions.xmanInfo.hullDowns[index + 1] // ; // return result; } // bool IsHullDownSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullDownBearish(conditions, index) && !IsHullDownBearish(conditions, index + 1) // ; // return result; } // // TREND ... // // // Check Trend Bullish ... bool IsTrendBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.candles[index].low > conditions.xmanInfo.trends[index] // ; // return result; } // // Check Trend Switched To Bullish ... bool IsTrendSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsTrendBullish(conditions, index) && !IsTrendBullish(conditions, index + 1) // ; // return result; } // // Check Trend Bearish ... bool IsTrendBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.candles[index].high < conditions.xmanInfo.trends[index] // ; // return result; } // // Check Trend Switched To Bearish ... bool IsTrendSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsTrendBearish(conditions, index) && !IsTrendBearish(conditions, index + 1) // ; // return result; } // // RIBBON ... // // double GetRibbonMax( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // double result = 0; // result = MathMax(conditions.xmanInfo.ribbon1s[index], conditions.xmanInfo.ribbon2s[index]); result = MathMax(result, conditions.xmanInfo.ribbon3s[index]); result = MathMax(result, conditions.xmanInfo.ribbon4s[index]); result = MathMax(result, conditions.xmanInfo.ribbon5s[index]); result = MathMax(result, conditions.xmanInfo.ribbon6s[index]); // return result; } // double GetRibbonMin( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // double result = 0; // result = MathMin(conditions.xmanInfo.ribbon1s[index], conditions.xmanInfo.ribbon2s[index]); result = MathMin(result, conditions.xmanInfo.ribbon3s[index]); result = MathMin(result, conditions.xmanInfo.ribbon4s[index]); result = MathMin(result, conditions.xmanInfo.ribbon5s[index]); result = MathMin(result, conditions.xmanInfo.ribbon6s[index]); // return result; } // // Check Ribbon States ... // Working With Price and Ribbon Values ... bool IsRibbonBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.candles[index].low > conditions.xmanInfo.ribbon1s[index] && conditions.candles[index].low > conditions.xmanInfo.ribbon2s[index] && conditions.candles[index].low > conditions.xmanInfo.ribbon3s[index] && conditions.candles[index].low > conditions.xmanInfo.ribbon4s[index] && conditions.candles[index].low > conditions.xmanInfo.ribbon5s[index] && conditions.candles[index].low > conditions.xmanInfo.ribbon6s[index] // ; // return result; } // // Check Ribbons Sequntial Statements ... // Working with Price and Ribbon Values and also Ribbon Orders bool IsRibbonOrderBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsRibbonBullish(conditions, index) // && // GetRibbonMax(conditions, index) == conditions.xmanInfo.ribbon1s[index] // && // GetRibbonMin(conditions, index) == conditions.xmanInfo.ribbon6s[index] // ; // return result; } // bool IsRibbonSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsRibbonBullish(conditions, index) && !IsRibbonBullish(conditions, index + 1) // ; // return result; } // // Check Ribbons Sequntial Statements ... bool IsRibbonOrderSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsRibbonOrderBullish(conditions, index) && !IsRibbonOrderBullish(conditions, index + 1) // ; // return result; } // // Check Ribbon States ... // Working With Price and Ribbon Values ... bool IsRibbonBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.candles[index].high < conditions.xmanInfo.ribbon1s[index] && conditions.candles[index].high < conditions.xmanInfo.ribbon2s[index] && conditions.candles[index].high < conditions.xmanInfo.ribbon3s[index] && conditions.candles[index].high < conditions.xmanInfo.ribbon4s[index] && conditions.candles[index].high < conditions.xmanInfo.ribbon5s[index] && conditions.candles[index].high < conditions.xmanInfo.ribbon6s[index] // ; // return result; } // // Check Ribbons Sequntial Statements ... // Working with Price and Ribbon Values and also Ribbon Orders bool IsRibbonOrderBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsRibbonBearish(conditions, index) // && // GetRibbonMax(conditions, index) == conditions.xmanInfo.ribbon1s[index] // && // GetRibbonMin(conditions, index) == conditions.xmanInfo.ribbon6s[index] // ; // return result; } // bool IsRibbonSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsRibbonBearish(conditions, index) && !IsRibbonBearish(conditions, index + 1) // ; // return result; } // // Check Ribbons Sequntial Statements ... bool IsRibbonOrderSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsRibbonOrderBearish(conditions, index) && !IsRibbonOrderBearish(conditions, index + 1) // ; // return result; } // // PEAKS and VALES and Levels ... // // // Check Peak Same as Last ... bool IsPeakSameAs( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int length = 5 // Comparing Period ) { // bool result = false; // if (length <= 0) { return result; } // double selected = conditions.xmanInfo.peaks[index]; // int start = index + 1; int end = start + length; // int verified = 0; for (int i = start; i < end; i++) { // double iValue = conditions.xmanInfo.peaks[i]; // if (iValue == selected) { verified++; } } // result = verified == length; // return result; } // // Check New Peaks Happens ... bool IsNewPeak( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.peaks[index] != EMPTY_VALUE && conditions.xmanInfo.peaks[index] != conditions.xmanInfo.peaks[index + 1] // ; // return result; } // // Check New Peaks Happens Over Last ... bool IsNewPeakOverLast( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsNewPeak(conditions, index) && conditions.xmanInfo.peaks[index] > conditions.xmanInfo.peaks[index + 1] // ; // return result; } // // Check New Peaks Happens Under Last ... bool IsNewPeakUnderLast( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsNewPeak(conditions, index) && conditions.xmanInfo.peaks[index] < conditions.xmanInfo.peaks[index + 1] // ; // return result; } // // Check Valse Same as Last ... bool IsValeSameAs( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int length = 5 // Comparing Period ) { // bool result = false; // if (length <= 0) { return result; } // double selected = conditions.xmanInfo.vales[index]; // int start = index + 1; int end = start + length; // int verified = 0; for (int i = start; i < end; i++) { // double iValue = conditions.xmanInfo.vales[i]; // if (iValue == selected) { verified++; } } // result = verified == length; // return result; } // // Check New Vales Happens ... bool IsNewVale( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.vales[index] != EMPTY_VALUE && conditions.xmanInfo.vales[index] != conditions.xmanInfo.vales[index + 1] // ; // return result; } // // Check New Vales Happens Over Last ... bool IsNewValeOverLast( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsNewVale(conditions, index) && conditions.xmanInfo.vales[index] > conditions.xmanInfo.vales[index + 1] // ; // return result; } // // Check New Vales Happens Under Last ... bool IsNewValeUnderLast( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsNewVale(conditions, index) && conditions.xmanInfo.vales[index] < conditions.xmanInfo.vales[index + 1] // ; // return result; } // // Check Finbonacci Increased ... bool IsFiboIncreased( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.fibLevel1s[index] > conditions.xmanInfo.fibLevel1s[index + 1] && conditions.xmanInfo.fibLevel2s[index] > conditions.xmanInfo.fibLevel2s[index + 1] && conditions.xmanInfo.fibLevel3s[index] > conditions.xmanInfo.fibLevel3s[index + 1] && conditions.xmanInfo.fibLevel4s[index] > conditions.xmanInfo.fibLevel4s[index + 1] && conditions.xmanInfo.fibLevel5s[index] > conditions.xmanInfo.fibLevel5s[index + 1] // ; // return result; } // // Check Fibonacci Decreased ... bool IsFiboDecreased( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.fibLevel1s[index] < conditions.xmanInfo.fibLevel1s[index + 1] && conditions.xmanInfo.fibLevel2s[index] < conditions.xmanInfo.fibLevel2s[index + 1] && conditions.xmanInfo.fibLevel3s[index] < conditions.xmanInfo.fibLevel3s[index + 1] && conditions.xmanInfo.fibLevel4s[index] < conditions.xmanInfo.fibLevel4s[index + 1] && conditions.xmanInfo.fibLevel5s[index] < conditions.xmanInfo.fibLevel5s[index + 1] // ; // return result; } // // Check Fibonacci Crossed ... bool IsFiboCrossed( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.fibLevel1s[index] == conditions.xmanInfo.fibLevel2s[index] || conditions.xmanInfo.fibLevel1s[index] == conditions.xmanInfo.fibLevel3s[index] || conditions.xmanInfo.fibLevel1s[index] == conditions.xmanInfo.fibLevel4s[index] || conditions.xmanInfo.fibLevel1s[index] == conditions.xmanInfo.fibLevel5s[index] || conditions.xmanInfo.fibLevel2s[index] == conditions.xmanInfo.fibLevel3s[index] || conditions.xmanInfo.fibLevel2s[index] == conditions.xmanInfo.fibLevel4s[index] || conditions.xmanInfo.fibLevel2s[index] == conditions.xmanInfo.fibLevel5s[index] || conditions.xmanInfo.fibLevel3s[index] == conditions.xmanInfo.fibLevel4s[index] || conditions.xmanInfo.fibLevel3s[index] == conditions.xmanInfo.fibLevel5s[index] || conditions.xmanInfo.fibLevel4s[index] == conditions.xmanInfo.fibLevel5s[index] // ; // return result; } // // Check Fibonacci Section Changes ... bool IsFiboSectionChanged( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // (IsNewPeakUnderLast(conditions, index) && IsFiboDecreased(conditions, index)) // || // (IsNewValeOverLast(conditions, index) && IsFiboIncreased(conditions, index)) // ; // return result; } // // Market Cycles ... // // ALL Cycles ... // bool IsCyclesBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCBullish(conditions, index) && IsMCBullish(conditions, index) && IsLCBullish(conditions, index) && IsHCBullish(conditions, index) // ; // return result; } // bool IsCyclesSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsCyclesBullish(conditions, index) && !IsCyclesBullish(conditions, index + 1) // ; // return result; } // bool IsCyclesBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCBearish(conditions, index) && IsMCBearish(conditions, index) && IsLCBearish(conditions, index) && IsHCBearish(conditions, index) // ; // return result; } // bool IsCyclesSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsCyclesBearish(conditions, index) && !IsCyclesBearish(conditions, index + 1) // ; // return result; } // bool IsCyclesLowBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCLowBullish(conditions, index) && IsMCLowBullish(conditions, index) && IsLCLowBullish(conditions, index) && IsHCLowBullish(conditions, index) // ; // return result; } // bool IsCyclesLowSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsCyclesLowBullish(conditions, index) && !IsCyclesLowBullish(conditions, index + 1) // ; // return result; } // bool IsCyclesLowBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCLowBearish(conditions, index) && IsMCLowBearish(conditions, index) && IsLCLowBearish(conditions, index) && IsHCLowBearish(conditions, index) // ; // return result; } // bool IsCyclesLowSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsCyclesLowBearish(conditions, index) && !IsCyclesLowBearish(conditions, index + 1) // ; // return result; } // bool IsCyclesHighBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCHighBullish(conditions, index) && IsMCHighBullish(conditions, index) && IsLCHighBullish(conditions, index) && IsHCHighBullish(conditions, index) // ; // return result; } // bool IsCyclesHighSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsCyclesHighBullish(conditions, index) && !IsCyclesHighBullish(conditions, index + 1) // ; // return result; } // bool IsCyclesHighBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCHighBearish(conditions, index) && IsMCHighBearish(conditions, index) && IsLCHighBearish(conditions, index) && IsHCHighBearish(conditions, index) // ; // return result; } // bool IsCyclesHighSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsCyclesHighBearish(conditions, index) && !IsCyclesHighBearish(conditions, index + 1) // ; // return result; } // // INHIND Cycles ... // bool IsInHindCyclesBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCBullish(conditions, index) && IsMCBullish(conditions, index) && IsLCBullish(conditions, index) // ; // return result; } // bool IsInHindCyclesSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsInHindCyclesBullish(conditions, index) && !IsInHindCyclesBullish(conditions, index + 1) // ; // return result; } // bool IsInHindCyclesBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCBearish(conditions, index) && IsMCBearish(conditions, index) && IsLCBearish(conditions, index) // ; // return result; } // bool IsInHindCyclesSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsInHindCyclesBearish(conditions, index) && !IsInHindCyclesBearish(conditions, index + 1) // ; // return result; } // bool IsInHindCyclesLowBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCLowBullish(conditions, index) && IsMCLowBullish(conditions, index) && IsLCLowBullish(conditions, index) // ; // return result; } // bool IsInHindCyclesLowSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsInHindCyclesLowBullish(conditions, index) && !IsInHindCyclesLowBullish(conditions, index + 1) // ; // return result; } // bool IsInHindCyclesHighBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCHighBullish(conditions, index) && IsMCHighBullish(conditions, index) && IsLCHighBullish(conditions, index) // ; // return result; } // bool IsInHindCyclesHighSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsInHindCyclesHighBullish(conditions, index) && !IsInHindCyclesHighBullish(conditions, index + 1) // ; // return result; } // // INLONG Cycles ... // bool IsInLongCyclesBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCBullish(conditions, index) && IsMCBullish(conditions, index) // ; // return result; } // bool IsInLongCyclesSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsInLongCyclesBullish(conditions, index) && !IsInLongCyclesBullish(conditions, index + 1) // ; // return result; } // bool IsInLongCyclesBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCBearish(conditions, index) && IsMCBearish(conditions, index) // ; // return result; } // bool IsInLongCyclesSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsInLongCyclesBearish(conditions, index) && !IsInLongCyclesBearish(conditions, index + 1) // ; // return result; } // // SHORT ... // bool IsSCBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCHighBullish(conditions, index) && IsSCLowBullish(conditions, index) // ; // return result; } // bool IsSCSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCBullish(conditions, index) && !IsSCBullish(conditions, index + 1) // ; // return result; } // bool IsSCBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCHighBearish(conditions, index) && IsSCLowBearish(conditions, index) // ; // return result; } // bool IsSCSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCBearish(conditions, index) && !IsSCBearish(conditions, index + 1) // ; // return result; } // // SHORT HIGH ... // bool IsSCHighBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.sHHs[index] > conditions.xmanInfo.sHHs[index + 1] // ; // return result; } // bool IsSCHighSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCHighBullish(conditions, index) && !IsSCHighBullish(conditions, index + 1) // ; // return result; } // bool IsSCHighBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.sHHs[index] < conditions.xmanInfo.sHHs[index + 1] // ; // return result; } // bool IsSCHighSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCHighBearish(conditions, index) && !IsSCHighBearish(conditions, index + 1) // ; // return result; } // // SHORT LOW ... // bool IsSCLowBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.sLLs[index] > conditions.xmanInfo.sLLs[index + 1] // ; // return result; } // bool IsSCLowSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCLowBullish(conditions, index) && !IsSCLowBullish(conditions, index + 1) // ; // return result; } // bool IsSCLowBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.sLLs[index] < conditions.xmanInfo.sLLs[index + 1] // ; // return result; } // bool IsSCLowSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsSCLowBearish(conditions, index) && !IsSCLowBearish(conditions, index + 1) // ; // return result; } // // MEDIUM ... // bool IsMCBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsMCHighBullish(conditions, index) && IsMCLowBullish(conditions, index) // ; // return result; } // bool IsMCSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsMCBullish(conditions, index) && !IsMCBullish(conditions, index + 1) // ; // return result; } // bool IsMCBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsMCHighBearish(conditions, index) && IsMCLowBearish(conditions, index) // ; // return result; } // bool IsMCSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsMCBearish(conditions, index) && !IsMCBearish(conditions, index + 1) // ; // return result; } // // MEDIUM HIGH ... // bool IsMCHighBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.mHHs[index] > conditions.xmanInfo.mHHs[index + 1] // ; // return result; } // bool IsMCHighSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsMCHighBullish(conditions, index) && !IsMCHighBullish(conditions, index + 1) // ; // return result; } // bool IsMCHighBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.mHHs[index] < conditions.xmanInfo.mHHs[index + 1] // ; // return result; } // bool IsMCHighSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsMCHighBearish(conditions, index) && !IsMCHighBearish(conditions, index + 1) // ; // return result; } // // MEDIUM LOW ... // bool IsMCLowBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.mLLs[index] > conditions.xmanInfo.mLLs[index + 1] // ; // return result; } // bool IsMCLowSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsMCLowBullish(conditions, index) && !IsMCLowBullish(conditions, index + 1) // ; // return result; } // bool IsMCLowBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.mLLs[index] < conditions.xmanInfo.mLLs[index + 1] // ; // return result; } // bool IsMCLowSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsMCLowBearish(conditions, index) && !IsMCLowBearish(conditions, index + 1) // ; // return result; } // // LONG ... // bool IsLCBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsLCHighBullish(conditions, index) && IsLCLowBullish(conditions, index) // ; // return result; } // bool IsLCSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsLCBullish(conditions, index) && !IsLCBullish(conditions, index + 1) // ; // return result; } // bool IsLCBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsLCHighBearish(conditions, index) && IsLCLowBearish(conditions, index) // ; // return result; } // bool IsLCSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsLCBearish(conditions, index) && !IsLCBearish(conditions, index + 1) // ; // return result; } // // LONG HIGH ... // bool IsLCHighBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.lHHs[index] > conditions.xmanInfo.lHHs[index + 1] // ; // return result; } // bool IsLCHighSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsLCHighBullish(conditions, index) && !IsLCHighBullish(conditions, index + 1) // ; // return result; } // bool IsLCHighBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.lHHs[index] < conditions.xmanInfo.lHHs[index + 1] // ; // return result; } // bool IsLCHighSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsLCHighBearish(conditions, index) && !IsLCHighBearish(conditions, index + 1) // ; // return result; } // // LONG LOW ... // bool IsLCLowBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.lLLs[index] > conditions.xmanInfo.lLLs[index + 1] // ; // return result; } // bool IsLCLowSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsLCLowBullish(conditions, index) && !IsLCLowBullish(conditions, index + 1) // ; // return result; } // bool IsLCLowBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.lLLs[index] < conditions.xmanInfo.lLLs[index + 1] // ; // return result; } // bool IsLCLowSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsLCLowBearish(conditions, index) && !IsLCLowBearish(conditions, index + 1) // ; // return result; } // // HIND ... // bool IsHCBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHCHighBullish(conditions, index) && IsHCLowBullish(conditions, index) // ; // return result; } // bool IsHCSwitchedToBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHCBullish(conditions, index) && !IsHCBullish(conditions, index + 1) // ; // return result; } // bool IsHCBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHCHighBearish(conditions, index) && IsHCLowBearish(conditions, index) // ; // return result; } // bool IsHCSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHCBearish(conditions, index) && !IsHCBearish(conditions, index + 1) // ; // return result; } // // HIND HIGH ... // bool IsHCHighBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hHHs[index] > conditions.xmanInfo.hHHs[index + 1] // ; // return result; } // bool IsHCHighSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHCHighBullish(conditions, index) && !IsHCHighBullish(conditions, index + 1) // ; // return result; } // bool IsHCHighBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hHHs[index] < conditions.xmanInfo.hHHs[index + 1] // ; // return result; } // bool IsHCHighSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHCHighBearish(conditions, index) && !IsHCHighBearish(conditions, index + 1) // ; // return result; } // // HIND LOW ... // bool IsHCLowBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hLLs[index] > conditions.xmanInfo.hLLs[index + 1] // ; // return result; } // bool IsHCLowSwitchedBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHCLowBullish(conditions, index) && !IsHCLowBullish(conditions, index + 1) // ; // return result; } // bool IsHCLowBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hLLs[index] < conditions.xmanInfo.hLLs[index + 1] // ; // return result; } // bool IsHCLowSwitchedToBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHCLowBearish(conditions, index) && !IsHCLowBearish(conditions, index + 1) // ; // return result; } // // XHK XSMHK ... // double GetHKMax( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index bool ignoreShadows = false // Ignore Shaddows ) { // double result = 0; // result = MathMax(conditions.xmanInfo.hkOpens[index], conditions.xmanInfo.hkCloses[index]); if (!ignoreShadows) { // double selectedShadow = MathMax(conditions.xmanInfo.hkHighs[index], conditions.xmanInfo.hkLows[index]); // result = MathMax(result, selectedShadow); } // return result; } // double iHKHighest( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int count = 5, // Count ENUM_X_PRICE appliedPrice = X_PRICE_HIGH // Price Type ) { // double result = 0; // // Validate Args ... if (index < 0 || count <= 0) { return result; } // int idx = -1; double tmpArray[]; // switch (appliedPrice) { // case X_PRICE_HIGH: // ArrayCopy( tmpArray, conditions.xmanInfo.hkHighs, 0, index, count // ); break; // case X_PRICE_OPEN: // ArrayCopy( tmpArray, conditions.xmanInfo.hkOpens, 0, index, count // ); break; // case X_PRICE_CLOSE: // ArrayCopy( tmpArray, conditions.xmanInfo.hkCloses, 0, index, count // ); break; // case X_PRICE_LOW: // ArrayCopy( tmpArray, conditions.xmanInfo.hkLows, 0, index, count // ); break; } // idx = ArrayMaximum(tmpArray); if (idx < 0) { return result; } // result = tmpArray[idx]; // return result; } // double iHKLowest( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int count = 5, // Count ENUM_X_PRICE appliedPrice = X_PRICE_LOW // Price Type ) { // double result = 0; // // Validate Args ... if (index < 0 || count <= 0) { return result; } // int idx = -1; double tmpArray[]; // switch (appliedPrice) { // case X_PRICE_HIGH: // ArrayCopy( tmpArray, conditions.xmanInfo.hkHighs, 0, index, count // ); break; // case X_PRICE_OPEN: // ArrayCopy( tmpArray, conditions.xmanInfo.hkOpens, 0, index, count // ); break; // case X_PRICE_CLOSE: // ArrayCopy( tmpArray, conditions.xmanInfo.hkCloses, 0, index, count // ); break; // case X_PRICE_LOW: // ArrayCopy( tmpArray, conditions.xmanInfo.hkLows, 0, index, count // ); break; } // idx = ArrayMinimum(tmpArray); if (idx < 0) { return result; } // result = tmpArray[idx]; // return result; } // double GetHKMin( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index bool ignoreShadows = false // Ignore Shaddows ) { // double result = 0; // result = MathMin(conditions.xmanInfo.hkOpens[index], conditions.xmanInfo.hkCloses[index]); if (!ignoreShadows) { // double selectedShadow = MathMin(conditions.xmanInfo.hkHighs[index], conditions.xmanInfo.hkLows[index]); // result = MathMin(result, selectedShadow); } // return result; } // double GetSMHKMax( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index bool ignoreShadows = false // Ignore Shaddows ) { // double result = 0; // result = MathMax(conditions.xmanInfo.smhkOpens[index], conditions.xmanInfo.smhkCloses[index]); if (!ignoreShadows) { // double selectedShadow = MathMax(conditions.xmanInfo.smhkHighs[index], conditions.xmanInfo.smhkLows[index]); // result = MathMax(result, selectedShadow); } // return result; } // double GetSMHKMin( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index bool ignoreShadows = false // Ignore Shaddows ) { // double result = 0; // result = MathMin(conditions.xmanInfo.smhkOpens[index], conditions.xmanInfo.smhkCloses[index]); if (!ignoreShadows) { // double selectedShadow = MathMin(conditions.xmanInfo.smhkHighs[index], conditions.xmanInfo.smhkLows[index]); // result = MathMin(result, selectedShadow); } // return result; } // double iSMHKHighest( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int count = 5, // Count ENUM_X_PRICE appliedPrice = X_PRICE_HIGH // Price Type ) { // double result = 0; // // Validate Args ... if (index < 0 || count <= 0) { return result; } // int idx = -1; double tmpArray[]; // switch (appliedPrice) { // case X_PRICE_HIGH: // ArrayCopy( tmpArray, conditions.xmanInfo.smhkHighs, 0, index, count // ); break; // case X_PRICE_OPEN: // ArrayCopy( tmpArray, conditions.xmanInfo.smhkOpens, 0, index, count // ); break; // case X_PRICE_CLOSE: // ArrayCopy( tmpArray, conditions.xmanInfo.smhkCloses, 0, index, count // ); break; // case X_PRICE_LOW: // ArrayCopy( tmpArray, conditions.xmanInfo.smhkLows, 0, index, count // ); break; } // idx = ArrayMaximum(tmpArray); if (idx < 0) { return result; } // result = tmpArray[idx]; // return result; } // double iSMHKLowest( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int count = 5, // Count ENUM_X_PRICE appliedPrice = X_PRICE_LOW // Price Type ) { // double result = 0; // // Validate Args ... if (index < 0 || count <= 0) { return result; } // int idx = -1; double tmpArray[]; // switch (appliedPrice) { // case X_PRICE_HIGH: // ArrayCopy( tmpArray, conditions.xmanInfo.smhkHighs, 0, index, count // ); break; // case X_PRICE_OPEN: // ArrayCopy( tmpArray, conditions.xmanInfo.smhkOpens, 0, index, count // ); break; // case X_PRICE_CLOSE: // ArrayCopy( tmpArray, conditions.xmanInfo.smhkCloses, 0, index, count // ); break; // case X_PRICE_LOW: // ArrayCopy( tmpArray, conditions.xmanInfo.smhkLows, 0, index, count // ); break; } // idx = ArrayMinimum(tmpArray); if (idx < 0) { return result; } // result = tmpArray[idx]; // return result; } // bool IsHKBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hkOpens[index] < conditions.xmanInfo.hkCloses[index] // ; // return result; } // bool IsHKBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.hkOpens[index] > conditions.xmanInfo.hkCloses[index] // ; // return result; } // bool IsSMHKBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.smhkOpens[index] < conditions.xmanInfo.smhkCloses[index] // ; // return result; } // bool IsSMHKBullishAs( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int count = 5 // Count ) { // bool result = false; // int verified = 0; for (int i = index; i < index + count; i++) { // bool isTrue = IsSMHKBullish(conditions, i); if (isTrue) { verified++; } } // result = verified >= count; // return result; } // bool IsSMHKChangedIn( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int length = 5 // Length ) { // bool result = false; // bool isCurrentBullish = IsSMHKBullish(conditions, index); // int numberOfChanges = 0; bool isLastBullish = isCurrentBullish; for (int i = index + 1; i < index + length; i++) { // bool isBullish = IsSMHKBullish(conditions, i); bool isBearish = IsSMHKBearish(conditions, i); // if ((isBullish && isLastBullish) || (!isBullish && !isLastBullish)) { continue; } else if ((isBullish && !isLastBullish) || (isBearish && isLastBullish)) { numberOfChanges++; } } // result = numberOfChanges > 0; // return result; } // bool IsSMHKBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // conditions.xmanInfo.smhkOpens[index] > conditions.xmanInfo.smhkCloses[index] // ; // return result; } // bool IsSMHKBearishAs( const X121MarketConditions &conditions, // Specified Conditions int index = 0, // Array Index int count = 5 // Count ) { // bool result = false; // int verified = 0; for (int i = index; i < index + count; i++) { // bool isTrue = IsSMHKBearish(conditions, i); if (isTrue) { verified++; } } // result = verified >= count; // return result; } // // END Functions ... // // // START Combination .... // // bool IsMarketBullish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullBullish(conditions, index) && IsSSLCBullish(conditions, index) && IsTrendBullish(conditions, index) && IsRibbonBullish(conditions, index) // ; // return result; } // bool IsMarketBearish( const X121MarketConditions &conditions, // Specified Conditions int index = 0 // Array Index ) { // bool result = false; // result = // IsHullBearish(conditions, index) && IsSSLCBearish(conditions, index) && IsTrendBearish(conditions, index) && IsRibbonBearish(conditions, index) // ; // return result; } // // END Combination .... // // // START EQM Supports ... // // // Generate a Collection Of Fib Signals ... int GenerateSequentialSignals( XSignal &signals[], // Hold Result ... double &pivots[], // Required Values For Generate Signals ... string symbol, // Trading Symbol ... ENUM_TIMEFRAMES period, // Trading Time Frame ... double price, // Current Price Execution ... double volume, // Volume ... bool placeSL = false, // Place SL for Signals ... bool placeTP = false, // Place TP for Signals ... bool useBoundaryForTPSL = false, // Use Boundary Max Min for TP SL ... double staticTP = 0, // Static TP ... bool staticTPAsPoint = false, // Detect Static TP as Point ... double staticSL = 0, // Static SL ... bool staticSLAsPoint = false, // Detect Static SL as Point ... bool longSupport = true, // Generate Long Support Signals ... bool shortSupport = true, // Generate Short Support Signals ... bool forceCleanSignalsArray = false // Clean Result Array ... ) { // int result = 0; // if (forceCleanSignalsArray) { Clean(signals); } int beforeSize = ArraySize(signals); // // Validate Input States ... int pivotsCount = ArraySize(pivots); if ( // price <= 0 || volume <= 0 || pivotsCount <= 0 // ) { return result; } // if (pivotsCount == 1) { // bool isValidSL = !placeSL ? true : staticSL > 0 ? true : false; // bool isValidTP = !placeTP ? true : staticTP > 0 ? true : false; // if (!isValidTP && !isValidSL) { return result; } } else if ((placeSL || placeTP) && pivotsCount < 3) { return result; } // if (!longSupport && !shortSupport) { return result; } // double slValue = !placeSL ? 0 : staticSLAsPoint ? PointToPrice( symbol, staticSL) : staticSL // ; // double tpValue = !placeTP ? 0 : staticTPAsPoint ? PointToPrice( symbol, staticTP) : staticTP // ; // // Do Signal Generation ... double tp = 0; double sl = 0; XSignal signal; double entry = 0; ENUM_X_ORDER_MODES mode = NULL; ENUM_POSITION_TYPE type = NULL; // double boundaryMax = pivots[ArrayMaximum(pivots)]; double boundaryMin = pivots[ArrayMinimum(pivots)]; // double tmp[]; Copy( pivots, tmp); ArraySort(tmp); // double biggerThanPrice[]; Copy( pivots, biggerThanPrice); ArraySort(biggerThanPrice); double lesserThanPrice[]; // bool breaking = false; while (!breaking) { // double lesser = -1; lesser = FindLesserThanValue( price, biggerThanPrice, true); if (lesser > -1) { // Add( lesser, lesserThanPrice); // Remove( lesser, biggerThanPrice); } // breaking = ArraySize(biggerThanPrice) == 0 || lesser == -1; } // // Here we have act based on Biggers and Lessers ... // - Lessers sorted from Large to Small ... // this means Lesser[0] is Biggest Lesser value ... // - Biggers sort Ordered Small to Large ... // this means Bigger[0] is Smallest Bigger Value ... // int biggersCount = ArraySize(biggerThanPrice); int lessersCount = ArraySize(lesserThanPrice); // if (longSupport) { // // Directional ... if (biggersCount > 0) { // for (int i = 0; i < biggersCount; i++) { // double iVal = biggerThanPrice[i]; // // We have to Filter Boundary Max ... if (iVal == boundaryMax) { // // TODO: // Also we can Do Support based on Previus Support and Resistances ... continue; } // // Now we Sure the iVal is not the Boundary Max ... // entry = iVal; // // TP ... if (placeTP) { // // this means Static TP Provided ... if (tpValue > 0) { tp = entry + tpValue; } // // Use Boundary Max for TP ... else if (useBoundaryForTPSL) { tp = boundaryMax; } // // Find Biggest then Entry Value and Set it as TP ... else { // tp = FindBiggerThanValue( entry, tmp, true); if (tp <= 0) { tp = 0; } } } else { tp = 0; } // // SL ... if (placeSL) { // // this means Static SL Provided ... if (slValue > 0) { sl = entry - slValue; } // // Use Boundary Min for SL ... if (useBoundaryForTPSL) { sl = boundaryMin; } // // Else Find Lesser Than Entry Value and Set it as SL ... else { // sl = FindLesserThanValue( entry, tmp, true); if (sl <= 0) { sl = 0; } } } else { sl = 0; } // // Prepare to Create Signal ... mode = X_ORDER_MODE_STOP; type = POSITION_TYPE_BUY; // signal = CreateSignal( symbol, period, type, mode, entry, volume, tp, sl); // Add( signal, signals); // Clean(signal); } } // // TODO Reversal ... if (shortSupport) { } } // if (shortSupport) { // // Directional ... if (lessersCount > 0) { // for (int i = 0; i < lessersCount; i++) { // double iVal = lesserThanPrice[i]; // // We Have to Filter Boundary Min ... if (iVal == boundaryMin) { // // TODO: // Also we can Do Support based on Previus Support and Resistances ... continue; } // // Now we sure the iVal is not the Boundary Min ... // entry = iVal; // // TP ... if (placeTP) { // // this means static tp provider ... if (tpValue > 0) { tp = entry - tpValue; } // // Use Boundary Min for TP ... else if (useBoundaryForTPSL) { tp = boundaryMin; } // // Find Lesser than Entry Vlue and Set it as TP ... else { tp = FindLesserThanValue( entry, tmp, true); if (tp <= 0) { tp = 0; } } } else { tp = 0; } // // SL ... if (placeSL) { // // this means Static SL provided ... if (slValue > 0) { sl = entry + slValue; } // // Use Boundary Max for SL ... if (useBoundaryForTPSL) { sl = boundaryMax; } // // Find Bigger Than Entry Vakue and Set it as SL ... else { // sl = FindBiggerThanValue( entry, tmp, true); if (sl <= 0) { sl = 0; } } } else { sl = 0; } // // Prepare to Create Signal ... mode = X_ORDER_MODE_STOP; type = POSITION_TYPE_SELL; // signal = CreateSignal( symbol, period, type, mode, entry, volume, tp, sl); // Add( signal, signals); // Clean(signal); } } // // TODO: Reversal ... if (longSupport) { } } // int afterSize = ArraySize(signals); result = afterSize - beforeSize; // return result; } // int GenerateSupportAndResistanceSignals( XSignal &supports[], // Holds Result ... XOHCLSupRes &supRes, // Provided Support and Resistances ... string symbol, // Trading Symbol ... ENUM_TIMEFRAMES period, // Trading Time Frame ... double price, // Current Price Execution ... double volume, // Volume ... bool placeSL = false, // Place SL for Signals ... bool placeTP = false, // Place TP for Signals ... bool useBoundaryForTPSL = false, // Use Boundary Max Min for TP SL ... double staticTP = 0, // Static TP ... bool staticTPAsPoint = false, // Detect Static TP as Point ... double staticSL = 0, // Static SL ... bool staticSLAsPoint = false, // Detect Static SL as Point ... bool forceClean = false // Clean Result Array ... ) { // int result = 0; // if (forceClean) { Clean(supports); } // int beforeSize = ArraySize(supports); // // Try to Copy all Values in same array ... // double tmpPivots[]; Copy( supRes.sup, tmpPivots, false // ); Copy( supRes.res, tmpPivots, false // ); // // Sort Temp Pivots Array ... ArraySort(tmpPivots); // GenerateSequentialSignals( supports, tmpPivots, symbol, period, price, volume, placeSL, placeTP, useBoundaryForTPSL, staticTP, staticTPAsPoint, staticSL, staticSLAsPoint // ); // int afterSize = ArraySize(supports); // result = afterSize - beforeSize; // return result; } // // END EQM Supports ... //