/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Class Library // ---------------------------------------------- // Name: XSCBaseX5Provider // Description: provides all Base Provider // requirements For X5 ... // // // 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 "../Helpers/x-saherelm.xct.helper.mq5" #include "../Helpers/x-saherelm.xcc.helper.mq5" #include "../Helpers/x-saherelm.xtm.helper.mq5" #include "../Helpers/x-saherelm.xama.helper.mq5" #include "../Helpers/x-saherelm.xlh.helper.mq5" #include "../Helpers/x-saherelm.xtd.helper.mq5" #include "../Helpers/x-saherelm.xfi.helper.mq5" #include "../Helpers/x-saherelm.xts.helper.mq5" #include "../Helpers/x-saherelm.xrsi.helper.mq5" #include "../Helpers/x-saherelm.xobd.helper.mq5" #include "../Helpers/x-saherelm.xchlh.helper.mq5" #include "../Helpers/x-saherelm.xchma.helper.mq5" // #include "../Classes/x-saherelm.xprovider.class.mq5" // // Definitions ... // // Signallers ... enum ENUM_X5_SIGNAL_PROVIDERS { // NONE, // // XSP Expert Support Mechanism ... XSP, // // XTD ... XTD, // // XTAM ... XTAM, // // XSI ... XSI, // // XTSFI ... XTSFI, // // XOBDLH ... XOBDLH, // // XCHMACC ... XCHMACC, // // XCHMACMN ... XCHMAMN, // // XCHMACMX ... XCHMAMX, }; // // X5 Provider Inputs ... class X5ProviderInputs : public XSCBaseProviderInpts { // // Public ... public: // // Props ... XTSInputs tsInputs; XTMInputs tmInputs; XLHInputs lhInputs; XTDInputs tdInputs; XFIInputs fiInputs; XCTInputs ctInputs; XCCInputs ccInputs; XOBDInputs obdInputs; XAMAInputs amaInputs; XRSIInputs rsiInputs; XCHLHInputs chlhInputs; XCHMAInputs chmaInputs; // // Tools ... // // Validate ... virtual bool IsValid() { // bool result = false; // result = tsInputs.IsValid(); if (!result) { return result; } result = ctInputs.IsValid(); if (!result) { return result; } // result = ccInputs.IsValid(); if (!result) { return result; } // result = tmInputs.IsValid(); if (!result) { return result; } // result = lhInputs.IsValid(); if (!result) { return result; } // result = tdInputs.IsValid(); if (!result) { return result; } // result = fiInputs.IsValid(); if (!result) { return result; } // result = obdInputs.IsValid(); if (!result) { return result; } // result = amaInputs.IsValid(); if (!result) { return result; } // result = rsiInputs.IsValid(); if (!result) { return result; } // result = chlhInputs.IsValid(); if (!result) { return result; } // result = chmaInputs.IsValid(); // return result; } // // Cleanup ... virtual void Clean() { // tsInputs.Clean(); ctInputs.Clean(); ccInputs.Clean(); tmInputs.Clean(); lhInputs.Clean(); tdInputs.Clean(); fiInputs.Clean(); obdInputs.Clean(); amaInputs.Clean(); rsiInputs.Clean(); chlhInputs.Clean(); chmaInputs.Clean(); } // // Default ... virtual void Default() { // tsInputs.Default(); ctInputs.Default(); ccInputs.Default(); tmInputs.Default(); lhInputs.Default(); tdInputs.Default(); fiInputs.Default(); obdInputs.Default(); amaInputs.Default(); rsiInputs.Default(); chlhInputs.Default(); chmaInputs.Default(); } // // Max ... virtual int Max() { // int result = 0; // result = MathMax(lhInputs.Max(), tmInputs.Max()); // result = MathMax(result, tsInputs.Max()); result = MathMax(result, ctInputs.Max()); result = MathMax(result, ccInputs.Max()); result = MathMax(result, tdInputs.Max()); result = MathMax(result, fiInputs.Max()); result = MathMax(result, obdInputs.Max()); result = MathMax(result, amaInputs.Max()); result = MathMax(result, rsiInputs.Max()); result = MathMax(result, chlhInputs.Max()); result = MathMax(result, chmaInputs.Max()); // return result; } }; // // XSC5MarketConditionDataCollector ... class XSC5MarketConditionDataCollector { // // Public ... public: // // Constructor ... void XSC5MarketConditionDataCollector() { // XSCDataCollector mBase; mBase.Clear(); } // // Cleaning Store ... void Clear() { // XSCDataCollector mBase; // mBase.Clear(); } // // Add String Content ... bool Add(string content) { // bool result = false; // XSCDataCollector mBase; // result = mBase.Add(content); // return result; } // // Protected ... protected: // // Private ... private: }; // // X5 Provider Market Conditions ... class X5MarketConditions : public XSCBaseProviderMarketConditions { // // Public ... public: // // Buffers ... // // XTS ... double tsCurrents[]; double tsNearests[]; double tsMediests[]; double tsFarests[]; // // XFI ... double fis[]; // // XTD ... double tdBullishs[]; double tdBearishs[]; double tdSignals[]; // // XLH ... double lhHhs[]; double lhLls[]; double lhSignals[]; // // XTM ... double tms[]; // // XAMA ... double amas[]; // // XOBD ... double obds[]; // // XRSI ... double rsis[]; // // XCHMA ... double chmaScFasts[]; double chmaScSlows[]; double chmaMcFasts[]; double chmaMcSlows[]; double chmaLcFasts[]; double chmaLcSlows[]; double chmaHotStates[]; // // XCHLH ... double chlhScHHs[]; double chlhScLLs[]; double chlhMcHHs[]; double chlhMcLLs[]; double chlhLcHHs[]; double chlhLcLLs[]; double chlhHotStates[]; // // Conditional Variables ... // // XTM ... bool isXTMPeak; bool isXTMVale; bool isXTMBullish; bool isXTMBearish; bool isXTMNeutural; bool isXTMEndBullish; bool isXTMEndBearish; bool isXTMStartBullish; bool isXTMStartBearish; bool isXTMEndBullishByNeutural; bool isXTMEndBearishByNeutural; bool isXTMStartBullishAfterNeutural; bool isXTMStartBearishAfterNeutural; // // XAMA ... bool isXAMAPeak; bool isXAMAVale; bool isXAMABullish; bool isXAMABearish; bool isXAMANeutural; bool isXAMAEndBullish; bool isXAMAEndBearish; bool isXAMAStartBullish; bool isXAMAStartBearish; bool isXAMAEndBullishByNeutural; bool isXAMAEndBearishByNeutural; bool isXAMAStartBullishAfterNeutural; bool isXAMAStartBearishAfterNeutural; // // XLH ... bool isXLHHHIncreased; bool isXLHHHDecreased; bool isXLHLLIncreased; bool isXLHLLDecreased; bool isXLHLowAttachedLL; bool isXLHHighAttachedHH; bool isXLHHHSameInLength; bool isXLHLLSameInLength; bool isXLHPriceOverSignal; bool isXLHPriceUnderSignal; bool isXLHPriceInSignalRange; bool isXLHPriceCrossedOverSignal; bool isXLHPriceCrossedUnderSignal; // // XTD ... bool isXTDSignalPeak; bool isXTDSignalVale; bool isXTDBullishPeak; bool isXTDBullishVale; bool isXTDBearishPeak; bool isXTDBearishVale; bool isXTDBullOverBear; bool isXTDBullUnderBear; bool isXTDSignalOverBear; bool isXTDSignalUnderBear; bool isXTDBullCrossedOverBear; bool isXTDBullCrossedUnderBear; bool isXTDSignalCrossedOverBear; bool isXTDSignalCrossedUnderBear; // // XFI ... bool isXFIPeak; bool isXFIVale; bool isXFICrossedOverZero; bool isXFIOverZero; bool isXFICrossedUnderZero; bool isXFIUnderZero; // // XTS ... bool isXTSAllSame; bool isXTSCurrentMin; bool isXTSCurrentMax; bool isXTSCurrentOverFarest; bool isXTSCurrentOverNearest; bool isXTSCurrentOverMediest; bool isXTSCurrentUnderFarest; bool isXTSCurrentUnderNearest; bool isXTSCurrentUnderMediest; bool isXTSCurrentCrossedOverFarest; bool isXTSCurrentCrossedOverNearest; bool isXTSCurrentCrossedOverMediest; bool isXTSCurrentCrossedUnderFarest; bool isXTSCurrentCrossedUnderNearest; bool isXTSCurrentCrossedUnderMediest; // // XRSI ... bool isXRSIPeak; bool isXRSIVale; bool isXRSICrossedOverLongExit; bool isXRSICrossedOverLongEntry; bool isXRSICrossedUnderShortExit; bool isXRSICrossedUnderShortEntry; // // XOBD ... bool isXOBDSwingLow; bool isXOBDSwingHigh; // // XCHLH ... // bool isXCHLHSameHHs; bool isXCHLHSameLLs; // bool isXCHLHSCMCHHSame; bool isXCHLHSCMCLLSame; // bool isXCHLHSCLCHHSame; bool isXCHLHSCLCLLSame; // bool isXCHLHMCLCHHSame; bool isXCHLHMCLCLLSame; // bool isXCHLHMCOnTopOfLC; bool isXCHLHMCInBottomOfLC; // // XCHMA ... // bool isXCHMASCOverMax; bool isXCHMASCOverMin; bool isXCHMASCUnderMax; bool isXCHMASCUnderMin; // bool isXCHMASCCrossedOverMax; bool isXCHMASCCrossedUnderMax; bool isXCHMASCCrossedOverMin; bool isXCHMASCCrossedUnderMin; // bool isXCHMASCPeak; bool isXCHMASCVale; bool isXCHMASCTrendsUp; bool isXCHMASCTrendsDown; bool isXCHMASCFastOverSlow; bool isXCHMASCFastUnderSlow; bool isXCHMASCFastCrossedOverSlow; bool isXCHMASCFastCrossedUnderSlow; // bool isXCHMAMCPeak; bool isXCHMAMCVale; bool isXCHMAMCTrendsUp; bool isXCHMAMCTrendsDown; bool isXCHMAMCFastOverSlow; bool isXCHMAMCFastUnderSlow; bool isXCHMAMCFastCrossedOverSlow; bool isXCHMAMCFastCrossedUnderSlow; // bool isXCHMALCPeak; bool isXCHMALCVale; bool isXCHMALCTrendsUp; bool isXCHMALCTrendsDown; bool isXCHMALCFastOverSlow; bool isXCHMALCFastUnderSlow; bool isXCHMALCFastCrossedOverSlow; bool isXCHMALCFastCrossedUnderSlow; // // // Conditions ... void Clear() { // Clean(tsCurrents); Clean(tsNearests); Clean(tsMediests); Clean(tsFarests); Clean(fis); Clean(tdBullishs); Clean(tdBearishs); Clean(tdSignals); Clean(lhHhs); Clean(lhLls); Clean(lhSignals); Clean(tms); Clean(amas); Clean(obds); Clean(rsis); Clean(chmaScFasts); Clean(chmaScSlows); Clean(chmaMcFasts); Clean(chmaMcSlows); Clean(chmaLcFasts); Clean(chmaLcSlows); Clean(chmaHotStates); Clean(chlhScHHs); Clean(chlhScLLs); Clean(chlhMcHHs); Clean(chlhMcLLs); Clean(chlhLcHHs); Clean(chlhLcLLs); Clean(chlhHotStates); // ArraySetAsSeries(tsCurrents, true); ArraySetAsSeries(tsNearests, true); ArraySetAsSeries(tsMediests, true); ArraySetAsSeries(tsFarests, true); ArraySetAsSeries(fis, true); ArraySetAsSeries(tdBullishs, true); ArraySetAsSeries(tdBearishs, true); ArraySetAsSeries(tdSignals, true); ArraySetAsSeries(lhHhs, true); ArraySetAsSeries(lhLls, true); ArraySetAsSeries(lhSignals, true); ArraySetAsSeries(tms, true); ArraySetAsSeries(amas, true); ArraySetAsSeries(obds, true); ArraySetAsSeries(rsis, true); ArraySetAsSeries(chmaScFasts, true); ArraySetAsSeries(chmaScSlows, true); ArraySetAsSeries(chmaMcFasts, true); ArraySetAsSeries(chmaMcSlows, true); ArraySetAsSeries(chmaLcFasts, true); ArraySetAsSeries(chmaLcSlows, true); ArraySetAsSeries(chmaHotStates, true); ArraySetAsSeries(chlhScHHs, true); ArraySetAsSeries(chlhScLLs, true); ArraySetAsSeries(chlhMcHHs, true); ArraySetAsSeries(chlhMcLLs, true); ArraySetAsSeries(chlhLcHHs, true); ArraySetAsSeries(chlhLcLLs, true); ArraySetAsSeries(chlhHotStates, true); // isXTMPeak = false; isXTMVale = false; isXTMBullish = false; isXTMBearish = false; isXTMNeutural = false; isXTMEndBullish = false; isXTMEndBearish = false; isXTMStartBullish = false; isXTMStartBearish = false; isXTMEndBullishByNeutural = false; isXTMEndBearishByNeutural = false; isXTMStartBullishAfterNeutural = false; isXTMStartBearishAfterNeutural = false; isXAMAPeak = false; isXAMAVale = false; isXAMABullish = false; isXAMABearish = false; isXAMANeutural = false; isXAMAEndBullish = false; isXAMAEndBearish = false; isXAMAStartBullish = false; isXAMAStartBearish = false; isXAMAEndBullishByNeutural = false; isXAMAEndBearishByNeutural = false; isXAMAStartBullishAfterNeutural = false; isXAMAStartBearishAfterNeutural = false; isXLHHHIncreased = false; isXLHHHDecreased = false; isXLHLLIncreased = false; isXLHLLDecreased = false; isXLHLowAttachedLL = false; isXLHHighAttachedHH = false; isXLHHHSameInLength = false; isXLHLLSameInLength = false; isXLHPriceOverSignal = false; isXLHPriceUnderSignal = false; isXLHPriceInSignalRange = false; isXLHPriceCrossedOverSignal = false; isXLHPriceCrossedUnderSignal = false; isXTDSignalPeak = false; isXTDSignalVale = false; isXTDBullishPeak = false; isXTDBullishVale = false; isXTDBearishPeak = false; isXTDBearishVale = false; isXTDBullOverBear = false; isXTDBullUnderBear = false; isXTDSignalOverBear = false; isXTDSignalUnderBear = false; isXTDBullCrossedOverBear = false; isXTDBullCrossedUnderBear = false; isXTDSignalCrossedOverBear = false; isXTDSignalCrossedUnderBear = false; isXFIPeak = false; isXFIVale = false; isXFICrossedOverZero = false; isXFIOverZero = false; isXFICrossedUnderZero = false; isXFIUnderZero = false; isXTSAllSame = false; isXTSCurrentMin = false; isXTSCurrentMax = false; isXTSCurrentOverFarest = false; isXTSCurrentOverNearest = false; isXTSCurrentOverMediest = false; isXTSCurrentUnderFarest = false; isXTSCurrentUnderNearest = false; isXTSCurrentUnderMediest = false; isXTSCurrentCrossedOverFarest = false; isXTSCurrentCrossedOverNearest = false; isXTSCurrentCrossedOverMediest = false; isXTSCurrentCrossedUnderFarest = false; isXTSCurrentCrossedUnderNearest = false; isXTSCurrentCrossedUnderMediest = false; isXRSIPeak = false; isXRSIVale = false; isXRSICrossedOverLongExit = false; isXRSICrossedOverLongEntry = false; isXRSICrossedUnderShortExit = false; isXRSICrossedUnderShortEntry = false; isXOBDSwingLow = false; isXOBDSwingHigh = false; isXCHLHSameHHs = false; isXCHLHSameLLs = false; isXCHLHSCMCHHSame = false; isXCHLHSCMCLLSame = false; isXCHLHSCLCHHSame = false; isXCHLHSCLCLLSame = false; isXCHLHMCLCHHSame = false; isXCHLHMCLCLLSame = false; isXCHLHMCOnTopOfLC = false; isXCHLHMCInBottomOfLC = false; isXCHMASCOverMax = false; isXCHMASCOverMin = false; isXCHMASCUnderMax = false; isXCHMASCUnderMin = false; isXCHMASCCrossedOverMax = false; isXCHMASCCrossedUnderMax = false; isXCHMASCCrossedOverMin = false; isXCHMASCCrossedUnderMin = false; isXCHMASCPeak = false; isXCHMASCVale = false; isXCHMASCTrendsUp = false; isXCHMASCTrendsDown = false; isXCHMASCFastOverSlow = false; isXCHMASCFastUnderSlow = false; isXCHMASCFastCrossedOverSlow = false; isXCHMASCFastCrossedUnderSlow = false; isXCHMAMCPeak = false; isXCHMAMCVale = false; isXCHMAMCTrendsUp = false; isXCHMAMCTrendsDown = false; isXCHMAMCFastOverSlow = false; isXCHMAMCFastUnderSlow = false; isXCHMAMCFastCrossedOverSlow = false; isXCHMAMCFastCrossedUnderSlow = false; isXCHMALCPeak = false; isXCHMALCVale = false; isXCHMALCTrendsUp = false; isXCHMALCTrendsDown = false; isXCHMALCFastOverSlow = false; isXCHMALCFastUnderSlow = false; isXCHMALCFastCrossedOverSlow = false; isXCHMALCFastCrossedUnderSlow = false; } // // Generate Score ... virtual void GenerateScore( double &bullishScore, // Bullish Score double &bearishScore, // Bearish Score const double multiplier = 1 // Score Multiplier ) { } // // Generate Summary ... virtual string GenerateSummary( const double multiplier = 1, // Score Multiplier const string separator = "\n", // Separator const bool ignoreFalseConditions = true // Ignore False Conditions ) { // string result = NULL; // // Common ... string commonStr = // "Commons: " + separator + "-----------------------------" + "Time: " + ToString(TimeCurrent()) + separator + // // TODO: Add Scores Later ... "" // ; // // XOBD ... string obdStr = // ToString("isXOBDSwingLow", isXOBDSwingLow, ignoreFalseConditions) + ToString("isXOBDSwingHigh", isXOBDSwingHigh, ignoreFalseConditions) + "" // ; // // ToString("", , ignoreFalseConditions) + // // XFI ... string fiStr = // ToString("isXFIPeak", isXFIPeak, ignoreFalseConditions) + ToString("isXFIVale", isXFIVale, ignoreFalseConditions) + ToString("isXFICrossedOverZero", isXFICrossedOverZero, ignoreFalseConditions) + ToString("isXFIOverZero", isXFIOverZero, ignoreFalseConditions) + ToString("isXFICrossedUnderZero", isXFICrossedUnderZero, ignoreFalseConditions) + ToString("isXFIUnderZero", isXFIUnderZero, ignoreFalseConditions) + "" // ; // // XRSI ... string rsiStr = // ToString("isXRSIPeak", isXRSIPeak, ignoreFalseConditions) + ToString("isXRSIVale", isXRSIVale, ignoreFalseConditions) + ToString("isXRSICrossedOverLongExit", isXRSICrossedOverLongExit, ignoreFalseConditions) + ToString("isXRSICrossedOverLongEntry", isXRSICrossedOverLongEntry, ignoreFalseConditions) + ToString("isXRSICrossedUnderShortExit", isXRSICrossedUnderShortExit, ignoreFalseConditions) + ToString("isXRSICrossedUnderShortEntry", isXRSICrossedUnderShortEntry, ignoreFalseConditions) + "" // ; // // XTM ... string tmStr = // ToString("isXTMPeak", isXTMPeak, ignoreFalseConditions) + ToString("isXTMVale", isXTMVale, ignoreFalseConditions) + ToString("isXTMBullish", isXTMBullish, ignoreFalseConditions) + ToString("isXTMBearish", isXTMBearish, ignoreFalseConditions) + ToString("isXTMNeutural", isXTMNeutural, ignoreFalseConditions) + ToString("isXTMEndBullish", isXTMEndBullish, ignoreFalseConditions) + ToString("isXTMEndBearish", isXTMEndBearish, ignoreFalseConditions) + ToString("isXTMStartBullish", isXTMStartBullish, ignoreFalseConditions) + ToString("isXTMStartBearish", isXTMStartBearish, ignoreFalseConditions) + ToString("isXTMEndBullishByNeutural", isXTMEndBullishByNeutural, ignoreFalseConditions) + ToString("isXTMEndBearishByNeutural", isXTMEndBearishByNeutural, ignoreFalseConditions) + ToString("isXTMStartBullishAfterNeutural", isXTMStartBullishAfterNeutural, ignoreFalseConditions) + ToString("isXTMStartBearishAfterNeutural", isXTMStartBearishAfterNeutural, ignoreFalseConditions) + "" // ; // // XAMA ... string amaStr = // ToString("isXAMAPeak", isXAMAPeak, ignoreFalseConditions) + ToString("isXAMAVale", isXAMAVale, ignoreFalseConditions) + ToString("isXAMABullish", isXAMABullish, ignoreFalseConditions) + ToString("isXAMABearish", isXAMABearish, ignoreFalseConditions) + ToString("isXAMANeutural", isXAMANeutural, ignoreFalseConditions) + ToString("isXAMAEndBullish", isXAMAEndBullish, ignoreFalseConditions) + ToString("isXAMAEndBearish", isXAMAEndBearish, ignoreFalseConditions) + ToString("isXAMAStartBullish", isXAMAStartBullish, ignoreFalseConditions) + ToString("isXAMAStartBearish", isXAMAStartBearish, ignoreFalseConditions) + ToString("isXAMAEndBullishByNeutural", isXAMAEndBullishByNeutural, ignoreFalseConditions) + ToString("isXAMAEndBearishByNeutural", isXAMAEndBearishByNeutural, ignoreFalseConditions) + ToString("isXAMAStartBullishAfterNeutural", isXAMAStartBullishAfterNeutural, ignoreFalseConditions) + ToString("isXAMAStartBearishAfterNeutural", isXAMAStartBearishAfterNeutural, ignoreFalseConditions) + "" // ; // // XLH ... string lhStr = // ToString("isXLHHHIncreased", isXLHHHIncreased, ignoreFalseConditions) + ToString("isXLHHHDecreased", isXLHHHDecreased, ignoreFalseConditions) + ToString("isXLHLLIncreased", isXLHLLIncreased, ignoreFalseConditions) + ToString("isXLHLLDecreased", isXLHLLDecreased, ignoreFalseConditions) + ToString("isXLHLowAttachedLL", isXLHLowAttachedLL, ignoreFalseConditions) + ToString("isXLHHighAttachedHH", isXLHHighAttachedHH, ignoreFalseConditions) + ToString("isXLHHHSameInLength", isXLHHHSameInLength, ignoreFalseConditions) + ToString("isXLHLLSameInLength", isXLHLLSameInLength, ignoreFalseConditions) + ToString("isXLHPriceOverSignal", isXLHPriceOverSignal, ignoreFalseConditions) + ToString("isXLHPriceUnderSignal", isXLHPriceUnderSignal, ignoreFalseConditions) + ToString("isXLHPriceInSignalRange", isXLHPriceInSignalRange, ignoreFalseConditions) + ToString("isXLHPriceCrossedOverSignal", isXLHPriceCrossedOverSignal, ignoreFalseConditions) + ToString("isXLHPriceCrossedUnderSignal", isXLHPriceCrossedUnderSignal, ignoreFalseConditions) + "" // ; // // XTD ... string tdStr = // ToString("isXTDSignalPeak", isXTDSignalPeak, ignoreFalseConditions) + ToString("isXTDSignalVale", isXTDSignalVale, ignoreFalseConditions) + ToString("isXTDBullishPeak", isXTDBullishPeak, ignoreFalseConditions) + ToString("isXTDBullishVale", isXTDBullishVale, ignoreFalseConditions) + ToString("isXTDBearishPeak", isXTDBearishPeak, ignoreFalseConditions) + ToString("isXTDBearishVale", isXTDBearishVale, ignoreFalseConditions) + ToString("isXTDBullOverBear", isXTDBullOverBear, ignoreFalseConditions) + ToString("isXTDBullUnderBear", isXTDBullUnderBear, ignoreFalseConditions) + ToString("isXTDSignalOverBear", isXTDSignalOverBear, ignoreFalseConditions) + ToString("isXTDSignalUnderBear", isXTDSignalUnderBear, ignoreFalseConditions) + ToString("isXTDBullCrossedOverBear", isXTDBullCrossedOverBear, ignoreFalseConditions) + ToString("isXTDBullCrossedUnderBear", isXTDBullCrossedUnderBear, ignoreFalseConditions) + ToString("isXTDSignalCrossedOverBear", isXTDSignalCrossedOverBear, ignoreFalseConditions) + ToString("isXTDSignalCrossedUnderBear", isXTDSignalCrossedUnderBear, ignoreFalseConditions) + "" // ; // // XTS ... string tsStr = // ToString("isXTSAllSame", isXTSAllSame, ignoreFalseConditions) + ToString("isXTSCurrentMin", isXTSCurrentMin, ignoreFalseConditions) + ToString("isXTSCurrentMax", isXTSCurrentMax, ignoreFalseConditions) + ToString("isXTSCurrentOverFarest", isXTSCurrentOverFarest, ignoreFalseConditions) + ToString("isXTSCurrentOverNearest", isXTSCurrentOverNearest, ignoreFalseConditions) + ToString("isXTSCurrentOverMediest", isXTSCurrentOverMediest, ignoreFalseConditions) + ToString("isXTSCurrentUnderFarest", isXTSCurrentUnderFarest, ignoreFalseConditions) + ToString("isXTSCurrentUnderNearest", isXTSCurrentUnderNearest, ignoreFalseConditions) + ToString("isXTSCurrentUnderMediest", isXTSCurrentUnderMediest, ignoreFalseConditions) + ToString("isXTSCurrentCrossedOverFarest", isXTSCurrentCrossedOverFarest, ignoreFalseConditions) + ToString("isXTSCurrentCrossedOverNearest", isXTSCurrentCrossedOverNearest, ignoreFalseConditions) + ToString("isXTSCurrentCrossedOverMediest", isXTSCurrentCrossedOverMediest, ignoreFalseConditions) + ToString("isXTSCurrentCrossedUnderFarest", isXTSCurrentCrossedUnderFarest, ignoreFalseConditions) + ToString("isXTSCurrentCrossedUnderNearest", isXTSCurrentCrossedUnderNearest, ignoreFalseConditions) + ToString("isXTSCurrentCrossedUnderMediest", isXTSCurrentCrossedUnderMediest, ignoreFalseConditions) + "" // ; // // XCHLH ... string chlhStr = // ToString("isXCHLHSameHHs", isXCHLHSameHHs, ignoreFalseConditions) + ToString("isXCHLHSameLLs", isXCHLHSameLLs, ignoreFalseConditions) + ToString("isXCHLHSCMCHHSame", isXCHLHSCMCHHSame, ignoreFalseConditions) + ToString("isXCHLHSCMCLLSame", isXCHLHSCMCLLSame, ignoreFalseConditions) + ToString("isXCHLHSCLCHHSame", isXCHLHSCLCHHSame, ignoreFalseConditions) + ToString("isXCHLHSCLCLLSame", isXCHLHSCLCLLSame, ignoreFalseConditions) + ToString("isXCHLHMCLCHHSame", isXCHLHMCLCHHSame, ignoreFalseConditions) + ToString("isXCHLHMCLCLLSame", isXCHLHMCLCLLSame, ignoreFalseConditions) + ToString("isXCHLHMCOnTopOfLC", isXCHLHMCOnTopOfLC, ignoreFalseConditions) + ToString("isXCHLHMCInBottomOfLC", isXCHLHMCInBottomOfLC, ignoreFalseConditions) + "" // ; // // XCHMA ... string chmaStr = // ToString("isXCHMASCOverMax", isXCHMASCOverMax, ignoreFalseConditions) + ToString("isXCHMASCOverMin", isXCHMASCOverMin, ignoreFalseConditions) + ToString("isXCHMASCUnderMax", isXCHMASCUnderMax, ignoreFalseConditions) + ToString("isXCHMASCUnderMin", isXCHMASCUnderMin, ignoreFalseConditions) + ToString("isXCHMASCCrossedOverMax", isXCHMASCCrossedOverMax, ignoreFalseConditions) + ToString("isXCHMASCCrossedUnderMax", isXCHMASCCrossedUnderMax, ignoreFalseConditions) + ToString("isXCHMASCCrossedOverMin", isXCHMASCCrossedOverMin, ignoreFalseConditions) + ToString("isXCHMASCCrossedUnderMin", isXCHMASCCrossedUnderMin, ignoreFalseConditions) + ToString("isXCHMASCPeak", isXCHMASCPeak, ignoreFalseConditions) + ToString("isXCHMASCVale", isXCHMASCVale, ignoreFalseConditions) + ToString("isXCHMASCTrendsUp", isXCHMASCTrendsUp, ignoreFalseConditions) + ToString("isXCHMASCTrendsDown", isXCHMASCTrendsDown, ignoreFalseConditions) + ToString("isXCHMASCFastOverSlow", isXCHMASCFastOverSlow, ignoreFalseConditions) + ToString("isXCHMASCFastUnderSlow", isXCHMASCFastUnderSlow, ignoreFalseConditions) + ToString("isXCHMASCFastCrossedOverSlow", isXCHMASCFastCrossedOverSlow, ignoreFalseConditions) + ToString("isXCHMASCFastCrossedUnderSlow", isXCHMASCFastCrossedUnderSlow, ignoreFalseConditions) + ToString("isXCHMAMCPeak", isXCHMAMCPeak, ignoreFalseConditions) + ToString("isXCHMAMCVale", isXCHMAMCVale, ignoreFalseConditions) + ToString("isXCHMAMCTrendsUp", isXCHMAMCTrendsUp, ignoreFalseConditions) + ToString("isXCHMAMCTrendsDown", isXCHMAMCTrendsDown, ignoreFalseConditions) + ToString("isXCHMAMCFastOverSlow", isXCHMAMCFastOverSlow, ignoreFalseConditions) + ToString("isXCHMAMCFastUnderSlow", isXCHMAMCFastUnderSlow, ignoreFalseConditions) + ToString("isXCHMAMCFastCrossedOverSlow", isXCHMAMCFastCrossedOverSlow, ignoreFalseConditions) + ToString("isXCHMAMCFastCrossedUnderSlow", isXCHMAMCFastCrossedUnderSlow, ignoreFalseConditions) + ToString("isXCHMALCPeak", isXCHMALCPeak, ignoreFalseConditions) + ToString("isXCHMALCVale", isXCHMALCVale, ignoreFalseConditions) + ToString("isXCHMALCTrendsUp", isXCHMALCTrendsUp, ignoreFalseConditions) + ToString("isXCHMALCTrendsDown", isXCHMALCTrendsDown, ignoreFalseConditions) + ToString("isXCHMALCFastOverSlow", isXCHMALCFastOverSlow, ignoreFalseConditions) + ToString("isXCHMALCFastUnderSlow", isXCHMALCFastUnderSlow, ignoreFalseConditions) + ToString("isXCHMALCFastCrossedOverSlow", isXCHMALCFastCrossedOverSlow, ignoreFalseConditions) + ToString("isXCHMALCFastCrossedUnderSlow", isXCHMALCFastCrossedUnderSlow, ignoreFalseConditions) + "" // ; // // Generating Full Result by Combining parts ... result = // "[" + GetToken() + "]" + separator + "----------------------" + separator + commonStr + obdStr + fiStr + rsiStr + tmStr + amaStr + lhStr + tdStr + tsStr + chlhStr + chmaStr + "" // ; // return result; } // // For Data Collector ... bool IsModelValid() { return false; } string ToModelString() { return NULL; } bool ParseModel(string content) { return false; } int FindIndex(X5MarketConditions &items[]) { return -1; } }; // // Class ... // // X5 Provider Class ... class XSCX5Provider : public XSCBaseProvider { // // Public ... public: // // Props ... XSCXTSHelper *tsHelper; XSCXFIHelper *fiHelper; XSCXTDHelper *tdHelper; XSCXLHHelper *lhHelper; XSCXTMHelper *tmHelper; XSCXCCHelper *ccHelper; XSCXCTHelper *ctHelper; XSCXOBDHelper *obdHelper; XSCXRSIHelper *rsiHelper; XSCXAMAHelper *amaHelper; XSCXCHMAHelper *chmaHelper; XSCXCHLHHelper *chlhHelper; // // Constructor ... XSCX5Provider( string symbol, // Trading Symbol ENUM_TIMEFRAMES period // Trading PEriod ) : XSCBaseProvider(symbol, period) { // tsHelper = new XSCXTSHelper(); fiHelper = new XSCXFIHelper(); tdHelper = new XSCXTDHelper(); lhHelper = new XSCXLHHelper(); tmHelper = new XSCXTMHelper(); ccHelper = new XSCXCCHelper(); ctHelper = new XSCXCTHelper(); obdHelper = new XSCXOBDHelper(); rsiHelper = new XSCXRSIHelper(); amaHelper = new XSCXAMAHelper(); chmaHelper = new XSCXCHMAHelper(); chlhHelper = new XSCXCHLHHelper(); // mNumberOfItems = 15; } // // Properties Gettr(s) / Setter(s) ... // // Inheritance ... // // Init all Requirements ... virtual bool Init(X5ProviderInputs &inputs) { // bool result = false; // // Validate ... result = inputs.IsValid(); if (!result) { return result; } // mInputs = inputs; // string mSymbol = GetSymbol(); ENUM_TIMEFRAMES mPeriod = GetPeriod(); // result = tsHelper .Init( mSymbol, mPeriod, mInputs.tsInputs // ); if (!result) { return result; } // result = fiHelper .Init( mSymbol, mPeriod, mInputs.fiInputs // ); if (!result) { return result; } // result = tdHelper .Init( mSymbol, mPeriod, mInputs.tdInputs // ); if (!result) { return result; } // result = lhHelper .Init( mSymbol, mPeriod, mInputs.lhInputs // ); if (!result) { return result; } // result = tmHelper .Init( mSymbol, mPeriod, mInputs.tmInputs // ); if (!result) { return result; } // result = ccHelper .Init( mSymbol, mPeriod, mInputs.ccInputs // ); if (!result) { return result; } // result = ctHelper .Init( mSymbol, mPeriod, mInputs.ctInputs // ); if (!result) { return result; } // result = obdHelper .Init( mSymbol, mPeriod, mInputs.obdInputs // ); if (!result) { return result; } // result = rsiHelper .Init( mSymbol, mPeriod, mInputs.rsiInputs // ); if (!result) { return result; } // result = amaHelper .Init( mSymbol, mPeriod, mInputs.amaInputs // ); if (!result) { return result; } // result = chmaHelper .Init( mSymbol, mPeriod, mInputs.chmaInputs // ); if (!result) { return result; } // result = chlhHelper .Init( mSymbol, mPeriod, mInputs.chlhInputs // ); // return result; } // // DeInit all Requirements ... virtual void DeInit() { // delete tsHelper; delete fiHelper; delete tdHelper; delete lhHelper; delete tmHelper; delete ccHelper; delete ctHelper; delete obdHelper; delete rsiHelper; delete amaHelper; delete chmaHelper; delete chlhHelper; } // // Functions ... // // Set Default Position's Type ... // Enable / Disable Long (Buy), Short (Sell) ... void SetSignalTypeState( ENUM_POSITION_TYPE type, // Which types are Signals be Targetted bool state // Which State is going to Set ) { // if (IsLong(type)) { mIsLongEnable = state; } else { mIsShortEnable = state; } } // // Set Signal Providers ... void SetSignalProviderState( ENUM_X5_SIGNAL_PROVIDERS provider, // Provider State bool state // Which state is going to set ... ) { // if (provider == NONE) { return; } // switch (provider) { // case XSP: mIsXSPSignalProviderEnable = state; break; // case XTD: mIsXTDSignalProviderEnable = state; break; // case XTAM: mIsXTAMSignalProviderEnable = state; break; // case XSI: mIsXSISignalProviderEnable = state; break; // case XTSFI: mIsXTSFISignalProviderEnable = state; break; // case XOBDLH: mIsXOBDLHSignalProviderEnable = state; break; // case XCHMACC: mIsXCHMACCSignalProviderEnable = state; break; // case XCHMAMN: mIsXCHMAMNSignalProviderEnable = state; break; // case XCHMAMX: mIsXCHMAMXSignalProviderEnable = state; break; } } // virtual string GetTag() { // string result = NULL; // result = // GetToken() + "[" + GetSymbol() + "," + ToString(GetPeriod()) + "]" // ; // return result; } // virtual void GetMarketConditions( X5MarketConditions &mConditions, // Market Conditions Result int barIndex = 0 // Specified Bar Index ) { // mConditions.Clear(); // // XTM ... tmHelper.CopyMain( barIndex, mNumberOfItems, mConditions.tms); // // XAMA ... amaHelper.CopyMain( barIndex, mNumberOfItems, mConditions.amas); // // XFI ... fiHelper.CopyMain( barIndex, mNumberOfItems, mConditions.fis); // // XOBD ... obdHelper.CopyMain( barIndex, mNumberOfItems, mConditions.obds); // // XRSI ... rsiHelper.CopyMain( barIndex, mNumberOfItems, mConditions.rsis); // // XLH ... // // HH ... lhHelper.CopyHH( barIndex, mNumberOfItems, mConditions.lhHhs); // // LL ... lhHelper.CopyLL( barIndex, mNumberOfItems, mConditions.lhLls); // // Signal ... lhHelper.CopySignal( barIndex, mNumberOfItems, mConditions.lhSignals); // // XTD ... // // Bullish ... tdHelper.CopyBullish( barIndex, mNumberOfItems, mConditions.tdBullishs); // // Bearish ... tdHelper.CopyBearish( barIndex, mNumberOfItems, mConditions.tdBearishs); // // Signal ... tdHelper.CopySignal( barIndex, mNumberOfItems, mConditions.tdSignals); // // XTS ... // // Current ... tsHelper.CopyCurrent( barIndex, mNumberOfItems, mConditions.tsCurrents); // // Nearest ... tsHelper.CopyNearest( barIndex, mNumberOfItems, mConditions.tsNearests); // // Mediest ... tsHelper.CopyMediest( barIndex, mNumberOfItems, mConditions.tsMediests); // // Farest ... tsHelper.CopyFarest( barIndex, mNumberOfItems, mConditions.tsFarests); // // XCHMA ... // // Short ... // // Fast ... chmaHelper.CopySCFast( barIndex, mNumberOfItems, mConditions.chmaScFasts); // // Slow ... chmaHelper.CopySCSlow( barIndex, mNumberOfItems, mConditions.chmaScSlows); // // Medium ... // // Fast ... chmaHelper.CopyMCFast( barIndex, mNumberOfItems, mConditions.chmaMcFasts); // // Slow ... chmaHelper.CopyMCSlow( barIndex, mNumberOfItems, mConditions.chmaMcSlows); // // Long ... // // Fast ... chmaHelper.CopyLCFast( barIndex, mNumberOfItems, mConditions.chmaLcFasts); // // Slow ... chmaHelper.CopyLCSlow( barIndex, mNumberOfItems, mConditions.chmaLcSlows); // // Hot States ... chmaHelper.CopyHotState( barIndex, mNumberOfItems, mConditions.chmaHotStates); // // XCHLH ... // // Short ... // // HH ... chlhHelper.CopySCHH( barIndex, mNumberOfItems, mConditions.chlhScHHs); // // LL ... chlhHelper.CopySCLL( barIndex, mNumberOfItems, mConditions.chlhScLLs); // // Medium ... // // HH ... chlhHelper.CopyMCHH( barIndex, mNumberOfItems, mConditions.chlhMcHHs); // // LL ... chlhHelper.CopyMCLL( barIndex, mNumberOfItems, mConditions.chlhMcLLs); // // Long ... // // HH ... chlhHelper.CopyLCHH( barIndex, mNumberOfItems, mConditions.chlhLcHHs); // // LL ... chlhHelper.CopyLCLL( barIndex, mNumberOfItems, mConditions.chlhLcLLs); // // Hot State ... chlhHelper.CopyHotState( barIndex, mNumberOfItems, mConditions.chlhHotStates); // // Filling Bars ... mCycle.GetBars( mConditions.bars, 0, mNumberOfItems); // CalculateConditions(mConditions); } // // Check Market For Signal ... virtual bool HasSignal( int barIndex, XSignal &mSignal, // Hold's Signal if Exists ... X5MarketConditions &mConditions // Hold's Market Conditions ... ) { // bool result = false; // result = !CanIgnoreProcess(); if (!result) { return result; } // // Retrieve Market Conditions ... GetMarketConditions(mConditions, barIndex); // // Now we Have to Pass the Conditions to Each Signal Provider // for Retrieving Signals Based On them ... // // Long ... if (mIsLongEnable) { // XSignal lSignal; // int signalPusher = 0; // bool hasXSPSignal = false; bool hasXTDSignal = false; bool hasXTAMSignal = false; bool hasXSISignal = false; bool hasXTSFISignal = false; bool hasXOBDLHSignal = false; bool hasXCHMACCSignal = false; bool hasXCHMAMNSignal = false; bool hasXCHMAMXSignal = false; // // XPS ... if (mIsXSPSignalProviderEnable) { // hasXSPSignal = XSPHasSLongignal( mConditions // ); // if (hasXSPSignal) { signalPusher++; } } // // XTD ... if (mIsXTDSignalProviderEnable) { // hasXTDSignal = XTDHasSLongignal( mConditions // ); // if (hasXTDSignal) { signalPusher++; } } // // XTAM ... if (mIsXTAMSignalProviderEnable) { // hasXTAMSignal = XTAMHasSLongignal( mConditions // ); // if (hasXTAMSignal) { signalPusher++; } } // // XSI ... if (mIsXSISignalProviderEnable) { // hasXSISignal = XSIHasSLongignal( mConditions // ); // if (hasXSISignal) { signalPusher++; } } // // XTSFI ... if (mIsXTSFISignalProviderEnable) { // hasXTSFISignal = XTSFIHasSLongignal( mConditions // ); // if (hasXTSFISignal) { signalPusher++; } } // // XOBDLH ... if (mIsXOBDLHSignalProviderEnable) { // hasXOBDLHSignal = XOBDLHHasSLongignal( mConditions // ); // if (hasXOBDLHSignal) { signalPusher++; } } // // XCHMACC ... if (mIsXCHMACCSignalProviderEnable) { // hasXCHMACCSignal = XCHMACCHasSLongignal( mConditions // ); // if (hasXCHMACCSignal) { signalPusher++; } } // // XCHMAMN ... if (mIsXCHMAMNSignalProviderEnable) { // hasXCHMAMNSignal = XCHMAMNHasSLongignal( mConditions // ); // if (hasXCHMAMNSignal) { signalPusher++; } } // // XCHMAMX ... if (mIsXCHMAMXSignalProviderEnable) { // hasXCHMAMXSignal = XCHMAMXHasSLongignal( mConditions // ); // if (hasXCHMAMXSignal) { signalPusher++; } } } // // Short ... if (mIsShortEnable) { // XSignal sSignal; // int signalPusher = 0; // bool hasXSPSignal = false; bool hasXTDSignal = false; bool hasXTAMSignal = false; bool hasXSISignal = false; bool hasXTSFISignal = false; bool hasXOBDLHSignal = false; bool hasXCHMACCSignal = false; bool hasXCHMAMNSignal = false; bool hasXCHMAMXSignal = false; // // XPS ... if (mIsXSPSignalProviderEnable) { // hasXSPSignal = XSPHasSShortignal( mConditions // ); // if (hasXSPSignal) { signalPusher++; } } // // XTD ... if (mIsXTDSignalProviderEnable) { // hasXTDSignal = XTDHasSShortignal( mConditions // ); // if (hasXTDSignal) { signalPusher++; } } // // XTAM ... if (mIsXTAMSignalProviderEnable) { // hasXTAMSignal = XTAMHasSShortignal( mConditions // ); // if (hasXTAMSignal) { signalPusher++; } } // // XSI ... if (mIsXSISignalProviderEnable) { // hasXSISignal = XSIHasSShortignal( mConditions // ); // if (hasXSISignal) { signalPusher++; } } // // XTSFI ... if (mIsXTSFISignalProviderEnable) { // hasXTSFISignal = XTSFIHasSShortignal( mConditions // ); // if (hasXTSFISignal) { signalPusher++; } } // // XOBDLH ... if (mIsXOBDLHSignalProviderEnable) { // hasXOBDLHSignal = XOBDLHHasSShortignal( mConditions // ); // if (hasXOBDLHSignal) { signalPusher++; } } // // XCHMACC ... if (mIsXCHMACCSignalProviderEnable) { // hasXCHMACCSignal = XCHMACCHasSShortignal( mConditions // ); // if (hasXCHMACCSignal) { signalPusher++; } } // // XCHMAMN ... if (mIsXCHMAMNSignalProviderEnable) { // hasXCHMAMNSignal = XCHMAMNHasSShortignal( mConditions // ); // if (hasXCHMAMNSignal) { signalPusher++; } } // // XCHMAMX ... if (mIsXCHMAMXSignalProviderEnable) { // hasXCHMAMXSignal = XCHMAMXHasSShortignal( mConditions // ); // if (hasXCHMAMXSignal) { signalPusher++; } } } // if (result) { // string mConditionsStr = mConditions.GenerateSummary(); mConditionsCollector.Add(mConditionsStr); Print("Conditions: " + "\n" + mConditionsStr); } // return result; } // // Protected ... protected: // X5ProviderInputs mInputs; // // Private ... private: // // Props ... // // Prepare an Instance of Data Collector for MarketConditions ... XSC5MarketConditionDataCollector mConditionsCollector; // int mNumberOfItems; // Number of Buffer Ites Read in Conditions ... // // Tools ... // // Calculations ... // // Calculate Conditions ... void CalculateConditions(X5MarketConditions &mConditions) { // CalculateTMConditions(mConditions); CalculateAMAConditions(mConditions); CalculateFIConditions(mConditions); CalculateOBDConditions(mConditions); CalculateRSIConditions(mConditions); CalculateCHLHConditions(mConditions); CalculateLHConditions(mConditions); CalculateTDConditions(mConditions); CalculateTSConditions(mConditions); CalculateCHMAConditions(mConditions); } // // XTM .. void CalculateTMConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // mConditions.isXTMPeak = IsIncreasing( mFrom, mIndex, mConditions.tms); // mConditions.isXTMVale = IsDecreasing( mFrom, mIndex, mConditions.tms); // mConditions.isXTMBullish = mConditions.bars[mIndex].low > mConditions.tms[mIndex]; bool isXTMBullishPrev = mConditions.bars[mPrevIndex].low > mConditions.tms[mPrevIndex]; // mConditions.isXTMBearish = mConditions.bars[mIndex].high < mConditions.tms[mIndex]; bool isXTMBearishPrev = mConditions.bars[mPrevIndex].high < mConditions.tms[mPrevIndex]; // mConditions.isXTMNeutural = !mConditions.isXTMBullish && !mConditions.isXTMBearish; bool isXTMNeuturalPrev = !isXTMBullishPrev && !isXTMBearishPrev; // mConditions.isXTMEndBullish = // !mConditions.isXTMBullish && isXTMBullishPrev // ; // mConditions.isXTMEndBearish = // !mConditions.isXTMBearish && isXTMBearishPrev // ; // mConditions.isXTMStartBullish = // mConditions.isXTMBullish && !isXTMBullishPrev // ; // mConditions.isXTMStartBearish = // mConditions.isXTMBearish && !isXTMBearishPrev // ; // mConditions.isXTMEndBullishByNeutural = // mConditions.isXTMNeutural && isXTMBullishPrev // ; // mConditions.isXTMEndBearishByNeutural = // mConditions.isXTMNeutural && isXTMBearishPrev // ; // mConditions.isXTMStartBullishAfterNeutural = // mConditions.isXTMBullish && isXTMNeuturalPrev // ; // mConditions.isXTMStartBearishAfterNeutural = // mConditions.isXTMBearish && isXTMNeuturalPrev // ; } // // XAMA .. void CalculateAMAConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // mConditions.isXAMAPeak = IsIncreasing( mFrom, mIndex, mConditions.amas); // mConditions.isXAMAVale = IsDecreasing( mFrom, mIndex, mConditions.amas); // mConditions.isXAMABullish = mConditions.bars[mIndex].low > mConditions.amas[mIndex]; bool isXAMABullishPrev = mConditions.bars[mPrevIndex].low > mConditions.amas[mPrevIndex]; // mConditions.isXAMABearish = mConditions.bars[mIndex].high < mConditions.amas[mIndex]; bool isXAMABearishPrev = mConditions.bars[mPrevIndex].high < mConditions.amas[mPrevIndex]; // mConditions.isXAMANeutural = !mConditions.isXAMABullish && !mConditions.isXAMABearish; bool isXAMANeuturalPrev = !isXAMABullishPrev && !isXAMABearishPrev; // mConditions.isXAMAEndBullish = // !mConditions.isXAMABullish && isXAMABullishPrev // ; // mConditions.isXAMAEndBearish = // !mConditions.isXAMABearish && isXAMABearishPrev // ; // mConditions.isXAMAStartBullish = // mConditions.isXAMABullish && !isXAMABullishPrev // ; // mConditions.isXAMAStartBearish = // mConditions.isXAMABearish && !isXAMABearishPrev // ; // mConditions.isXAMAEndBullishByNeutural = // mConditions.isXAMANeutural && isXAMABullishPrev // ; // mConditions.isXAMAEndBearishByNeutural = // mConditions.isXAMANeutural && isXAMABearishPrev // ; // mConditions.isXAMAStartBullishAfterNeutural = // mConditions.isXAMABullish && isXAMANeuturalPrev // ; // mConditions.isXAMAStartBearishAfterNeutural = // mConditions.isXAMABearish && isXAMANeuturalPrev // ; } // // XFI ... void CalculateFIConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // mConditions.isXFIPeak = IsIncreasing( mFrom, mIndex, mConditions.fis); // mConditions.isXFIVale = IsDecreasing( mFrom, mIndex, mConditions.fis); // mConditions.isXFIOverZero = mConditions.fis[mIndex] > 0; // mConditions.isXFICrossedOverZero = // mConditions.isXFIOverZero && mConditions.fis[mPrevIndex] <= 0 // ; // mConditions.isXFIUnderZero = mConditions.fis[mIndex] < 0; // mConditions.isXFICrossedUnderZero = // mConditions.isXFIUnderZero && mConditions.fis[mPrevIndex] >= 0 // ; } // // XOBD ... void CalculateOBDConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // mConditions.isXOBDSwingLow = mConditions.obds[mIndex] == X_SWING_LOW; mConditions.isXOBDSwingHigh = mConditions.obds[mIndex] == X_SWING_HIGH; } // // XRSI ... void CalculateRSIConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // double shortEntryValue = mInputs.rsiInputs.shortEntryValue; double shortExitValue = mInputs.rsiInputs.shortExitValue; double longEntryValue = mInputs.rsiInputs.longEntryValue; double longExitValue = mInputs.rsiInputs.longExitValue; // mConditions.isXRSIPeak = IsIncreasing( mFrom, mIndex, mConditions.rsis); // mConditions.isXRSIVale = IsDecreasing( mFrom, mIndex, mConditions.rsis); // mConditions.isXRSICrossedOverLongExit = // mConditions.rsis[mIndex] > longExitValue && mConditions.rsis[mPrevIndex] <= longExitValue; // ; // mConditions.isXRSICrossedOverLongEntry = // mConditions.rsis[mIndex] > longEntryValue && mConditions.rsis[mPrevIndex] <= longEntryValue; // ; // mConditions.isXRSICrossedUnderShortExit = // mConditions.rsis[mIndex] < shortExitValue && mConditions.rsis[mPrevIndex] >= shortExitValue; // ; // mConditions.isXRSICrossedUnderShortEntry = // mConditions.rsis[mIndex] < shortEntryValue && mConditions.rsis[mPrevIndex] >= shortEntryValue; // ; } // // XCHLH ... void CalculateCHLHConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // mConditions.isXCHLHSameHHs = // mConditions.chlhScHHs[mIndex] == mConditions.chlhMcHHs[mIndex] && mConditions.chlhMcHHs[mIndex] == mConditions.chlhLcHHs[mIndex] // ; // mConditions.isXCHLHSameLLs = // mConditions.chlhScLLs[mIndex] == mConditions.chlhMcLLs[mIndex] && mConditions.chlhMcLLs[mIndex] == mConditions.chlhLcLLs[mIndex] // ; // mConditions.isXCHLHSCMCHHSame = // mConditions.chlhScHHs[mIndex] == mConditions.chlhMcHHs[mIndex] // ; // mConditions.isXCHLHSCMCLLSame = // mConditions.chlhScLLs[mIndex] == mConditions.chlhMcLLs[mIndex] // ; // mConditions.isXCHLHSCLCHHSame = // mConditions.chlhScHHs[mIndex] == mConditions.chlhLcLLs[mIndex] // ; // mConditions.isXCHLHSCLCLLSame = // mConditions.chlhScLLs[mIndex] == mConditions.chlhLcLLs[mIndex] // ; // mConditions.isXCHLHMCLCHHSame = // mConditions.chlhMcHHs[mIndex] == mConditions.chlhLcHHs[mIndex] // ; // mConditions.isXCHLHMCLCLLSame = // mConditions.chlhMcLLs[mIndex] == mConditions.chlhLcLLs[mIndex] // ; // // // isXCHLHMCOnTopOfLC = // // // // // ; // // // isXCHLHMCInBottomOfLC = // // // // // ; } // // XLH ... void CalculateLHConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // mConditions.isXLHHHIncreased = IsIncreasing( mFrom, mIndex, mConditions.lhHhs); // mConditions.isXLHHHDecreased = IsDecreasing( mFrom, mIndex, mConditions.lhHhs); // mConditions.isXLHLLIncreased = IsIncreasing( mFrom, mIndex, mConditions.lhLls); // mConditions.isXLHLLDecreased = IsDecreasing( mFrom, mIndex, mConditions.lhLls); // mConditions.isXLHLowAttachedLL = mConditions.bars[mIndex].low == mConditions.lhLls[mIndex]; // mConditions.isXLHHighAttachedHH = mConditions.bars[mIndex].high == mConditions.lhHhs[mIndex]; ; // mConditions.isXLHHHSameInLength = IsSame(mConditions.lhHhs); // mConditions.isXLHLLSameInLength = IsSame(mConditions.lhLls); // mConditions.isXLHPriceOverSignal = mConditions.bars[mIndex].low > mConditions.lhSignals[mIndex]; // mConditions.isXLHPriceUnderSignal = mConditions.bars[mIndex].high < mConditions.lhSignals[mIndex]; // mConditions.isXLHPriceInSignalRange = !mConditions.isXLHPriceOverSignal && !mConditions.isXLHPriceUnderSignal; // mConditions.isXLHPriceCrossedOverSignal = // mConditions.isXLHPriceOverSignal && !(mConditions.bars[mPrevIndex].low > mConditions.lhSignals[mPrevIndex]) // ; // mConditions.isXLHPriceCrossedUnderSignal = // mConditions.isXLHPriceUnderSignal && !(mConditions.bars[mIndex].high < mConditions.lhSignals[mIndex]) // ; } // // XTD ... void CalculateTDConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // mConditions.isXTDSignalPeak = IsIncreasing( mFrom, mIndex, mConditions.tdSignals); // mConditions.isXTDSignalVale = IsDecreasing( mFrom, mIndex, mConditions.tdSignals); // mConditions.isXTDBullishPeak = IsIncreasing( mFrom, mIndex, mConditions.tdBullishs); // mConditions.isXTDBullishVale = IsDecreasing( mFrom, mIndex, mConditions.tdBullishs); // mConditions.isXTDBearishPeak = IsIncreasing( mFrom, mIndex, mConditions.tdBearishs); // mConditions.isXTDBearishVale = IsDecreasing( mFrom, mIndex, mConditions.tdBearishs); // mConditions.isXTDBullOverBear = mConditions.tdBullishs[mIndex] > mConditions.tdBearishs[mIndex]; bool isXTDBullOverBearPrev = mConditions.tdBullishs[mPrevIndex] > mConditions.tdBearishs[mPrevIndex]; // mConditions.isXTDBullUnderBear = mConditions.tdBullishs[mIndex] < mConditions.tdBearishs[mIndex]; bool isXTDBullUnderBearPrev = mConditions.tdBullishs[mPrevIndex] < mConditions.tdBearishs[mPrevIndex]; // mConditions.isXTDSignalOverBear = mConditions.tdSignals[mIndex] > mConditions.tdBearishs[mIndex]; bool isXTDSignalOverBearPrev = mConditions.tdSignals[mPrevIndex] > mConditions.tdBearishs[mPrevIndex]; // mConditions.isXTDSignalUnderBear = mConditions.tdSignals[mIndex] < mConditions.tdBearishs[mIndex]; bool isXTDSignalUnderBearPrev = mConditions.tdSignals[mPrevIndex] < mConditions.tdBearishs[mPrevIndex]; // mConditions.isXTDBullCrossedOverBear = mConditions.isXTDBullOverBear && !isXTDBullOverBearPrev; // mConditions.isXTDBullCrossedUnderBear = mConditions.isXTDBullUnderBear && !isXTDBullUnderBearPrev; // mConditions.isXTDSignalCrossedOverBear = mConditions.isXTDSignalOverBear && !isXTDSignalOverBearPrev; // mConditions.isXTDSignalCrossedUnderBear = mConditions.isXTDSignalUnderBear && !isXTDSignalUnderBearPrev; } // // XTS ... void CalculateTSConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // double current = mConditions.tsCurrents[mIndex]; double currentPrev = mConditions.tsCurrents[mPrevIndex]; // double nearest = mConditions.tsNearests[mIndex]; double nearestPrev = mConditions.tsNearests[mPrevIndex]; // double mediest = mConditions.tsMediests[mIndex]; double mediestPrev = mConditions.tsMediests[mPrevIndex]; // double farest = mConditions.tsFarests[mIndex]; double farestPrev = mConditions.tsFarests[mPrevIndex]; // double tsValues[] = {current, nearest, mediest, farest}; double tsMax = GetMax(tsValues); double tsMin = GetMin(tsValues); // double tsPrevValues[] = {currentPrev, nearestPrev, mediestPrev, farestPrev}; double tsPrevMax = GetMax(tsPrevValues); double tsPrevMin = GetMin(tsPrevValues); // mConditions.isXTSAllSame = // current == nearest && nearest == mediest && mediest == farest // ; // mConditions.isXTSCurrentMin = current == tsMin; mConditions.isXTSCurrentMax = current == tsMax; // mConditions.isXTSCurrentOverFarest = current > farest; bool isXTSCurrentOverFarestPrev = currentPrev > farestPrev; // mConditions.isXTSCurrentOverNearest = current > nearest; bool isXTSCurrentOverNearestPrev = currentPrev > nearestPrev; // mConditions.isXTSCurrentOverMediest = current > mediest; bool isXTSCurrentOverMediestPrev = currentPrev > mediestPrev; // mConditions.isXTSCurrentUnderFarest = current < farest; bool isXTSCurrentUnderFarestPrev = currentPrev < farestPrev; // mConditions.isXTSCurrentUnderNearest = current < nearest; bool isXTSCurrentUnderNearestPrev = currentPrev < nearestPrev; // mConditions.isXTSCurrentUnderMediest = current < mediest; bool isXTSCurrentUnderMediestPrev = currentPrev < mediestPrev; // mConditions.isXTSCurrentCrossedOverFarest = mConditions.isXTSCurrentOverFarest && !isXTSCurrentOverFarestPrev; // mConditions.isXTSCurrentCrossedOverNearest = mConditions.isXTSCurrentOverNearest && !isXTSCurrentOverNearestPrev; // mConditions.isXTSCurrentCrossedOverMediest = mConditions.isXTSCurrentOverMediest && !isXTSCurrentOverMediestPrev; // mConditions.isXTSCurrentCrossedUnderFarest = mConditions.isXTSCurrentUnderFarest && !isXTSCurrentUnderFarestPrev; // mConditions.isXTSCurrentCrossedUnderNearest = mConditions.isXTSCurrentUnderNearest && !isXTSCurrentUnderNearestPrev; // mConditions.isXTSCurrentCrossedUnderMediest = mConditions.isXTSCurrentUnderMediest && !isXTSCurrentUnderMediestPrev; } // // XCHMA ... void CalculateCHMAConditions(X5MarketConditions &mConditions) { // int mIndex = 0; int mPrevIndex = mIndex + 1; int mLength = 10; int mFrom = mIndex + mLength; // double scFast = mConditions.chmaScFasts[mIndex]; double scSlow = mConditions.chmaScSlows[mIndex]; double scFastPrev = mConditions.chmaScFasts[mPrevIndex]; double scSlowPrev = mConditions.chmaScSlows[mPrevIndex]; // double mcFast = mConditions.chmaMcFasts[mIndex]; double mcSlow = mConditions.chmaMcSlows[mIndex]; double mcFastPrev = mConditions.chmaMcFasts[mPrevIndex]; double mcSlowPrev = mConditions.chmaMcSlows[mPrevIndex]; // double lcFast = mConditions.chmaLcFasts[mIndex]; double lcSlow = mConditions.chmaLcSlows[mIndex]; double lcFastPrev = mConditions.chmaLcFasts[mPrevIndex]; double lcSlowPrev = mConditions.chmaLcSlows[mPrevIndex]; // double chmaValues[] = { scFast, scSlow, mcFast, mcSlow, lcFast, lcSlow}; double chmaNonSCValues[] = { mcFast, mcSlow, lcFast, lcSlow}; double chmaMin = GetMin(chmaValues); double chmaMax = GetMax(chmaValues); double chmaNonSCMin = GetMin(chmaNonSCValues); double chmaNonSCMax = GetMax(chmaNonSCValues); // double chmaValuesPrev[] = { scFastPrev, scSlowPrev, mcFastPrev, mcSlowPrev, lcFastPrev, lcSlowPrev}; double chmaNonSCValuesPrev[] = { mcFastPrev, mcSlowPrev, lcFastPrev, lcSlowPrev}; double chmaMinPrev = GetMin(chmaValuesPrev); double chmaMaxPrev = GetMax(chmaValuesPrev); double chmaNonSCMinPrev = GetMin(chmaNonSCValuesPrev); double chmaNonSCMaxPrev = GetMax(chmaNonSCValuesPrev); // mConditions.isXCHMASCOverMax = MathMin(scFast, scSlow) > chmaNonSCMax; bool isXCHMASCOverMaxPrev = MathMin(scFastPrev, scSlowPrev) > chmaNonSCMaxPrev; // mConditions.isXCHMASCOverMin = MathMin(scFast, scSlow) > chmaNonSCMin; bool isXCHMASCOverMinPrev = MathMin(scFastPrev, scSlowPrev) > chmaNonSCMinPrev; // mConditions.isXCHMASCUnderMax = MathMax(scFast, scSlow) < chmaNonSCMax; bool isXCHMASCUnderMaxPrev = MathMax(scFastPrev, scSlowPrev) < chmaNonSCMaxPrev; // mConditions.isXCHMASCUnderMin = MathMax(scFast, scSlow) < chmaNonSCMin; bool isXCHMASCUnderMinPrev = MathMax(scFastPrev, scSlowPrev) < chmaNonSCMinPrev; // mConditions.isXCHMASCCrossedOverMax = mConditions.isXCHMASCOverMax && !isXCHMASCOverMaxPrev; // mConditions.isXCHMASCCrossedUnderMax = mConditions.isXCHMASCUnderMax && !isXCHMASCUnderMaxPrev; // mConditions.isXCHMASCCrossedOverMin = mConditions.isXCHMASCOverMin && !isXCHMASCOverMinPrev; // mConditions.isXCHMASCCrossedUnderMin = mConditions.isXCHMASCUnderMin && !isXCHMASCUnderMinPrev; // // Short ... // mConditions.isXCHMASCPeak = IsIncreasing( mFrom, mIndex, mConditions.chmaScFasts); // mConditions.isXCHMASCVale = IsDecreasing( mFrom, mIndex, mConditions.chmaScFasts); // mConditions.isXCHMASCTrendsUp = IsTrendingUp( mConditions.chmaScFasts, mConditions.chmaScSlows); // mConditions.isXCHMASCTrendsDown = IsTrendingDown( mConditions.chmaScFasts, mConditions.chmaScSlows); // mConditions.isXCHMASCFastOverSlow = scFast > scSlow; bool isXCHMASCFastOverSlowPrev = scFastPrev > scSlowPrev; // mConditions.isXCHMASCFastUnderSlow = scFast < scSlow; bool isXCHMASCFastUnderSlowPrev = scFastPrev < scSlowPrev; // mConditions.isXCHMASCFastCrossedOverSlow = mConditions.isXCHMASCFastOverSlow && !isXCHMASCFastOverSlowPrev; // mConditions.isXCHMASCFastCrossedUnderSlow = mConditions.isXCHMASCFastUnderSlow && !isXCHMASCFastUnderSlowPrev; // // Medium ... // mConditions.isXCHMAMCPeak = IsIncreasing( mFrom, mIndex, mConditions.chmaMcFasts); // mConditions.isXCHMAMCVale = IsDecreasing( mFrom, mIndex, mConditions.chmaMcFasts); // mConditions.isXCHMAMCTrendsUp = IsTrendingUp( mConditions.chmaMcFasts, mConditions.chmaMcSlows); // mConditions.isXCHMAMCTrendsDown = IsTrendingDown( mConditions.chmaMcFasts, mConditions.chmaMcSlows); // mConditions.isXCHMAMCFastOverSlow = mcFast > mcSlow; bool isXCHMAMCFastOverSlowPrev = mcFastPrev > mcSlowPrev; // mConditions.isXCHMAMCFastUnderSlow = mcFast < mcSlow; bool isXCHMAMCFastUnderSlowPrev = mcFastPrev < mcSlowPrev; // mConditions.isXCHMAMCFastCrossedOverSlow = mConditions.isXCHMAMCFastOverSlow && !isXCHMAMCFastOverSlowPrev; // mConditions.isXCHMAMCFastCrossedUnderSlow = mConditions.isXCHMAMCFastUnderSlow && !isXCHMAMCFastUnderSlowPrev; // // Long ... // mConditions.isXCHMALCPeak = IsIncreasing( mFrom, mIndex, mConditions.chmaLcFasts); // mConditions.isXCHMALCVale = IsDecreasing( mFrom, mIndex, mConditions.chmaLcFasts); // mConditions.isXCHMALCTrendsUp = IsTrendingUp( mConditions.chmaLcFasts, mConditions.chmaLcSlows); // mConditions.isXCHMALCTrendsDown = IsTrendingDown( mConditions.chmaMcFasts, mConditions.chmaMcSlows); // mConditions.isXCHMALCFastOverSlow = lcFast > lcSlow; bool isXCHMALCFastOverSlowPrev = lcFastPrev > lcSlowPrev; // mConditions.isXCHMALCFastUnderSlow = lcFast < lcSlow; bool isXCHMALCFastUnderSlowPrev = lcFastPrev < lcSlowPrev; // mConditions.isXCHMALCFastCrossedOverSlow = mConditions.isXCHMALCFastOverSlow && !isXCHMALCFastOverSlowPrev; // mConditions.isXCHMALCFastCrossedUnderSlow = mConditions.isXCHMALCFastUnderSlow && !isXCHMALCFastUnderSlowPrev; } // // Signallers ... // bool mIsLongEnable; bool mIsShortEnable; // bool mIsXSPSignalProviderEnable; bool mIsXTDSignalProviderEnable; bool mIsXTAMSignalProviderEnable; bool mIsXSISignalProviderEnable; bool mIsXTSFISignalProviderEnable; bool mIsXOBDLHSignalProviderEnable; bool mIsXCHMACCSignalProviderEnable; bool mIsXCHMAMNSignalProviderEnable; bool mIsXCHMAMXSignalProviderEnable; // // Check Market Conditions is Ready for Long Signals or not ... bool IsReadyForLong( X5MarketConditions &mConditions, // Market Conditions ... bool checkXCHMAMin = true, // Force Check XCHMA Min State bool checkXCHMAMax = true, // Force Check XCHMA Max State bool checkXCHMACycles = true, // Force Check XCHMA Cycles State bool checkXCHMAPeaks = true, // Force Check XCHMA Peaks State bool checkXCHMATrendPowers = true, // Force Check XCHMA Trend Powers bool checkXOBD = true, // Force Check XOBD State bool checkXTS = true // Force Check XTS State ) { // bool result = true; // if (checkXCHMAMin) { // result = // // XCHMA MIN ... !( // (mConditions.isXCHMASCOverMin || mConditions.isXCHMASCCrossedOverMin) && (mConditions.isXCHMASCUnderMin || mConditions.isXCHMASCCrossedUnderMin) // ); } // if (checkXCHMAMax && result) { // result = // // XCHMA MAX ... !( // (mConditions.isXCHMASCOverMax || mConditions.isXCHMASCCrossedOverMax) && (mConditions.isXCHMASCUnderMax || mConditions.isXCHMASCCrossedUnderMax) // ) // ; } // if (checkXCHMACycles && result) { // result = // // Check XCHMA Trend Bullish ... ( // // All Cycles Bullish ... ( // // SC ... (mConditions.isXCHMASCFastOverSlow || mConditions.isXCHMASCFastCrossedOverSlow) // && // // MC ... (mConditions.isXCHMAMCFastOverSlow || mConditions.isXCHMAMCFastCrossedOverSlow) // && // // LC ... (mConditions.isXCHMALCFastOverSlow || mConditions.isXCHMALCFastCrossedOverSlow) // ) // || // // Two Cycle Fully Bullish ... ( // // SC and MC ... ( // // SC ... (mConditions.isXCHMASCFastOverSlow || mConditions.isXCHMASCFastCrossedOverSlow) // && // // MC ... (mConditions.isXCHMAMCFastOverSlow || mConditions.isXCHMAMCFastCrossedOverSlow) // ) // || // // SC and LC ... ( // // SC ... (mConditions.isXCHMASCFastOverSlow || mConditions.isXCHMASCFastCrossedOverSlow) // && // // LC ... (mConditions.isXCHMALCFastOverSlow || mConditions.isXCHMALCFastCrossedOverSlow) // ) // || // // MC and LC ... ( // // MC ... (mConditions.isXCHMAMCFastOverSlow || mConditions.isXCHMAMCFastCrossedOverSlow) // && // // LC ... (mConditions.isXCHMALCFastOverSlow || mConditions.isXCHMALCFastCrossedOverSlow) // ) // ) // ) // ; } // if (checkXCHMAPeaks && result) { // result = // // XCHMA Check Peaks ... !( // // All Cycles Peak ... (mConditions.isXCHMASCPeak && mConditions.isXCHMAMCPeak && mConditions.isXCHMALCPeak) // || // ( // // SC MC ... (mConditions.isXCHMASCPeak && mConditions.isXCHMAMCPeak) // || // // SC LC ... (mConditions.isXCHMASCPeak && mConditions.isXCHMALCPeak) // || // // MC LC ... (mConditions.isXCHMAMCPeak && mConditions.isXCHMALCPeak) // ) // ) // ; } // if (checkXCHMATrendPowers && result) { // result = // // XCHMA Check Trends Power ... !( // // All Trends Down ... (mConditions.isXCHMASCTrendsDown && mConditions.isXCHMAMCTrendsDown && mConditions.isXCHMALCTrendsDown) // || // // Twisted pairs ... ( // (mConditions.isXCHMASCTrendsDown && mConditions.isXCHMAMCTrendsDown) // || // (mConditions.isXCHMASCTrendsDown && mConditions.isXCHMALCTrendsDown) // || // (mConditions.isXCHMAMCTrendsDown && mConditions.isXCHMALCTrendsDown) // ) // ) // ; } // if (checkXOBD && result) { // result = // // XOBD Check Swings ... !mConditions.isXOBDSwingLow // ; } // if (checkXTS && result) { result = // // XTS Check ... !( // mConditions.isXTSCurrentMin && // ( // // All Under ... ( (mConditions.isXTSCurrentUnderNearest || mConditions.isXTSCurrentCrossedUnderNearest) && (mConditions.isXTSCurrentUnderMediest || mConditions.isXTSCurrentCrossedUnderMediest) && (mConditions.isXTSCurrentUnderFarest || mConditions.isXTSCurrentCrossedUnderFarest)) // || // // Pairs ... ( // ((mConditions.isXTSCurrentUnderNearest || mConditions.isXTSCurrentCrossedUnderNearest) && (mConditions.isXTSCurrentUnderMediest || mConditions.isXTSCurrentCrossedUnderMediest)) // || // ((mConditions.isXTSCurrentUnderNearest || mConditions.isXTSCurrentCrossedUnderNearest) && (mConditions.isXTSCurrentUnderFarest || mConditions.isXTSCurrentCrossedUnderFarest)) // || // ((mConditions.isXTSCurrentUnderMediest || mConditions.isXTSCurrentCrossedUnderMediest) && (mConditions.isXTSCurrentUnderFarest || mConditions.isXTSCurrentCrossedUnderFarest)) // ) // ) // ) // ; } // return result; } // // Check Market Conditions is Ready for Short Signals or not ... bool IsReadyForShort( X5MarketConditions &mConditions, // Market Conditions ... bool checkXCHMAMin = true, // Force Check XCHMA Min State bool checkXCHMAMax = true, // Force Check XCHMA Max State bool checkXCHMACycles = true, // Force Check XCHMA Cycles State bool checkXCHMAVales = true, // Force Check XCHMA Vales State bool checkXCHMATrendPowers = true, // Force Check XCHMA Trend Powers bool checkXOBD = true, // Force Check XOBD State bool checkXTS = true // Force Check XTS State ) { // bool result = true; // if (checkXCHMAMin) { // result = // // XCHMA MIN ... !( // (mConditions.isXCHMASCOverMin || mConditions.isXCHMASCCrossedOverMin) && (mConditions.isXCHMASCUnderMin || mConditions.isXCHMASCCrossedUnderMin) // ); } // if (checkXCHMAMax && result) { // result = // // XCHMA MAX ... !( // (mConditions.isXCHMASCOverMax || mConditions.isXCHMASCCrossedOverMax) && (mConditions.isXCHMASCUnderMax || mConditions.isXCHMASCCrossedUnderMax) // ) // ; } // if (checkXCHMACycles && result) { // result = // // Check XCHMA Trend Bullish ... ( // // All Cycles Bullish ... ( // // SC ... (mConditions.isXCHMASCFastUnderSlow || mConditions.isXCHMASCFastCrossedUnderSlow) // && // // MC ... (mConditions.isXCHMAMCFastUnderSlow || mConditions.isXCHMAMCFastCrossedUnderSlow) // && // // LC ... (mConditions.isXCHMALCFastUnderSlow || mConditions.isXCHMALCFastCrossedUnderSlow) // ) // || // // Two Cycle Fully Bullish ... ( // // SC and MC ... ( // // SC ... (mConditions.isXCHMASCFastUnderSlow || mConditions.isXCHMASCFastCrossedOverSlow) // && // // MC ... (mConditions.isXCHMAMCFastUnderSlow || mConditions.isXCHMAMCFastCrossedOverSlow) // ) // || // // SC and LC ... ( // // SC ... (mConditions.isXCHMASCFastUnderSlow || mConditions.isXCHMASCFastCrossedUnderSlow) // && // // LC ... (mConditions.isXCHMALCFastUnderSlow || mConditions.isXCHMALCFastCrossedUnderSlow) // ) // || // // MC and LC ... ( // // MC ... (mConditions.isXCHMAMCFastUnderSlow || mConditions.isXCHMAMCFastCrossedOverSlow) // && // // LC ... (mConditions.isXCHMALCFastUnderSlow || mConditions.isXCHMALCFastCrossedOverSlow) // ) // ) // ) // ; } // if (checkXCHMAVales && result) { // result = // // XCHMA Check Vales ... !( // // All Cycles Vale ... (mConditions.isXCHMASCVale && mConditions.isXCHMAMCVale && mConditions.isXCHMALCVale) // || // ( // // SC MC ... (mConditions.isXCHMASCVale && mConditions.isXCHMAMCVale) // || // // SC LC ... (mConditions.isXCHMASCVale && mConditions.isXCHMALCVale) // || // // MC LC ... (mConditions.isXCHMAMCVale && mConditions.isXCHMALCVale) // ) // ) // ; } // if (checkXCHMATrendPowers && result) { // result = // // XCHMA Check Trends Power ... !( // // All Trends Down ... (mConditions.isXCHMASCTrendsDown && mConditions.isXCHMAMCTrendsDown && mConditions.isXCHMALCTrendsDown) // || // // Twisted pairs ... ( // (mConditions.isXCHMASCTrendsDown && mConditions.isXCHMAMCTrendsDown) // || // (mConditions.isXCHMASCTrendsDown && mConditions.isXCHMALCTrendsDown) // || // (mConditions.isXCHMAMCTrendsDown && mConditions.isXCHMALCTrendsDown) // ) // ) // ; } // if (checkXOBD && result) { // result = // // XOBD Check Swings ... !mConditions.isXOBDSwingHigh // ; } // if (checkXTS && result) { // result = // // XTS Check ... !( // mConditions.isXTSCurrentMax && // ( // // All Over ... ( (mConditions.isXTSCurrentOverNearest || mConditions.isXTSCurrentCrossedOverNearest) && (mConditions.isXTSCurrentOverMediest || mConditions.isXTSCurrentCrossedOverMediest) && (mConditions.isXTSCurrentOverFarest || mConditions.isXTSCurrentCrossedOverFarest)) // || // // Pairs ... ( // ((mConditions.isXTSCurrentOverNearest || mConditions.isXTSCurrentCrossedOverNearest) && (mConditions.isXTSCurrentOverMediest || mConditions.isXTSCurrentCrossedOverMediest)) // || // ((mConditions.isXTSCurrentOverNearest || mConditions.isXTSCurrentCrossedOverNearest) && (mConditions.isXTSCurrentOverFarest || mConditions.isXTSCurrentCrossedOverFarest)) // || // ((mConditions.isXTSCurrentOverMediest || mConditions.isXTSCurrentCrossedOverMediest) && (mConditions.isXTSCurrentOverFarest || mConditions.isXTSCurrentCrossedOverFarest)) // ) // ) // ) // ; } // return result; } // // XSP ... bool XSPHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // return result; } // // XSP ... bool XSPHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // return result; } // // XTD ... bool XTDHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.isXTDSignalCrossedOverBear // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong(mConditions) // ) // ; // return result; } // // XTD ... bool XTDHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.isXTDSignalCrossedUnderBear // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForShort(mConditions) // ) // ; // return result; } // // XTAM ... bool XTAMHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // (mConditions.amas[1] > mConditions.tms[1] && mConditions.amas[2] > mConditions.tms[2]) // && // !(mConditions.amas[2] > mConditions.tms[2] && mConditions.amas[3] > mConditions.tms[3]) // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong(mConditions) // ) // ; // return result; } // // XTAM ... bool XTAMHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // (mConditions.amas[1] < mConditions.amas[1] && mConditions.amas[2] < mConditions.amas[2]) // && // !(mConditions.amas[2] < mConditions.amas[2] && mConditions.amas[3] < mConditions.amas[3]) // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForShort(mConditions) // ) // ; // return result; } // // XSI ... bool XSIHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.isXRSICrossedOverLongEntry && mConditions.rsis[3] < mInputs.rsiInputs.longEntryValue // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong( mConditions, true, // XCHMA Min true, // XCHMA Max true, // XCHMA Cycles true, // XCHMA Peaks false, // XCHMA Trend Powers true, // XOBD true // XTS ) // ) // ; // return result; } // // XSI ... bool XSIHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.isXRSICrossedUnderShortEntry && mConditions.rsis[3] > mInputs.rsiInputs.shortEntryValue // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForShort( mConditions, true, // XCHMA Min true, // XCHMA Max true, // XCHMA Cycles true, // XCHMA Peaks false, // XCHMA Trend Powers true, // XOBD true // XTS ) // ) // ; // return result; } // // XTSFI ... bool XTSFIHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // double tsValues[] = { mConditions.tsCurrents[1], mConditions.tsNearests[1], mConditions.tsMediests[1], mConditions.tsFarests[1], }; // double tsMin = GetMin(tsValues); // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // tsMin == mConditions.tsFarests[1] && (mConditions.isXTSCurrentOverFarest || mConditions.isXTSCurrentCrossedOverFarest) && (mConditions.tsCurrents[1] < mConditions.tsNearests[1] || mConditions.tsCurrents[1] < mConditions.tsMediests[1]) && !(mConditions.isXTSCurrentUnderNearest || mConditions.isXTSCurrentCrossedUnderNearest) // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong(mConditions) // ) // ; // return result; } // // XTSFI ... bool XTSFIHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // double tsValues[] = { mConditions.tsCurrents[1], mConditions.tsNearests[1], mConditions.tsMediests[1], mConditions.tsFarests[1], }; // double tsMax = GetMax(tsValues); // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // tsMax == mConditions.tsFarests[1] && (mConditions.isXTSCurrentUnderFarest || mConditions.isXTSCurrentCrossedUnderFarest) && (mConditions.tsCurrents[1] > mConditions.tsNearests[1] || mConditions.tsCurrents[1] > mConditions.tsMediests[1]) && !(mConditions.isXTSCurrentOverNearest || mConditions.isXTSCurrentCrossedOverNearest) // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForShort(mConditions) // ) // ; // return result; } // // XOBDLH ... bool XOBDLHHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // X5MarketConditions mConditions2; GetMarketConditions( mConditions, 2 // ); // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions2.isXOBDSwingLow && mConditions2.isXLHLowAttachedLL && mConditions.lhLls[1] >= mConditions.lhLls[2] // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong( mConditions, true, // XCHMA Min true, // XCHMA Max false, // XCHMA Cycles false, // XCHMA Peaks false, // XCHMA Trend Powers false, // XOBD false // XTS ) // ) // ; // return result; } // // XOBDLH ... bool XOBDLHHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // X5MarketConditions mConditions2; GetMarketConditions( mConditions, 2 // ); // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions2.isXOBDSwingHigh && mConditions2.isXLHHighAttachedHH && mConditions.lhHhs[1] <= mConditions.lhHhs[2] // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForShort( mConditions, true, // XCHMA Min true, // XCHMA Max false, // XCHMA Cycles false, // XCHMA Peaks false, // XCHMA Trend Powers false, // XOBD false // XTS ) // ) // ; // return result; } // // XCHMACC ... bool XCHMACCHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.chmaScFasts[1] > mConditions.chmaScSlows[1] && mConditions.chmaMcFasts[1] > mConditions.chmaMcSlows[1] && mConditions.chmaLcFasts[1] > mConditions.chmaLcSlows[1] && // mConditions.chmaScFasts[2] > mConditions.chmaScSlows[2] && mConditions.chmaMcFasts[2] > mConditions.chmaMcSlows[2] && mConditions.chmaLcFasts[2] > mConditions.chmaLcSlows[2] && // !( // mConditions.chmaScFasts[3] > mConditions.chmaScSlows[3] && mConditions.chmaMcFasts[3] > mConditions.chmaMcSlows[3] && mConditions.chmaLcFasts[3] > mConditions.chmaLcSlows[3] // ) // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong(mConditions) // ) // ; // return result; } // // XCHMACC ... bool XCHMACCHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.chmaScFasts[1] < mConditions.chmaScSlows[1] && mConditions.chmaMcFasts[1] < mConditions.chmaMcSlows[1] && mConditions.chmaLcFasts[1] < mConditions.chmaLcSlows[1] && // mConditions.chmaScFasts[2] < mConditions.chmaScSlows[2] && mConditions.chmaMcFasts[2] < mConditions.chmaMcSlows[2] && mConditions.chmaLcFasts[2] < mConditions.chmaLcSlows[2] && // !( // mConditions.chmaScFasts[3] < mConditions.chmaScSlows[3] && mConditions.chmaMcFasts[3] < mConditions.chmaMcSlows[3] && mConditions.chmaLcFasts[3] < mConditions.chmaLcSlows[3] // ) // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong(mConditions) // ) // ; // return result; } // // XCHMAMN ... bool XCHMAMNHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // double nonSC2[] = { mConditions.chmaMcFasts[2], mConditions.chmaMcSlows[2], mConditions.chmaLcFasts[2], mConditions.chmaLcSlows[2], }; // double nonSCMax2 = GetMax(nonSC2); double nonSCMin2 = GetMax(nonSC2); // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.isXCHMASCCrossedOverMin && mConditions.chmaScFasts[2] < nonSCMin2 && mConditions.chmaScSlows[2] < nonSCMin2 // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong( mConditions, true, // XCHMA Min true, // XCHMA Max false, // XCHMA Cycles false, // XCHMA Peaks false, // XCHMA Trend Powers true, // XOBD true // XTS ) // ) // ; // return result; } // // XCHMAMN ... bool XCHMAMNHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // double nonSC2[] = { mConditions.chmaMcFasts[2], mConditions.chmaMcSlows[2], mConditions.chmaLcFasts[2], mConditions.chmaLcSlows[2], }; // double nonSCMax2 = GetMax(nonSC2); double nonSCMin2 = GetMax(nonSC2); // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.isXCHMASCCrossedUnderMin && mConditions.chmaScFasts[2] > nonSCMin2 && mConditions.chmaScSlows[2] > nonSCMin2 // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong( mConditions, true, // XCHMA Min true, // XCHMA Max false, // XCHMA Cycles false, // XCHMA Peaks false, // XCHMA Trend Powers true, // XOBD true // XTS ) // ) // ; // return result; } // // XCHMAMX ... bool XCHMAMXHasSLongignal( X5MarketConditions &mConditions // ) { // bool result = false; // double nonSC2[] = { mConditions.chmaMcFasts[2], mConditions.chmaMcSlows[2], mConditions.chmaLcFasts[2], mConditions.chmaLcSlows[2], }; // double nonSCMax2 = GetMax(nonSC2); double nonSCMin2 = GetMax(nonSC2); // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.isXCHMASCCrossedOverMax && mConditions.chmaScFasts[2] < nonSCMax2 && mConditions.chmaScSlows[2] < nonSCMax2 && MathAbs(nonSCMax2 - mConditions.chmaScFasts[2]) > MathAbs(mConditions.chmaScFasts[2] - mConditions.chmaScSlows[2]) && MathAbs(nonSCMax2 - mConditions.chmaScSlows[2]) > MathAbs(mConditions.chmaScFasts[2] - mConditions.chmaScSlows[2]) // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForLong( mConditions, true, // XCHMA Min true, // XCHMA Max false, // XCHMA Cycles false, // XCHMA Peaks false, // XCHMA Trend Powers true, // XOBD true // XTS ) // ) // ; // return result; } // // XCHMAMX ... bool XCHMAMXHasSShortignal( X5MarketConditions &mConditions // ) { // bool result = false; // double nonSC2[] = { mConditions.chmaMcFasts[2], mConditions.chmaMcSlows[2], mConditions.chmaLcFasts[2], mConditions.chmaLcSlows[2], }; // double nonSCMax2 = GetMax(nonSC2); double nonSCMin2 = GetMax(nonSC2); // // Start Analysing Market based On Conditions ... result = // // Base Condition: // each Strategy must has a Base Conditions, which they are usually common combinations // of Market Properties that must be happens to lookup for signals ... ( // mConditions.isXCHMASCCrossedUnderMax && mConditions.chmaScFasts[2] > nonSCMax2 && mConditions.chmaScSlows[2] > nonSCMax2 // ) // && // // Next Step is combine sorts of Conditions which make our choice // so Exact in Market ... ( // IsReadyForShort( mConditions, true, // XCHMA Min true, // XCHMA Max false, // XCHMA Cycles false, // XCHMA Peaks false, // XCHMA Trend Powers true, // XOBD true // XTS ) // ) // ; // return result; } }; // // Tools ... // void GetAllX5SignalProviders(ENUM_X5_SIGNAL_PROVIDERS &result[]) { // Clean(result); // Add(NONE, result); Add(XSP, result); Add(XTD, result); Add(XTAM, result); Add(XSI, result); Add(XTSFI, result); Add(XOBDLH, result); Add(XCHMACC, result); Add(XCHMAMN, result); Add(XCHMAMX, result); } // ENUM_X5_SIGNAL_PROVIDERS ToX5SignalProvider(string content) { // ENUM_X5_SIGNAL_PROVIDERS result = NONE; // if (!IsValid(content)) { return result; } // if (content == ToString(NONE)) { result = NONE; } else if (content == ToString(XSP)) { result = XSP; } else if (content == ToString(XTD)) { result = XTD; } else if (content == ToString(XTAM)) { result = XTAM; } else if (content == ToString(XSI)) { result = XSI; } else if (content == ToString(XTSFI)) { result = XTSFI; } else if (content == ToString(XOBDLH)) { result = XOBDLH; } else if (content == ToString(XCHMACC)) { result = XCHMACC; } else if (content == ToString(XCHMAMN)) { result = XCHMAMN; } else if (content == ToString(XCHMAMX)) { result = XCHMAMX; } // return result; } //