/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Helper Class Library // ---------------------------------------------- // Name: XSCXCHCHEHelper // Description: provides all Indicator // Helper 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 // // Imports ... #include "../Classes/x-saherelm.xhelper.class.mq5" // // Definitions ... // enum ENUM_XCHCHE_BUFFERS { // // Current ... XCHCHE_CLE1_LINE = 0, XCHCHE_CSE1_LINE = 1, XCHCHE_CLE2_LINE = 2, XCHCHE_CSE2_LINE = 3, // // Short ... XCHCHE_SLE1_LINE = 4, XCHCHE_SSE1_LINE = 5, XCHCHE_SLE2_LINE = 6, XCHCHE_SSE2_LINE = 7, // // Medium ... XCHCHE_MLE1_LINE = 8, XCHCHE_MSE1_LINE = 9, XCHCHE_MLE2_LINE = 10, XCHCHE_MSE2_LINE = 11, // // Long ... XCHCHE_LLE1_LINE = 12, XCHCHE_LSE1_LINE = 13, XCHCHE_LLE2_LINE = 14, XCHCHE_LSE2_LINE = 15, // // Hind ... XCHCHE_HLE1_LINE = 16, XCHCHE_HSE1_LINE = 17, XCHCHE_HLE2_LINE = 18, XCHCHE_HSE2_LINE = 19, }; // // Input Models ... struct XCHCHEInputs { // // Props ... // // Market ... int length; // Length int loopback; // Loopback double multiplier1; // 1st Multiplier double multiplier2; // 2nd Multiplier // // Calculation ... ENUM_APPLIED_PRICE upAppliedTo; // Up Zone Applied to ENUM_APPLIED_PRICE downAppliedTo; // Down Zone Applied to // // Cycles ... // // Short ... ENUM_X_PERIOD_METHOD scMethod; // How to Find Period ENUM_TIMEFRAMES scPeriod; // Time Period // // Medium ... ENUM_X_PERIOD_METHOD mcMethod; // How to Find Period ENUM_TIMEFRAMES mcPeriod; // Time Period // // Long ... ENUM_X_PERIOD_METHOD lcMethod; // How to Find Period ENUM_TIMEFRAMES lcPeriod; // Time Period // // Hind ... ENUM_X_PERIOD_METHOD hcMethod; // How to Find Period ENUM_TIMEFRAMES hcPeriod; // Time Period // // Presentation ... // bool showLE1; // Show Long Exit 1 bool showLE2; // Show Long Exit 2 bool showSE1; // Show Short Exit 1 bool showSE2; // Show Short Exit 2 // bool showCurrent; // Show Current Cycle bool showShort; // Show Short Cycle bool showMedium; // Show Medium Cycle bool showLong; // Show Long Cycle bool showHind; // Show Hind Cycle // // Constructor(s) ... XCHCHEInputs() { // Clean(); } // // Tools ... // // Clean ... void Clean() { // length = 0; loopback = 0; multiplier1 = 0; multiplier2 = 0; // upAppliedTo = PRICE_HIGH; downAppliedTo = PRICE_LOW; // scMethod = X_PERIOD_AUTO; scPeriod = NULL; mcMethod = X_PERIOD_AUTO; mcPeriod = NULL; lcMethod = X_PERIOD_AUTO; lcPeriod = NULL; hcMethod = X_PERIOD_AUTO; hcPeriod = NULL; // showLE1 = false; showLE2 = false; showSE1 = false; showSE2 = false; // showCurrent = false; showShort = false; showMedium = false; showLong = false; showHind = false; } // // Default ... void Default() { // length = 35; loopback = 26; multiplier1 = 3.0; multiplier2 = 3.5; // upAppliedTo = PRICE_HIGH; downAppliedTo = PRICE_LOW; // scMethod = X_PERIOD_AUTO; scPeriod = NULL; mcMethod = X_PERIOD_AUTO; mcPeriod = NULL; lcMethod = X_PERIOD_AUTO; lcPeriod = NULL; hcMethod = X_PERIOD_AUTO; hcPeriod = NULL; // showLE1 = true; showLE2 = true; showSE1 = true; showSE2 = true; // showCurrent = true; showShort = true; showMedium = true; showLong = true; showHind = true; } // // Validate ... bool IsValid() { // bool result = false; // result = // length >= 2 && loopback >= 0 && // (IsValid(scMethod, scPeriod) && IsValid(mcMethod, mcPeriod) && IsValid(lcMethod, lcPeriod) && IsValid(hcMethod, hcPeriod)) // ; // return result; } // // Retrieve MAx Length ... int Max() { // int result = 0; // result = // MathMax(0, length) // ; // return result; } }; // // Define Conditions ... struct XCHCHEConditions { // // Common ... string symbol; ENUM_TIMEFRAMES period; datetime time; // // Buffers ... // // Current ... double cLE1[]; double cLE2[]; double cSE1[]; double cSE2[]; // // Short ... double sLE1[]; double sLE2[]; double sSE1[]; double sSE2[]; // // Medium ... double mLE1[]; double mLE2[]; double mSE1[]; double mSE2[]; // // Long ... double lLE1[]; double lLE2[]; double lSE1[]; double lSE2[]; // // Hind ... double hLE1[]; double hLE2[]; double hSE1[]; double hSE2[]; // // Conditions ... // // Power ... bool hasBullishPower; bool hasBearishPower; bool isBullishPowerUp; bool isBearishPowerUp; bool isBullishPowerIncreasing; bool isBullishPowerDecreasing; bool isBearishPowerIncreasing; bool isBearishPowerDecreasing; // // Current ... bool isCBullish; bool isCBearish; bool isCStrongBullish; bool isCStrongBearish; bool isCSwitchedToBullish; bool isCSwitchedToBearish; bool isCStrongSwitchedToBullish; bool isCStrongSwitchedToBearish; // // Short ... bool isSBullish; bool isSBearish; bool isSStrongBullish; bool isSStrongBearish; bool isSSwitchedToBullish; bool isSSwitchedToBearish; bool isSStrongSwitchedToBullish; bool isSStrongSwitchedToBearish; // // Medium ... bool isMBullish; bool isMBearish; bool isMStrongBullish; bool isMStrongBearish; bool isMSwitchedToBullish; bool isMSwitchedToBearish; bool isMStrongSwitchedToBullish; bool isMStrongSwitchedToBearish; // // Long ... bool isLBullish; bool isLBearish; bool isLStrongBullish; bool isLStrongBearish; bool isLSwitchedToBullish; bool isLSwitchedToBearish; bool isLStrongSwitchedToBullish; bool isLStrongSwitchedToBearish; // // Hind ... bool isHBullish; bool isHBearish; bool isHStrongBullish; bool isHStrongBearish; bool isHSwitchedToBullish; bool isHSwitchedToBearish; bool isHStrongSwitchedToBullish; bool isHStrongSwitchedToBearish; // void Clean() { // Clean(cLE1); Clean(cLE2); Clean(cSE1); Clean(cSE2); Clean(sLE1); Clean(sLE2); Clean(sSE1); Clean(sSE2); Clean(mLE1); Clean(mLE2); Clean(mSE1); Clean(mSE2); Clean(lLE1); Clean(lLE2); Clean(lSE1); Clean(lSE2); Clean(hLE1); Clean(hLE2); Clean(hSE1); Clean(hSE2); // ArraySetAsSeries(cLE1, true); ArraySetAsSeries(cLE2, true); ArraySetAsSeries(cSE1, true); ArraySetAsSeries(cSE2, true); ArraySetAsSeries(sLE1, true); ArraySetAsSeries(sLE2, true); ArraySetAsSeries(sSE1, true); ArraySetAsSeries(sSE2, true); ArraySetAsSeries(mLE1, true); ArraySetAsSeries(mLE2, true); ArraySetAsSeries(mSE1, true); ArraySetAsSeries(mSE2, true); ArraySetAsSeries(lLE1, true); ArraySetAsSeries(lLE2, true); ArraySetAsSeries(lSE1, true); ArraySetAsSeries(lSE2, true); ArraySetAsSeries(hLE1, true); ArraySetAsSeries(hLE2, true); ArraySetAsSeries(hSE1, true); ArraySetAsSeries(hSE2, true); // // Conditions ... // // Power ... hasBullishPower = false; hasBearishPower = false; isBullishPowerUp = false; isBearishPowerUp = false; isBullishPowerIncreasing = false; isBullishPowerDecreasing = false; isBearishPowerIncreasing = false; isBearishPowerDecreasing = false; // // Current ... isCBullish = false; isCBearish = false; isCStrongBullish = false; isCStrongBearish = false; isCSwitchedToBullish = false; isCSwitchedToBearish = false; isCStrongSwitchedToBullish = false; isCStrongSwitchedToBearish = false; // // Short ... isSBullish = false; isSBearish = false; isSStrongBullish = false; isSStrongBearish = false; isSSwitchedToBullish = false; isSSwitchedToBearish = false; isSStrongSwitchedToBullish = false; isSStrongSwitchedToBearish = false; // // Medium ... isMBullish = false; isMBearish = false; isMStrongBullish = false; isMStrongBearish = false; isMSwitchedToBullish = false; isMSwitchedToBearish = false; isMStrongSwitchedToBullish = false; isMStrongSwitchedToBearish = false; // // Long ... isLBullish = false; isLBearish = false; isLStrongBullish = false; isLStrongBearish = false; isLSwitchedToBullish = false; isLSwitchedToBearish = false; isLStrongSwitchedToBullish = false; isLStrongSwitchedToBearish = false; // // Hind ... isHBullish = false; isHBearish = false; isHStrongBullish = false; isHStrongBearish = false; isHSwitchedToBullish = false; isHSwitchedToBearish = false; isHStrongSwitchedToBullish = false; isHStrongSwitchedToBearish = false; } // void GenerateScore( double &bullishScore, double &bearishScore // ) { // bullishScore = 0; bearishScore = 0; // // Since We have to Use this // Only for Filtering Signals ... // We Can Ignore Scoring ... // or Complete this later ... // // Conditions ... // // Power ... if (hasBullishPower) { bullishScore++; } if (hasBearishPower) { bearishScore++; } if (isBullishPowerUp) { bullishScore++; } if (isBearishPowerUp) { bearishScore++; } if (isBullishPowerIncreasing) { bullishScore++; } if (isBullishPowerDecreasing) { bearishScore++; } if (isBearishPowerIncreasing) { bearishScore++; } if (isBearishPowerDecreasing) { bullishScore++; } // // Current ... // if (isCBullish) { bullishScore++; } if (isCStrongBullish) { bullishScore++; } if (isCSwitchedToBullish) { bullishScore++; } if (isCStrongSwitchedToBullish) { bullishScore++; } // if (isCBearish) { bearishScore++; } if (isCStrongBearish) { bearishScore++; } if (isCSwitchedToBearish) { bearishScore++; } if (isCStrongSwitchedToBearish) { bearishScore++; } // // Short ... // if (isSBullish) { bullishScore++; } if (isSStrongBullish) { bullishScore++; } if (isSSwitchedToBullish) { bullishScore++; } if (isSStrongSwitchedToBullish) { bullishScore++; } // if (isSBearish) { bearishScore++; } if (isSStrongBearish) { bearishScore++; } if (isSSwitchedToBearish) { bearishScore++; } if (isSStrongSwitchedToBearish) { bearishScore++; } // // Medium ... // if (isMBullish) { bullishScore++; } if (isMStrongBullish) { bullishScore++; } if (isMSwitchedToBullish) { bullishScore++; } if (isMStrongSwitchedToBullish) { bullishScore++; } // if (isMBearish) { bearishScore++; } if (isMStrongBearish) { bearishScore++; } if (isMSwitchedToBearish) { bearishScore++; } if (isMStrongSwitchedToBearish) { bearishScore++; } // // Long ... // if (isLBullish) { bullishScore++; } if (isLStrongBullish) { bullishScore++; } if (isLSwitchedToBullish) { bullishScore++; } if (isLStrongSwitchedToBullish) { bullishScore++; } // if (isLBearish) { bearishScore++; } if (isLStrongBearish) { bearishScore++; } if (isLSwitchedToBearish) { bearishScore++; } if (isLStrongSwitchedToBearish) { bearishScore++; } // // Hind ... // if (isHBullish) { bullishScore++; } if (isHStrongBullish) { bullishScore++; } if (isHSwitchedToBullish) { bullishScore++; } if (isHStrongSwitchedToBullish) { bullishScore++; } // if (isHBearish) { bearishScore++; } if (isHStrongBearish) { bearishScore++; } if (isHSwitchedToBearish) { bearishScore++; } if (isHStrongSwitchedToBearish) { bearishScore++; } } // string GenerateSummary( bool onlyCommons = false, bool onlyConditions = false, bool includeScores = true, bool ignoreFalseConditions = true, string separator = "\n" // ) { // string result = NULL; // double bullishScore = 0; double bearishScore = 0; GenerateScore( bullishScore, bearishScore // ); // string scoresStr = // "Scores: " + separator + "---------------" + separator + "Bullish: " + ToString(bullishScore) + separator + "Bearish: " + ToString(bearishScore) + separator + "" // ; // string commonStr = GenerateSpecifiedCommonSummary( this, separator, includeScores // ); // string conditionsStr = // // Power ... ToString("hasBullishPower", hasBullishPower, ignoreFalseConditions, separator) + ToString("hasBearishPower", hasBearishPower, ignoreFalseConditions, separator) + ToString("isBullishPowerUp", isBullishPowerUp, ignoreFalseConditions, separator) + ToString("isBearishPowerUp", isBearishPowerUp, ignoreFalseConditions, separator) + ToString("isBullishPowerIncreasing", isBullishPowerIncreasing, ignoreFalseConditions, separator) + ToString("isBullishPowerDecreasing", isBullishPowerDecreasing, ignoreFalseConditions, separator) + ToString("isBearishPowerIncreasing", isBearishPowerIncreasing, ignoreFalseConditions, separator) + ToString("isBearishPowerDecreasing", isBearishPowerDecreasing, ignoreFalseConditions, separator) + // // Current ... ToString("isCBullish", isCBullish, ignoreFalseConditions, separator) + ToString("isCBearish", isCBearish, ignoreFalseConditions, separator) + ToString("isCStrongBullish", isCStrongBullish, ignoreFalseConditions, separator) + ToString("isCStrongBearish", isCStrongBearish, ignoreFalseConditions, separator) + ToString("isCSwitchedToBullish", isCSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isCSwitchedToBearish", isCSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isCStrongSwitchedToBullish", isCStrongSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isCStrongSwitchedToBearish", isCStrongSwitchedToBearish, ignoreFalseConditions, separator) + // // Short ... ToString("isSBullish", isSBullish, ignoreFalseConditions, separator) + ToString("isSBearish", isSBearish, ignoreFalseConditions, separator) + ToString("isSStrongBullish", isSStrongBullish, ignoreFalseConditions, separator) + ToString("isSStrongBearish", isSStrongBearish, ignoreFalseConditions, separator) + ToString("isSSwitchedToBullish", isSSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isSSwitchedToBearish", isSSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isSStrongSwitchedToBullish", isSStrongSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isSStrongSwitchedToBearish", isSStrongSwitchedToBearish, ignoreFalseConditions, separator) + // // Medium ... ToString("isMBullish", isMBullish, ignoreFalseConditions, separator) + ToString("isMBearish", isMBearish, ignoreFalseConditions, separator) + ToString("isMStrongBullish", isMStrongBullish, ignoreFalseConditions, separator) + ToString("isMStrongBearish", isMStrongBearish, ignoreFalseConditions, separator) + ToString("isMSwitchedToBullish", isMSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isMSwitchedToBearish", isMSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isMStrongSwitchedToBullish", isMStrongSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isMStrongSwitchedToBearish", isMStrongSwitchedToBearish, ignoreFalseConditions, separator) + // // Long ... ToString("isLBullish", isLBullish, ignoreFalseConditions, separator) + ToString("isLBearish", isLBearish, ignoreFalseConditions, separator) + ToString("isLStrongBullish", isLStrongBullish, ignoreFalseConditions, separator) + ToString("isLStrongBearish", isLStrongBearish, ignoreFalseConditions, separator) + ToString("isLSwitchedToBullish", isLSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isLSwitchedToBearish", isLSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isLStrongSwitchedToBullish", isLStrongSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isLStrongSwitchedToBearish", isLStrongSwitchedToBearish, ignoreFalseConditions, separator) + // // Hind ... ToString("isHBullish", isHBullish, ignoreFalseConditions, separator) + ToString("isHBearish", isHBearish, ignoreFalseConditions, separator) + ToString("isHStrongBullish", isHStrongBullish, ignoreFalseConditions, separator) + ToString("isHStrongBearish", isHStrongBearish, ignoreFalseConditions, separator) + ToString("isHSwitchedToBullish", isHSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isHSwitchedToBearish", isHSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isHStrongSwitchedToBullish", isHStrongSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isHStrongSwitchedToBearish", isHStrongSwitchedToBearish, ignoreFalseConditions, separator) + // "" // ; // result = // "[" + GetTag() + "]" + separator + (onlyConditions ? "" : commonStr) + (!includeScores ? "" : scoresStr) + " " + separator + (onlyCommons ? "" : conditionsStr) + "" // ; // return result; } // string GetTag() { return "XCHCHE"; } }; // // Class ... class XSCXCHCHEHelper : public XSCBaseHelper { // // Public ... public: // // Props ... // // Constructors ... XSCXCHCHEHelper() : XSCBaseHelper(_Symbol, _Period) { } // // Deconstructor ... ~XSCXCHCHEHelper() { // Clean(cLE1Buffer); Clean(cLE2Buffer); Clean(cSE1Buffer); Clean(cSE2Buffer); Clean(sLE1Buffer); Clean(sLE2Buffer); Clean(sSE1Buffer); Clean(sSE2Buffer); Clean(mLE1Buffer); Clean(mLE2Buffer); Clean(mSE1Buffer); Clean(mSE2Buffer); Clean(lLE1Buffer); Clean(lLE2Buffer); Clean(lSE1Buffer); Clean(lSE2Buffer); Clean(hLE1Buffer); Clean(hLE2Buffer); Clean(hSE1Buffer); Clean(hSE2Buffer); } // // Tools ... bool Init( string symbol, // Trading Symbol ENUM_TIMEFRAMES period, // Trading Period XCHCHEInputs &inputs // Inputs ) { // bool result = false; // mSymbol = symbol; mPeriod = period; // result = inputs.IsValid(); if (!result) { return result; } // mInputs = inputs; // ArraySetAsSeries(cLE1Buffer, true); ArraySetAsSeries(cLE2Buffer, true); ArraySetAsSeries(cSE1Buffer, true); ArraySetAsSeries(cSE2Buffer, true); ArraySetAsSeries(sLE1Buffer, true); ArraySetAsSeries(sLE2Buffer, true); ArraySetAsSeries(sSE1Buffer, true); ArraySetAsSeries(sSE2Buffer, true); ArraySetAsSeries(mLE1Buffer, true); ArraySetAsSeries(mLE2Buffer, true); ArraySetAsSeries(mSE1Buffer, true); ArraySetAsSeries(mSE2Buffer, true); ArraySetAsSeries(lLE1Buffer, true); ArraySetAsSeries(lLE2Buffer, true); ArraySetAsSeries(lSE1Buffer, true); ArraySetAsSeries(lSE2Buffer, true); ArraySetAsSeries(hLE1Buffer, true); ArraySetAsSeries(hLE2Buffer, true); ArraySetAsSeries(hSE1Buffer, true); ArraySetAsSeries(hSE2Buffer, true); // mHandler = iCustom( mSymbol, mPeriod, "x-saherelm.xchche", // // Inputs ... // // Market ... "", mInputs.length, mInputs.loopback, mInputs.multiplier1, mInputs.multiplier2, // // Calculations ... "", mInputs.upAppliedTo, mInputs.downAppliedTo, // // Cycles ... "", // // Short ... "", mInputs.scMethod, mInputs.scPeriod, // // Medium ... "", mInputs.mcMethod, mInputs.mcPeriod, // // Long ... "", mInputs.lcMethod, mInputs.lcPeriod, // // Hind ... "", mInputs.hcMethod, mInputs.hcPeriod, // // Presentation ... "", // mInputs.showLE1, mInputs.showLE2, mInputs.showSE1, mInputs.showSE2, // mInputs.showCurrent, mInputs.showShort, mInputs.showMedium, mInputs.showLong, mInputs.showHind // ); result = mHandler != INVALID_HANDLE; if (!result) { return result; } // return result; } // // Inputs ... // XCHCHEInputs GetInputs() { return mInputs; } // bool SetInputs( XCHCHEInputs &inputs // Configs ) { // return Init( mSymbol, mPeriod, inputs // ); } // // Buffers ... // // Current ... // double GetCLE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(cLE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return cLE1Buffer[barIndex]; } // // Copy Required Items ... int CopyCLE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, cLE1Buffer, buffer, forceClean // ); } // double GetCLE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(cLE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return cLE2Buffer[barIndex]; } // // Copy Required Items ... int CopyCLE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, cLE2Buffer, buffer, forceClean // ); } // double GetCSE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(cSE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return cSE1Buffer[barIndex]; } // // Copy Required Items ... int CopyCSE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, cSE1Buffer, buffer, forceClean // ); } // double GetCSE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(cSE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return cSE2Buffer[barIndex]; } // // Copy Required Items ... int CopyCSE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, cSE2Buffer, buffer, forceClean // ); } // // Short ... // double GetSLE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(sLE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return sLE1Buffer[barIndex]; } // // Copy Required Items ... int CopySLE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, sLE1Buffer, buffer, forceClean // ); } // double GetSLE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(sLE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return sLE2Buffer[barIndex]; } // // Copy Required Items ... int CopySLE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, sLE2Buffer, buffer, forceClean // ); } // double GetSSE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(sSE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return sSE1Buffer[barIndex]; } // // Copy Required Items ... int CopySSE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, sSE1Buffer, buffer, forceClean // ); } // double GetSSE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(sSE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return sSE2Buffer[barIndex]; } // // Copy Required Items ... int CopySSE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, sSE2Buffer, buffer, forceClean // ); } // // Medium ... // double GetMLE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(mLE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return mLE1Buffer[barIndex]; } // // Copy Required Items ... int CopyMLE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, mLE1Buffer, buffer, forceClean // ); } // double GetMLE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(mLE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return mLE2Buffer[barIndex]; } // // Copy Required Items ... int CopyMLE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, mLE2Buffer, buffer, forceClean // ); } // double GetMSE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(mSE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return mSE1Buffer[barIndex]; } // // Copy Required Items ... int CopyMSE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, mSE1Buffer, buffer, forceClean // ); } // double GetMSE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(mSE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return mSE2Buffer[barIndex]; } // // Copy Required Items ... int CopyMSE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, mSE2Buffer, buffer, forceClean // ); } // // Long ... // double GetLLE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(lLE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return lLE1Buffer[barIndex]; } // // Copy Required Items ... int CopyLLE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, lLE1Buffer, buffer, forceClean // ); } // double GetLLE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(lLE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return lLE2Buffer[barIndex]; } // // Copy Required Items ... int CopyLLE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, lLE2Buffer, buffer, forceClean // ); } // double GetLSE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(lSE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return lSE1Buffer[barIndex]; } // // Copy Required Items ... int CopyLSE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, lSE1Buffer, buffer, forceClean // ); } // double GetLSE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(lSE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return lSE2Buffer[barIndex]; } // // Copy Required Items ... int CopyLSE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, lSE2Buffer, buffer, forceClean // ); } // // Hind ... // double GetHLE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(hLE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return hLE1Buffer[barIndex]; } // // Copy Required Items ... int CopyHLE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, hLE1Buffer, buffer, forceClean // ); } // double GetHLE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(hLE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return hLE2Buffer[barIndex]; } // // Copy Required Items ... int CopyHLE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, hLE2Buffer, buffer, forceClean // ); } // double GetHSE1( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(hSE1Buffer); if (barIndex >= count) { barIndex = count - 1; } // return hSE1Buffer[barIndex]; } // // Copy Required Items ... int CopyHSE1( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, hSE1Buffer, buffer, forceClean // ); } // double GetHSE2( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(); // int count = ArraySize(hSE2Buffer); if (barIndex >= count) { barIndex = count - 1; } // return hSE2Buffer[barIndex]; } // // Copy Required Items ... int CopyHSE2( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(); // // Copy Items ... return Copy( start, count, hSE2Buffer, buffer, forceClean // ); } // // Tools ... // bool IsCycleBullish( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // ) { // bool result = false; // double le1 = 0; // switch (cycle) { // // CURRENT ... case X_MARKET_CYCLE_UNKNOWN: le1 = GetCLE1(barIndex); break; // // SHORT ... case X_MARKET_CYCLE_SHORT: le1 = GetSLE1(barIndex); break; // // MEDIUM ... case X_MARKET_CYCLE_MEDIUM: le1 = GetMLE1(barIndex); break; // // LONG ... case X_MARKET_CYCLE_LONG: le1 = GetLLE1(barIndex); break; // // HIND ... case X_MARKET_CYCLE_HIND: le1 = GetHLE1(barIndex); break; } // result = le1 != EMPTY_VALUE && le1 > 0; // return result; } // bool IsCycleStrongBullish( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // ) { // bool result = false; // double le1 = 0; double le2 = 0; // switch (cycle) { // // CURRENT ... case X_MARKET_CYCLE_UNKNOWN: le1 = GetCLE1(barIndex); le2 = GetCLE2(barIndex); break; // // SHORT ... case X_MARKET_CYCLE_SHORT: le1 = GetSLE1(barIndex); le2 = GetSLE2(barIndex); break; // // MEDIUM ... case X_MARKET_CYCLE_MEDIUM: le1 = GetMLE1(barIndex); le2 = GetMLE2(barIndex); break; // // LONG ... case X_MARKET_CYCLE_LONG: le1 = GetLLE1(barIndex); le2 = GetLLE2(barIndex); break; // // HIND ... case X_MARKET_CYCLE_HIND: le1 = GetHLE1(barIndex); le2 = GetHLE2(barIndex); break; } // result = le1 != EMPTY_VALUE && le1 > 0 && le2 != EMPTY_VALUE && le2 > 0; // return result; } // bool IsCycleBearish( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // ) { // bool result = false; // double se1 = 0; // switch (cycle) { // // CURRENT ... case X_MARKET_CYCLE_UNKNOWN: se1 = GetCSE1(barIndex); break; // // SHORT ... case X_MARKET_CYCLE_SHORT: se1 = GetSSE1(barIndex); break; // // MEDIUM ... case X_MARKET_CYCLE_MEDIUM: se1 = GetMSE1(barIndex); break; // // LONG ... case X_MARKET_CYCLE_LONG: se1 = GetLSE1(barIndex); break; // // HIND ... case X_MARKET_CYCLE_HIND: se1 = GetHSE1(barIndex); break; } // result = se1 != EMPTY_VALUE && se1 > 0; // return result; } // bool IsCycleStrongBearish( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // ) { // bool result = false; // double se1 = 0; double se2 = 0; // switch (cycle) { // // CURRENT ... case X_MARKET_CYCLE_UNKNOWN: se1 = GetCSE1(barIndex); se2 = GetCSE2(barIndex); break; // // SHORT ... case X_MARKET_CYCLE_SHORT: se1 = GetSSE1(barIndex); se2 = GetSSE2(barIndex); break; // // MEDIUM ... case X_MARKET_CYCLE_MEDIUM: se1 = GetMSE1(barIndex); se2 = GetMSE2(barIndex); break; // // LONG ... case X_MARKET_CYCLE_LONG: se1 = GetLSE1(barIndex); se2 = GetLSE2(barIndex); break; // // HIND ... case X_MARKET_CYCLE_HIND: se1 = GetHSE1(barIndex); se2 = GetHSE2(barIndex); break; } // result = se1 != EMPTY_VALUE && se1 > 0 && se2 != EMPTY_VALUE && se2 > 0; // return result; } // int GetCycleValues( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle, double &values[] // ) { // int result = 0; // Clean(values); // double le1 = 0; double le2 = 0; double se1 = 0; double se2 = 0; // switch (cycle) { // // CURRENT ... case X_MARKET_CYCLE_UNKNOWN: // le1 = GetCLE1(barIndex); le2 = GetCLE2(barIndex); se1 = GetCSE1(barIndex); se2 = GetCSE2(barIndex); break; // // SHORT ... case X_MARKET_CYCLE_SHORT: // le1 = GetSLE1(barIndex); le2 = GetSLE2(barIndex); se1 = GetSSE1(barIndex); se2 = GetSSE2(barIndex); break; // // MEDIUM ... case X_MARKET_CYCLE_MEDIUM: // le1 = GetMLE1(barIndex); le2 = GetMLE2(barIndex); se1 = GetMSE1(barIndex); se2 = GetMSE2(barIndex); break; // // LONG ... case X_MARKET_CYCLE_LONG: // le1 = GetLLE1(barIndex); le2 = GetLLE2(barIndex); se1 = GetLSE1(barIndex); se2 = GetLSE2(barIndex); break; // // HIND ... case X_MARKET_CYCLE_HIND: // le1 = GetHLE1(barIndex); le2 = GetHLE2(barIndex); se1 = GetHSE1(barIndex); se2 = GetHSE2(barIndex); break; } // if (le1 > 0 && le1 != EMPTY_VALUE) { // Add( le1, values // ); } // if (le2 > 0 && le2 != EMPTY_VALUE) { // Add( le2, values // ); } // if (se1 > 0 && se1 != EMPTY_VALUE) { // Add( se1, values // ); } // if (se2 > 0 && se2 != EMPTY_VALUE) { // Add( se2, values // ); } // result = ArraySize(values); // return result; } // int GetCycleBullishValues( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle, double &values[] // ) { // int result = 0; // Clean(values); // double le1 = 0; double le2 = 0; // switch (cycle) { // // CURRENT ... case X_MARKET_CYCLE_UNKNOWN: // le1 = GetCLE1(barIndex); le2 = GetCLE2(barIndex); break; // // SHORT ... case X_MARKET_CYCLE_SHORT: // le1 = GetSLE1(barIndex); le2 = GetSLE2(barIndex); break; // // MEDIUM ... case X_MARKET_CYCLE_MEDIUM: // le1 = GetMLE1(barIndex); le2 = GetMLE2(barIndex); break; // // LONG ... case X_MARKET_CYCLE_LONG: // le1 = GetLLE1(barIndex); le2 = GetLLE2(barIndex); break; // // HIND ... case X_MARKET_CYCLE_HIND: // le1 = GetHLE1(barIndex); le2 = GetHLE2(barIndex); break; } // if (le1 > 0 && le1 != EMPTY_VALUE) { // Add( le1, values // ); } // if (le2 > 0 && le2 != EMPTY_VALUE) { // Add( le2, values // ); } // result = ArraySize(values); // return result; } // int GetCycleBearishValues( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle, double &values[] // ) { // int result = 0; // Clean(values); // double se1 = 0; double se2 = 0; // switch (cycle) { // // CURRENT ... case X_MARKET_CYCLE_UNKNOWN: // se1 = GetCSE1(barIndex); se2 = GetCSE2(barIndex); break; // // SHORT ... case X_MARKET_CYCLE_SHORT: // se1 = GetSSE1(barIndex); se2 = GetSSE2(barIndex); break; // // MEDIUM ... case X_MARKET_CYCLE_MEDIUM: // se1 = GetMSE1(barIndex); se2 = GetMSE2(barIndex); break; // // LONG ... case X_MARKET_CYCLE_LONG: // se1 = GetLSE1(barIndex); se2 = GetLSE2(barIndex); break; // // HIND ... case X_MARKET_CYCLE_HIND: // se1 = GetHSE1(barIndex); se2 = GetHSE2(barIndex); break; } // if (se1 > 0 && se1 != EMPTY_VALUE) { // Add( se1, values // ); } // if (se2 > 0 && se2 != EMPTY_VALUE) { // Add( se2, values // ); } // result = ArraySize(values); // return result; } // double GetCycleMax( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // ) { // double result = 0; // double values[]; int valuesCount = GetCycleValues( barIndex, cycle, values // ); if (!IsValidSize(valuesCount)) { return result; } // result = GetSpecifiedMax(values); // return result; } // double GetCycleMin( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // ) { // double result = 0; // double values[]; int valuesCount = GetCycleValues( barIndex, cycle, values // ); if (!IsValidSize(valuesCount)) { return result; } // result = GetSpecifiedMin(values); // return result; } // double GetCyclePower( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // ) { // double result = 0; // double values[]; int count = GetCycleValues( barIndex, cycle, values // ); // double max = GetSpecifiedMax(values); double min = GetSpecifiedMin(values); // result = MathAbs(max - min); // return result; } // int GetBullishCycles( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[] // Result ) { // int result = 0; // Clean(cycles); // ENUM_X_MARKET_CYCLES allCycles[]; int allCyclesCount = GetAllMarketCycles(allCycles); if (!IsValidSize(allCyclesCount)) { return result; } // for (int i = 0; i < allCyclesCount; i++) { // bool isBullish = IsCycleBullish( barIndex, allCycles[i] // ); if (isBullish) { // Add( allCycles[i], cycles // ); } } // result = ArraySize(cycles); // return result; } // int GetStrongBullishCycles( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[] // Result ) { // int result = 0; // Clean(cycles); // ENUM_X_MARKET_CYCLES allCycles[]; int allCyclesCount = GetAllMarketCycles(allCycles); if (!IsValidSize(allCyclesCount)) { return result; } // for (int i = 0; i < allCyclesCount; i++) { // bool isBullish = IsCycleStrongBullish( barIndex, allCycles[i] // ); if (isBullish) { // Add( allCycles[i], cycles // ); } } // result = ArraySize(cycles); // return result; } // int GetBearishCycles( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[] // Result ) { // int result = 0; // Clean(cycles); // ENUM_X_MARKET_CYCLES allCycles[]; int allCyclesCount = GetAllMarketCycles(allCycles); if (!IsValidSize(allCyclesCount)) { return result; } // for (int i = 0; i < allCyclesCount; i++) { // bool isBearish = IsCycleBearish( barIndex, allCycles[i] // ); if (isBearish) { // Add( allCycles[i], cycles // ); } } // result = ArraySize(cycles); // return result; } // int GetStrongBearishCycles( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[] // Result ) { // int result = 0; // Clean(cycles); // ENUM_X_MARKET_CYCLES allCycles[]; int allCyclesCount = GetAllMarketCycles(allCycles); if (!IsValidSize(allCyclesCount)) { return result; } // for (int i = 0; i < allCyclesCount; i++) { // bool isBearish = IsCycleStrongBearish( barIndex, allCycles[i] // ); if (isBearish) { // Add( allCycles[i], cycles // ); } } // result = ArraySize(cycles); // return result; } // double GetMax( int barIndex // Bar Index ) { // double result = 0; // double values[]; // ENUM_X_MARKET_CYCLES cycles[]; int count = GetAllMarketCycles(cycles); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // double iValues[]; int iValuesCount = GetCycleValues( barIndex, cycles[i], iValues // ); if (IsValidSize(iValuesCount)) { // Copy( iValues, values, false // ); } } // result = GetSpecifiedMax(values); // return result; } // double GetMin( int barIndex // Bar Index ) { // double result = 0; // double values[]; // ENUM_X_MARKET_CYCLES cycles[]; int count = GetAllMarketCycles(cycles); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // double iValues[]; int iValuesCount = GetCycleValues( barIndex, cycles[i], iValues // ); if (IsValidSize(iValuesCount)) { // Copy( iValues, values, false // ); } } // result = GetSpecifiedMin(values); // return result; } // double GetBullishMax( int barIndex // Bar Index ) { // double result = 0; // double values[]; // ENUM_X_MARKET_CYCLES cycles[]; int count = GetBullishCycles( barIndex, cycles // ); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // double iValues[]; int iValuesCount = GetCycleValues( barIndex, cycles[i], iValues // ); if (IsValidSize(iValuesCount)) { // Copy( iValues, values, false // ); } } // result = GetSpecifiedMax(values); // return result; } // double GetBullishMin( int barIndex // Bar Index ) { // double result = 0; // double values[]; // ENUM_X_MARKET_CYCLES cycles[]; int count = GetBullishCycles( barIndex, cycles // ); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // double iValues[]; int iValuesCount = GetCycleValues( barIndex, cycles[i], iValues // ); if (IsValidSize(iValuesCount)) { // Copy( iValues, values, false // ); } } // result = GetSpecifiedMin(values); // return result; } // double GetBearishMax( int barIndex // Bar Index ) { // double result = 0; // double values[]; // ENUM_X_MARKET_CYCLES cycles[]; int count = GetBearishCycles( barIndex, cycles // ); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // double iValues[]; int iValuesCount = GetCycleValues( barIndex, cycles[i], iValues // ); if (IsValidSize(iValuesCount)) { // Copy( iValues, values, false // ); } } // result = GetSpecifiedMax(values); // return result; } // double GetBearishMin( int barIndex // Bar Index ) { // double result = 0; // double values[]; // ENUM_X_MARKET_CYCLES cycles[]; int count = GetBearishCycles( barIndex, cycles // ); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // double iValues[]; int iValuesCount = GetCycleValues( barIndex, cycles[i], iValues // ); if (IsValidSize(iValuesCount)) { // Copy( iValues, values, false // ); } } // result = GetSpecifiedMin(values); // return result; } // double GetCycleBullishMax( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // Cycle ) { // double result = 0; // bool isBullish = IsCycleBullish( barIndex, cycle // ); if (!isBullish) { return result; } // double values[]; int count = GetCycleBullishValues( barIndex, cycle, values // ); // result = GetSpecifiedMax(values); // return result; } // double GetCycleBullishMin( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // Cycle ) { // double result = 0; // bool isBullish = IsCycleBullish( barIndex, cycle // ); if (!isBullish) { return result; } // double values[]; int count = GetCycleBullishValues( barIndex, cycle, values // ); // result = GetSpecifiedMin(values); // return result; } // double GetCycleBearishMax( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // Cycle ) { // double result = 0; // bool isBearish = IsCycleBearish( barIndex, cycle // ); if (!isBearish) { return result; } // double values[]; int count = GetCycleBearishValues( barIndex, cycle, values // ); // result = GetSpecifiedMax(values); // return result; } // double GetCycleBearishMin( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES cycle // Cycle ) { // double result = 0; // bool isBearish = IsCycleBearish( barIndex, cycle // ); if (!isBearish) { return result; } // double values[]; int count = GetCycleBearishValues( barIndex, cycle, values // ); // result = GetSpecifiedMin(values); // return result; } // double GetBullishPower( int barIndex // Bar Index ) { // double result = 0; // ENUM_X_MARKET_CYCLES cycles[]; int count = GetBullishCycles( barIndex, cycles // ); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // result += GetCyclePower( barIndex, cycles[i] // ); } // return result; } // double GetBearishPower( int barIndex // Bar Index ) { // double result = 0; // ENUM_X_MARKET_CYCLES cycles[]; int count = GetBearishCycles( barIndex, cycles // ); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // result += GetCyclePower( barIndex, cycles[i] // ); } // return result; } // double GetCyclesBullishPower( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[] // ) { // double result = 0; // int count = ArraySize(cycles); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // bool isBullish = IsCycleBullish( barIndex, cycles[i] // ); // if (isBullish) { // result += GetCyclePower( barIndex, cycles[i] // ); } } // return result; } // double GetCyclesBearishPower( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[] // ) { // double result = 0; // int count = ArraySize(cycles); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // bool isBearish = IsCycleBearish( barIndex, cycles[i] // ); // if (isBearish) { // result += GetCyclePower( barIndex, cycles[i] // ); } } // return result; } // bool HasBullishPower( int barIndex // Bar Index ) { // bool result = false; // double bullishPower = GetBullishPower(barIndex); double bearishPower = GetBearishPower(barIndex); // result = // bearishPower >= 0 && bullishPower > bearishPower // ; // return result; } // bool HasBearishPower( int barIndex // Bar Index ) { // bool result = false; // double bullishPower = GetBullishPower(barIndex); double bearishPower = GetBearishPower(barIndex); // result = // bullishPower >= 0 && bearishPower > bullishPower // ; // return result; } // bool HasCyclesBullishPower( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[] // ) { // bool result = false; // double bullishPower = GetCyclesBullishPower(barIndex, cycles); double bearishPower = GetCyclesBearishPower(barIndex, cycles); // result = // bearishPower >= 0 && bullishPower > bearishPower // ; // return result; } // bool HasCyclesBearishPower( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[] // ) { // bool result = false; // double bullishPower = GetCyclesBullishPower(barIndex, cycles); double bearishPower = GetCyclesBearishPower(barIndex, cycles); // result = // bullishPower >= 0 && bearishPower > bullishPower // ; // return result; } // // Check Bullish Power Increasing ... bool IsBullishPowerIncreasing( int barIndex, // Bar Index int loopback = 5 // Loopback ) { // bool result = false; // if (loopback <= 0) { loopback = 5; } // double firstPower = GetBullishPower(barIndex); double lastPower = firstPower; for (int i = barIndex + 1; i < barIndex + loopback; i++) { // double iPower = GetBullishPower(i); // result = // iPower > 0 && firstPower > 0 && lastPower > iPower // ; if (!result) { break; } // lastPower = iPower; } // if (result) { // result = // firstPower > lastPower // ; } // return result; } // // Check Bullish Power Decreasing ... bool IsBullishPowerDecreasing( int barIndex, // Bar Index int loopback = 5 // Loopback ) { // bool result = false; // if (loopback <= 0) { loopback = 5; } // double firstPower = GetBullishPower(barIndex); double lastPower = firstPower; for (int i = barIndex + 1; i < barIndex + loopback; i++) { // double iPower = GetBullishPower(i); // result = // iPower > 0 && firstPower > 0 && lastPower < iPower // ; if (!result) { break; } // lastPower = iPower; } // if (result) { // result = // firstPower < lastPower // ; } // return result; } // // Check Bearish Power Increasing ... bool IsBearishPowerIncreasing( int barIndex, // Bar Index int loopback = 5 // Loopback ) { // bool result = false; // if (loopback <= 0) { loopback = 5; } // double firstPower = GetBearishPower(barIndex); double lastPower = firstPower; for (int i = barIndex + 1; i < barIndex + loopback; i++) { // double iPower = GetBearishPower(i); // result = // iPower > 0 && firstPower > 0 && lastPower > iPower // ; if (!result) { break; } // lastPower = iPower; } // if (result) { // result = // firstPower > lastPower // ; } // return result; } // // Check Bearish Power Decreasing ... bool IsBearishPowerDecreasing( int barIndex, // Bar Index int loopback = 5 // Loopback ) { // bool result = false; // if (loopback <= 0) { loopback = 5; } // double firstPower = GetBearishPower(barIndex); double lastPower = firstPower; for (int i = barIndex + 1; i < barIndex + loopback; i++) { // double iPower = GetBearishPower(i); // result = // iPower > 0 && firstPower > 0 && lastPower < iPower // ; if (!result) { break; } // lastPower = iPower; } // if (result) { // result = // firstPower < lastPower // ; } // return result; } // // Check Bullish Power Increasing ... bool IsCyclesBullishPowerIncreasing( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[], // int loopback = 5 // Loopback ) { // bool result = false; // if (loopback <= 0) { loopback = 5; } // double firstPower = GetCyclesBullishPower(barIndex, cycles); double lastPower = firstPower; for (int i = barIndex + 1; i < barIndex + loopback; i++) { // double iPower = GetCyclesBullishPower(i, cycles); // result = // iPower > 0 && firstPower > 0 && lastPower > iPower // ; if (!result) { break; } // lastPower = iPower; } // if (result) { // result = // firstPower > lastPower // ; } // return result; } // // Check Bullish Power Decreasing ... bool IsCyclesBullishPowerDecreasing( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[], // int loopback = 5 // Loopback ) { // bool result = false; // if (loopback <= 0) { loopback = 5; } // double firstPower = GetCyclesBullishPower(barIndex, cycles); double lastPower = firstPower; for (int i = barIndex + 1; i < barIndex + loopback; i++) { // double iPower = GetCyclesBullishPower(i, cycles); // result = // iPower > 0 && firstPower > 0 && lastPower < iPower // ; if (!result) { break; } // lastPower = iPower; } // if (result) { // result = // firstPower < lastPower // ; } // return result; } // // Check Bearish Power Increasing ... bool IsCyclesBearishPowerIncreasing( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[], // int loopback = 5 // Loopback ) { // bool result = false; // if (loopback <= 0) { loopback = 5; } // double firstPower = GetCyclesBearishPower(barIndex, cycles); double lastPower = firstPower; for (int i = barIndex + 1; i < barIndex + loopback; i++) { // double iPower = GetCyclesBearishPower(i, cycles); // result = // iPower > 0 && firstPower > 0 && lastPower > iPower // ; if (!result) { break; } // lastPower = iPower; } // if (result) { // result = // firstPower > lastPower // ; } // return result; } // // Check Bearish Power Decreasing ... bool IsCyclesBearishPowerDecreasing( int barIndex, // Bar Index ENUM_X_MARKET_CYCLES &cycles[], // int loopback = 5 // Loopback ) { // bool result = false; // if (loopback <= 0) { loopback = 5; } // double firstPower = GetCyclesBearishPower(barIndex, cycles); double lastPower = firstPower; for (int i = barIndex + 1; i < barIndex + loopback; i++) { // double iPower = GetCyclesBearishPower(i, cycles); // result = // iPower > 0 && firstPower > 0 && lastPower < iPower // ; if (!result) { break; } // lastPower = iPower; } // if (result) { // result = // firstPower < lastPower // ; } // return result; } // // Conditions ... // bool GetConditions( XCHCHEConditions &conditions, // int barIndex = 0, // int loopback = 5 // ) { // bool result = true; // if (loopback < 5) { loopback = 5; } // conditions.Clean(); // conditions.symbol = mSymbol; conditions.period = mPeriod; conditions.time = TimeCurrent(); // int zIndex = barIndex; int cIndex = zIndex + 1; int pIndex = cIndex + 1; int ppIndex = pIndex + 1; // // Buffers ... // // CURRENT ... // CopyCLE1( zIndex, loopback, conditions.cLE1 // ); // CopyCLE2( zIndex, loopback, conditions.cLE2 // ); // CopyCSE1( zIndex, loopback, conditions.cSE1 // ); // CopyCSE2( zIndex, loopback, conditions.cSE2 // ); // // SHORT ... // CopySLE1( zIndex, loopback, conditions.sLE1 // ); // CopySLE2( zIndex, loopback, conditions.sLE2 // ); // CopySSE1( zIndex, loopback, conditions.sSE1 // ); // CopySSE2( zIndex, loopback, conditions.sSE2 // ); // // MEDIUM ... // CopyMLE1( zIndex, loopback, conditions.mLE1 // ); // CopyMLE2( zIndex, loopback, conditions.mLE2 // ); // CopyMSE1( zIndex, loopback, conditions.mSE1 // ); // CopyMSE2( zIndex, loopback, conditions.mSE2 // ); // // LONG ... // CopyLLE1( zIndex, loopback, conditions.lLE1 // ); // CopyLLE2( zIndex, loopback, conditions.lLE2 // ); // CopyLSE1( zIndex, loopback, conditions.lSE1 // ); // CopyLSE2( zIndex, loopback, conditions.lSE2 // ); // // HIND ... // CopyHLE1( zIndex, loopback, conditions.hLE1 // ); // CopyHLE2( zIndex, loopback, conditions.hLE2 // ); // CopyHSE1( zIndex, loopback, conditions.hSE1 // ); // CopyHSE2( zIndex, loopback, conditions.hSE2 // ); // // Power ... // bool hasBullishPower = HasBullishPower(cIndex); bool hasBullishPowerPrev = HasBullishPower(pIndex); // bool hasBearishPower = HasBearishPower(cIndex); bool hasBearishPowerPrev = HasBearishPower(pIndex); // bool isBullishPowerUp = hasBullishPower && !hasBullishPowerPrev; bool isBearishPowerUp = hasBearishPower && !hasBearishPowerPrev; // bool isBullishPowerIncreasing = IsBullishPowerIncreasing(cIndex); bool isBullishPowerDecreasing = IsBullishPowerDecreasing(cIndex); bool isBearishPowerIncreasing = IsBearishPowerIncreasing(cIndex); bool isBearishPowerDecreasing = IsBearishPowerDecreasing(cIndex); // conditions.hasBullishPower = hasBullishPower; conditions.hasBearishPower = hasBearishPower; conditions.isBullishPowerUp = isBullishPowerUp; conditions.isBearishPowerUp = isBearishPowerUp; conditions.isBullishPowerIncreasing = isBullishPowerIncreasing; conditions.isBullishPowerDecreasing = isBullishPowerDecreasing; conditions.isBearishPowerIncreasing = isBearishPowerIncreasing; conditions.isBearishPowerDecreasing = isBearishPowerDecreasing; // // Current ... // bool isCBullish = NotEmptyZero(conditions.cLE1[cIndex]); bool isCBearish = NotEmptyZero(conditions.cSE1[cIndex]); // bool isCBullishPrev = NotEmptyZero(conditions.cLE1[pIndex]); bool isCBearishPrev = NotEmptyZero(conditions.cSE1[pIndex]); // bool isCStrongBullish = isCBullish && NotEmptyZero(conditions.cLE2[cIndex]); bool isCStrongBearish = isCBearish && NotEmptyZero(conditions.cSE2[cIndex]); // bool isCStrongBullishPrev = isCBullishPrev && NotEmptyZero(conditions.cLE2[pIndex]); bool isCStrongBearishPrev = isCBearishPrev && NotEmptyZero(conditions.cSE2[pIndex]); // bool isCSwitchedToBullish = isCBullish && !isCBullishPrev; bool isCSwitchedToBearish = isCBearish && !isCBearishPrev; // bool isCStrongSwitchedToBullish = isCStrongBullish && !isCStrongBullishPrev; bool isCStrongSwitchedToBearish = isCStrongBearish && !isCStrongBearishPrev; // conditions.isCBullish = isCBullish; conditions.isCBearish = isCBearish; conditions.isCStrongBullish = isCStrongBullish; conditions.isCStrongBearish = isCStrongBearish; conditions.isCSwitchedToBullish = isCSwitchedToBullish; conditions.isCSwitchedToBearish = isCSwitchedToBearish; conditions.isCStrongSwitchedToBullish = isCStrongSwitchedToBullish; conditions.isCStrongSwitchedToBearish = isCStrongSwitchedToBearish; // // Short ... // bool isSBullish = NotEmptyZero(conditions.sLE1[cIndex]); bool isSBearish = NotEmptyZero(conditions.sSE1[cIndex]); // bool isSBullishPrev = NotEmptyZero(conditions.sLE1[pIndex]); bool isSBearishPrev = NotEmptyZero(conditions.sSE1[pIndex]); // bool isSStrongBullish = isSBullish && NotEmptyZero(conditions.sLE2[cIndex]); bool isSStrongBearish = isSBearish && NotEmptyZero(conditions.sSE2[cIndex]); // bool isSStrongBullishPrev = isSBullishPrev && NotEmptyZero(conditions.sLE2[pIndex]); bool isSStrongBearishPrev = isSBearishPrev && NotEmptyZero(conditions.sSE2[pIndex]); // bool isSSwitchedToBullish = isSBullish && !isSBullishPrev; bool isSSwitchedToBearish = isSBearish && !isSBearishPrev; // bool isSStrongSwitchedToBullish = isSStrongBullish && !isSStrongBullishPrev; bool isSStrongSwitchedToBearish = isSStrongBearish && !isSStrongBearishPrev; // conditions.isSBullish = isSBullish; conditions.isSBearish = isSBearish; conditions.isSStrongBullish = isSStrongBullish; conditions.isSStrongBearish = isSStrongBearish; conditions.isSSwitchedToBullish = isSSwitchedToBullish; conditions.isSSwitchedToBearish = isSSwitchedToBearish; conditions.isSStrongSwitchedToBullish = isSStrongSwitchedToBullish; conditions.isSStrongSwitchedToBearish = isSStrongSwitchedToBearish; // // Medium ... // bool isMBullish = NotEmptyZero(conditions.mLE1[cIndex]); bool isMBearish = NotEmptyZero(conditions.mSE1[cIndex]); // bool isMBullishPrev = NotEmptyZero(conditions.mLE1[pIndex]); bool isMBearishPrev = NotEmptyZero(conditions.mSE1[pIndex]); // bool isMStrongBullish = isMBullish && NotEmptyZero(conditions.mLE2[cIndex]); bool isMStrongBearish = isMBearish && NotEmptyZero(conditions.mSE2[cIndex]); // bool isMStrongBullishPrev = isMBullishPrev && NotEmptyZero(conditions.mLE2[pIndex]); bool isMStrongBearishPrev = isMBearishPrev && NotEmptyZero(conditions.mSE2[pIndex]); // bool isMSwitchedToBullish = isMBullish && !isMBullishPrev; bool isMSwitchedToBearish = isMBearish && !isMBearishPrev; // bool isMStrongSwitchedToBullish = isMStrongBullish && !isMStrongBullishPrev; bool isMStrongSwitchedToBearish = isMStrongBearish && !isMStrongBearishPrev; // conditions.isMBullish = isMBullish; conditions.isMBearish = isMBearish; conditions.isMStrongBullish = isMStrongBullish; conditions.isMStrongBearish = isMStrongBearish; conditions.isMSwitchedToBullish = isMSwitchedToBullish; conditions.isMSwitchedToBearish = isMSwitchedToBearish; conditions.isMStrongSwitchedToBullish = isMStrongSwitchedToBullish; conditions.isMStrongSwitchedToBearish = isMStrongSwitchedToBearish; // // Long ... // bool isLBullish = NotEmptyZero(conditions.lLE1[cIndex]); bool isLBearish = NotEmptyZero(conditions.lSE1[cIndex]); // bool isLBullishPrev = NotEmptyZero(conditions.lLE1[pIndex]); bool isLBearishPrev = NotEmptyZero(conditions.lSE1[pIndex]); // bool isLStrongBullish = isLBullish && NotEmptyZero(conditions.lLE2[cIndex]); bool isLStrongBearish = isLBearish && NotEmptyZero(conditions.lSE2[cIndex]); // bool isLStrongBullishPrev = isLBullishPrev && NotEmptyZero(conditions.lLE2[pIndex]); bool isLStrongBearishPrev = isLBearishPrev && NotEmptyZero(conditions.lSE2[pIndex]); // bool isLSwitchedToBullish = isLBullish && !isLBullishPrev; bool isLSwitchedToBearish = isLBearish && !isLBearishPrev; // bool isLStrongSwitchedToBullish = isLStrongBullish && !isLStrongBullishPrev; bool isLStrongSwitchedToBearish = isLStrongBearish && !isLStrongBearishPrev; // conditions.isLBullish = isLBullish; conditions.isLBearish = isLBearish; conditions.isLStrongBullish = isLStrongBullish; conditions.isLStrongBearish = isLStrongBearish; conditions.isLSwitchedToBullish = isLSwitchedToBullish; conditions.isLSwitchedToBearish = isLSwitchedToBearish; conditions.isLStrongSwitchedToBullish = isLStrongSwitchedToBullish; conditions.isLStrongSwitchedToBearish = isLStrongSwitchedToBearish; // // Hind ... // bool isHBullish = NotEmptyZero(conditions.hLE1[cIndex]); bool isHBearish = NotEmptyZero(conditions.hSE1[cIndex]); // bool isHBullishPrev = NotEmptyZero(conditions.hLE1[pIndex]); bool isHBearishPrev = NotEmptyZero(conditions.hSE1[pIndex]); // bool isHStrongBullish = isHBullish && NotEmptyZero(conditions.hLE2[cIndex]); bool isHStrongBearish = isHBearish && NotEmptyZero(conditions.hSE2[cIndex]); // bool isHStrongBullishPrev = isHBullishPrev && NotEmptyZero(conditions.hLE2[pIndex]); bool isHStrongBearishPrev = isHBearishPrev && NotEmptyZero(conditions.hSE2[pIndex]); // bool isHSwitchedToBullish = isHBullish && !isHBullishPrev; bool isHSwitchedToBearish = isHBearish && !isHBearishPrev; // bool isHStrongSwitchedToBullish = isHStrongBullish && !isHStrongBullishPrev; bool isHStrongSwitchedToBearish = isHStrongBearish && !isHStrongBearishPrev; // conditions.isHBullish = isHBullish; conditions.isHBearish = isHBearish; conditions.isHStrongBullish = isHStrongBullish; conditions.isHStrongBearish = isHStrongBearish; conditions.isHSwitchedToBullish = isHSwitchedToBullish; conditions.isHSwitchedToBearish = isHSwitchedToBearish; conditions.isHStrongSwitchedToBullish = isHStrongSwitchedToBullish; conditions.isHStrongSwitchedToBearish = isHStrongSwitchedToBearish; // return result; } // // Protected ... protected: // // Private ... private: // // Props ... XCHCHEInputs mInputs; // Inputs ... // // Buffers ... // // Current ... double cLE1Buffer[]; double cLE2Buffer[]; double cSE1Buffer[]; double cSE2Buffer[]; // // Short ... double sLE1Buffer[]; double sLE2Buffer[]; double sSE1Buffer[]; double sSE2Buffer[]; // // Medium ... double mLE1Buffer[]; double mLE2Buffer[]; double mSE1Buffer[]; double mSE2Buffer[]; // // Long ... double lLE1Buffer[]; double lLE2Buffer[]; double lSE1Buffer[]; double lSE2Buffer[]; // // Hind ... double hLE1Buffer[]; double hLE2Buffer[]; double hSE1Buffer[]; double hSE2Buffer[]; // // Tools ... // // Calculate Values Until Now ... void Calculate() { // int totalBars = CountBars(); if (totalBars > 1000) { totalBars = 1000; } // // Current ... // // LE1 ... CopyBuffer( mHandler, XCHCHE_CLE1_LINE, 0, totalBars, cLE1Buffer // ); // // LE2 ... CopyBuffer( mHandler, XCHCHE_CLE2_LINE, 0, totalBars, cLE2Buffer // ); // // SE1 ... CopyBuffer( mHandler, XCHCHE_CSE1_LINE, 0, totalBars, cSE1Buffer // ); // // SE2 ... CopyBuffer( mHandler, XCHCHE_CSE2_LINE, 0, totalBars, cSE2Buffer // ); // // Short ... // // LE1 ... CopyBuffer( mHandler, XCHCHE_SLE1_LINE, 0, totalBars, sLE1Buffer // ); // // LE2 ... CopyBuffer( mHandler, XCHCHE_SLE2_LINE, 0, totalBars, sLE2Buffer // ); // // SE1 ... CopyBuffer( mHandler, XCHCHE_SSE1_LINE, 0, totalBars, sSE1Buffer // ); // // SE2 ... CopyBuffer( mHandler, XCHCHE_SSE2_LINE, 0, totalBars, sSE2Buffer // ); // // Medium ... // // LE1 ... CopyBuffer( mHandler, XCHCHE_MLE1_LINE, 0, totalBars, mLE1Buffer // ); // // LE2 ... CopyBuffer( mHandler, XCHCHE_MLE2_LINE, 0, totalBars, mLE2Buffer // ); // // SE1 ... CopyBuffer( mHandler, XCHCHE_MSE1_LINE, 0, totalBars, mSE1Buffer // ); // // SE2 ... CopyBuffer( mHandler, XCHCHE_MSE2_LINE, 0, totalBars, mSE2Buffer // ); // // Long ... // // LE1 ... CopyBuffer( mHandler, XCHCHE_LLE1_LINE, 0, totalBars, lLE1Buffer // ); // // LE2 ... CopyBuffer( mHandler, XCHCHE_LLE2_LINE, 0, totalBars, lLE2Buffer // ); // // SE1 ... CopyBuffer( mHandler, XCHCHE_LSE1_LINE, 0, totalBars, lSE1Buffer // ); // // SE2 ... CopyBuffer( mHandler, XCHCHE_LSE2_LINE, 0, totalBars, lSE2Buffer // ); // // Hind ... // // LE1 ... CopyBuffer( mHandler, XCHCHE_HLE1_LINE, 0, totalBars, hLE1Buffer // ); // // LE2 ... CopyBuffer( mHandler, XCHCHE_HLE2_LINE, 0, totalBars, hLE2Buffer // ); // // SE1 ... CopyBuffer( mHandler, XCHCHE_HSE1_LINE, 0, totalBars, hSE1Buffer // ); // // SE2 ... CopyBuffer( mHandler, XCHCHE_HSE2_LINE, 0, totalBars, hSE2Buffer // ); }; }; //