/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Helper Class Library // ---------------------------------------------- // Name: XCX121X3MAHelper // 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.x-helper.class.mq5" // // Definitions ... // // Definitions ... enum ENUM_X121_X3MA_BUFFERS { // X121_X3MA_FAST_LINE = 0, X121_X3MA_FAST_STATE_LINE = 6, X121_X3MA_MID_LINE = 2, X121_X3MA_MID_STATE_LINE = 7, X121_X3MA_SLOW_LINE = 4, X121_X3MA_SLOW_STATE_LINE = 8, }; // enum ENUM_X3MA_STATES { X3MA_STATE_BULLISH = 1, X3MA_STATE_BEARISH = 2, X3MA_STATE_NEUTURAL = 3, }; // // Input Models ... struct X121X3MAInputs { // // Props ... int x3maFastMALength; // Fast MA Length int x3maMidMALength; // Mid MA Length int x3maSlowMALength; // Slow MA Length ENUM_MA_METHOD x3maMaMethod; // MA Method ENUM_APPLIED_PRICE x3maMaAppliedTo; // Applied To // int startCalculationForLastBars; // Calculate Last n Bars // bool showX3MaFast; // Show X3Ma Fast bool showX3MaMid; // Show X3Ma Medium bool showX3MaSlow; // Show X3Ma Slow // // Constructor(s) ... X121X3MAInputs() { Clean(); } // // Tools ... // // Clean ... void Clean() { // x3maFastMALength = 0; x3maMidMALength = 0; x3maSlowMALength = 0; x3maMaMethod = MODE_EMA; x3maMaAppliedTo = PRICE_CLOSE; startCalculationForLastBars = 0; showX3MaFast = false; showX3MaMid = false; showX3MaSlow = false; // ZeroMemory(this); } // // Default ... void Default() { // x3maFastMALength = 20; x3maMidMALength = 50; x3maSlowMALength = 200; x3maMaMethod = MODE_EMA; x3maMaAppliedTo = PRICE_CLOSE; startCalculationForLastBars = 1000; showX3MaFast = true; showX3MaMid = true; showX3MaSlow = true; } // // Validate ... bool IsValid() { // bool result = false; // result = // x3maFastMALength > 2 && x3maMidMALength > x3maFastMALength && x3maSlowMALength > x3maMidMALength // ; // return result; } // // Retrieve MAx Length ... int Max() { // int result = 0; // result = MathMax(x3maFastMALength, x3maMidMALength); result = MathMax(result, x3maSlowMALength); // return result; } }; // // Conditions ... struct X121X3MAConditions { // // Common ... string symbol; ENUM_TIMEFRAMES period; datetime time; // // Buffers ... double x3maFastBuffer[]; double x3maMidBuffer[]; double x3maSlowBuffer[]; double x3maFastStateBuffer[]; double x3maMidStateBuffer[]; double x3maSlowStateBuffer[]; // // Conditions ... // bool isX3MaFastBullish; bool isX3MaFastBearish; bool isX3MaFastNeutural; // bool isX3MaMidBullish; bool isX3MaMidBearish; bool isX3MaMidNeutural; // bool isX3MaSlowBullish; bool isX3MaSlowBearish; bool isX3MaSlowNeutural; // bool isX3MaFastOverMid; bool isX3MaMidOverSlow; // bool isX3MaFastUnderMid; bool isX3MaMidUnderSlow; // bool isX3MaBullishState; bool isX3MaBearishState; bool isX3MaNeuturalState; // bool isX3MaBullishOrdered; bool isX3MaBearishOrdered; // bool isX3MaSwitchedToBullishOrdered; bool isX3MaSwitchedToBearishOrdered; // bool isX3MaSwitchedToBullishState; bool isX3MaSwitchedToBearishState; bool isX3MaSwitchedToNeuturalState; // // Constructor ... X121X3MAConditions() { Clean(); } // // Tools ... /** * Cleaning Up ... */ void Clean() { // // Commons ... symbol = NULL; period = NULL; time = NULL; // // Buffers ... // Clean(x3maFastBuffer); Clean(x3maMidBuffer); Clean(x3maSlowBuffer); Clean(x3maFastStateBuffer); Clean(x3maMidStateBuffer); Clean(x3maSlowStateBuffer); // ArraySetAsSeries(x3maFastBuffer, true); ArraySetAsSeries(x3maMidBuffer, true); ArraySetAsSeries(x3maSlowBuffer, true); ArraySetAsSeries(x3maFastStateBuffer, true); ArraySetAsSeries(x3maMidStateBuffer, true); ArraySetAsSeries(x3maSlowStateBuffer, true); // // Conditions ... // isX3MaFastBullish = false; isX3MaFastBearish = false; isX3MaFastNeutural = false; // isX3MaMidBullish = false; isX3MaMidBearish = false; isX3MaMidNeutural = false; // isX3MaSlowBullish = false; isX3MaSlowBearish = false; isX3MaSlowNeutural = false; // isX3MaFastOverMid = false; isX3MaMidOverSlow = false; // isX3MaFastUnderMid = false; isX3MaMidUnderSlow = false; // isX3MaBullishState = false; isX3MaBearishState = false; isX3MaNeuturalState = false; // isX3MaBullishOrdered = false; isX3MaBearishOrdered = false; // isX3MaSwitchedToBullishOrdered = false; isX3MaSwitchedToBearishOrdered = false; // isX3MaSwitchedToBullishState = false; isX3MaSwitchedToBearishState = false; isX3MaSwitchedToNeuturalState = false; // ZeroMemory(this); } /** * Generate Conditions Scores ... * * @param bullishScore: Double, Directional Scores Reference ... * @param bearishScore: Double, Directional Scores Reference ... */ void GenerateScore( double &bullishScore, double &bearishScore // ) { // bullishScore = 0; bearishScore = 0; // double score = 1; double minScore = 0.5; double highScore = 1.5; // // X3MA ... // if (isX3MaBullishState) { bullishScore += score; } if (isX3MaBullishOrdered) { bullishScore += score; } if (isX3MaSwitchedToBullishState) { bullishScore += highScore; } if (isX3MaSwitchedToBullishOrdered) { bullishScore += highScore; } if (!isX3MaBullishState && !isX3MaSwitchedToBullishState) { // if (isX3MaFastBullish) { bullishScore += minScore; } if (isX3MaSlowBullish) { bullishScore += minScore; } } if (!isX3MaBullishOrdered && !isX3MaSwitchedToBullishOrdered) { // if (isX3MaFastOverMid) { bullishScore += minScore; } if (isX3MaMidOverSlow) { bullishScore += minScore; } } // if (isX3MaBearishState) { bearishScore += score; } if (isX3MaBearishOrdered) { bearishScore += score; } if (isX3MaSwitchedToBearishState) { bearishScore += highScore; } if (isX3MaSwitchedToBearishOrdered) { bearishScore += highScore; } if (!isX3MaBearishState && !isX3MaSwitchedToBearishState) { // if (isX3MaFastBearish) { bearishScore += minScore; } if (isX3MaSlowBearish) { bearishScore += minScore; } } if (!isX3MaBearishOrdered && !isX3MaSwitchedToBearishOrdered) { // if (isX3MaFastUnderMid) { bearishScore += minScore; } if (isX3MaMidUnderSlow) { bearishScore += minScore; } } } /** * Generate Summary String for Represent Conditions State ... * * @param onlyCommons: Boolean, Just Generate Only Commons Conditions ... * @param onlyConditions: Boolean, Just Generate Only Conditions ... * @param includeScores: Boolean, Attach Scores Representations on Result ... * @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ... * @param separator: String, Separate Lines ... * * @return ( string ) */ 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 = // "-----------------------" + separator + "X3MA: " + separator + "-----------------------" + separator + ToString("isX3MaFastBullish", isX3MaFastBullish, ignoreFalseConditions, separator) + ToString("isX3MaFastBearish", isX3MaFastBearish, ignoreFalseConditions, separator) + ToString("isX3MaFastNeutural", isX3MaFastNeutural, ignoreFalseConditions, separator) + ToString("isX3MaMidBullish", isX3MaMidBullish, ignoreFalseConditions, separator) + ToString("isX3MaMidBearish", isX3MaMidBearish, ignoreFalseConditions, separator) + ToString("isX3MaMidNeutural", isX3MaMidNeutural, ignoreFalseConditions, separator) + ToString("isX3MaSlowBullish", isX3MaSlowBullish, ignoreFalseConditions, separator) + ToString("isX3MaSlowBearish", isX3MaSlowBearish, ignoreFalseConditions, separator) + ToString("isX3MaSlowNeutural", isX3MaSlowNeutural, ignoreFalseConditions, separator) + ToString("isX3MaFastOverMid", isX3MaFastOverMid, ignoreFalseConditions, separator) + ToString("isX3MaMidOverSlow", isX3MaMidOverSlow, ignoreFalseConditions, separator) + ToString("isX3MaFastUnderMid", isX3MaFastUnderMid, ignoreFalseConditions, separator) + ToString("isX3MaMidUnderSlow", isX3MaMidUnderSlow, ignoreFalseConditions, separator) + ToString("isX3MaBullishState", isX3MaBullishState, ignoreFalseConditions, separator) + ToString("isX3MaBearishState", isX3MaBearishState, ignoreFalseConditions, separator) + ToString("isX3MaNeuturalState", isX3MaNeuturalState, ignoreFalseConditions, separator) + ToString("isX3MaBullishOrdered", isX3MaBullishOrdered, ignoreFalseConditions, separator) + ToString("isX3MaBearishOrdered", isX3MaBearishOrdered, ignoreFalseConditions, separator) + ToString("isX3MaSwitchedToBullishOrdered", isX3MaSwitchedToBullishOrdered, ignoreFalseConditions, separator) + ToString("isX3MaSwitchedToBearishOrdered", isX3MaSwitchedToBearishOrdered, ignoreFalseConditions, separator) + ToString("isX3MaSwitchedToBullishState", isX3MaSwitchedToBullishState, ignoreFalseConditions, separator) + ToString("isX3MaSwitchedToBearishState", isX3MaSwitchedToBearishState, ignoreFalseConditions, separator) + ToString("isX3MaSwitchedToNeuturalState", isX3MaSwitchedToNeuturalState, ignoreFalseConditions, separator) + // "" // ; // result = // "[" + GetTag() + "]" + separator + (onlyConditions ? "" : commonStr) + (!includeScores ? "" : scoresStr) + " " + separator + (onlyCommons ? "" : conditionsStr) + "" // ; // return result; } /** * Retrieve nique Tag Identifier ... * * @return ( string ) */ string GetTag() { return GetTypeName(this); } // }; // // Class ... class XCX121X3MAHelper : public XCBaseHelper { // // Public ... public: // // Props ... // // Constructors ... XCX121X3MAHelper() : XCBaseHelper(_Symbol, _Period) { } // // Deconstructor ... ~XCX121X3MAHelper() { // mInputs.Clean(); // Clean(x3maFastBuffer); Clean(x3maMidBuffer); Clean(x3maSlowBuffer); Clean(x3maFastStateBuffer); Clean(x3maMidStateBuffer); Clean(x3maSlowStateBuffer); } // // Tools ... bool Init( string symbol, // Trading Symbol ENUM_TIMEFRAMES period, // Trading Period X121X3MAInputs &inputs // Inputs ) { // bool result = false; // mSymbol = symbol; mPeriod = period; // result = inputs.IsValid(); if (!result) { return result; } // ArraySetAsSeries(x3maFastBuffer, true); ArraySetAsSeries(x3maMidBuffer, true); ArraySetAsSeries(x3maSlowBuffer, true); ArraySetAsSeries(x3maFastStateBuffer, true); ArraySetAsSeries(x3maMidStateBuffer, true); ArraySetAsSeries(x3maSlowStateBuffer, true); // mInputs = inputs; // mHandler = iCustom( mSymbol, mPeriod, "x-saherelm.x121.x3ma", // // Inputs ... // // Market ... "", mInputs.x3maFastMALength, mInputs.x3maMidMALength, mInputs.x3maSlowMALength, mInputs.x3maMaMethod, mInputs.x3maMaAppliedTo, // // Presentation ... "", // mInputs.startCalculationForLastBars, // mInputs.showX3MaFast, mInputs.showX3MaMid, mInputs.showX3MaSlow // ); result = mHandler != INVALID_HANDLE; if (!result) { return result; } // return result; } // // Inputs ... // X121X3MAInputs GetInputs() { return mInputs; } // bool SetInputs( X121X3MAInputs &inputs // Configs ) { // return Init( mSymbol, mPeriod, inputs // ); } // // Readers ... // // FAST ... // double GetX3MaFast( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(barIndex); // int count = ArraySize(x3maFastBuffer); if (barIndex >= count) { barIndex = count - 1; } // return x3maFastBuffer[barIndex]; } // int CopyX3MaFast( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(start); // // Copy Items ... return Copy( 0, count, x3maFastBuffer, buffer, forceClean // ); } // // STATE FAST ... // double GetX3MaFastState( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(barIndex); // int count = ArraySize(x3maFastStateBuffer); if (barIndex >= count) { barIndex = count - 1; } // return x3maFastStateBuffer[barIndex]; } // int CopyX3MaFastState( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(start); // // Copy Items ... return Copy( 0, count, x3maFastStateBuffer, buffer, forceClean // ); } // // MID ... // double GetX3MaMid( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(barIndex); // int count = ArraySize(x3maMidBuffer); if (barIndex >= count) { barIndex = count - 1; } // return x3maMidBuffer[barIndex]; } // int CopyX3MaMid( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(start); // // Copy Items ... return Copy( 0, count, x3maMidBuffer, buffer, forceClean // ); } // // STATE MID ... // double GetX3MaMidState( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(barIndex); // int count = ArraySize(x3maMidStateBuffer); if (barIndex >= count) { barIndex = count - 1; } // return x3maMidStateBuffer[barIndex]; } // int CopyX3MaMidState( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(start); // // Copy Items ... return Copy( 0, count, x3maMidStateBuffer, buffer, forceClean // ); } // // SLOW ... // double GetX3MaSlowBuffer( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(barIndex); // int count = ArraySize(x3maSlowBuffer); if (barIndex >= count) { barIndex = count - 1; } // return x3maSlowBuffer[barIndex]; } // int CopyX3MaSlow( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(start); // // Copy Items ... return Copy( 0, count, x3maSlowBuffer, buffer, forceClean // ); } // // STATE SLOW ... // double GetX3MaSlowState( int barIndex // Bar Index ) { // if (barIndex < 0) { barIndex = 0; } // Calculate(barIndex); // int count = ArraySize(x3maSlowStateBuffer); if (barIndex >= count) { barIndex = count - 1; } // return x3maSlowStateBuffer[barIndex]; } // int CopyX3MaSlowState( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer bool forceClean = true // Force To Clean buffer ) { // // Update Calculations ... Calculate(start); // // Copy Items ... return Copy( 0, count, x3maSlowStateBuffer, buffer, forceClean // ); } // // Converts to State ... ENUM_X3MA_STATES ToX3MAState(double value) { // ENUM_X3MA_STATES result = value == 1 ? X3MA_STATE_BULLISH : value == 2 ? X3MA_STATE_BEARISH : X3MA_STATE_NEUTURAL; // return result; } // bool IsX3MABullish(double value) { // bool result = false; // result = ToX3MAState(value) == X3MA_STATE_BULLISH; // return result; } // bool IsX3MABearish(double value) { // bool result = false; // result = ToX3MAState(value) == X3MA_STATE_BEARISH; // return result; } // bool IsX3MANeutural(double value) { // bool result = false; // result = ToX3MAState(value) == X3MA_STATE_NEUTURAL; // return result; } // void Free() override { Cleanup(10); } // bool GetConditions( X121X3MAConditions &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; // XOHCL zBar; result = zBar.Init( mSymbol, mPeriod, zIndex // ); if (!result) { return result; } // XOHCL cBar; result = cBar.Init( mSymbol, mPeriod, cIndex // ); if (!result) { return result; } // XOHCL pBar; result = pBar.Init( mSymbol, mPeriod, pIndex // ); if (!result) { return result; } // // Buffers ... // CopyX3MaFast( zIndex, loopback, conditions.x3maFastBuffer // ); // CopyX3MaFastState( zIndex, loopback, conditions.x3maFastStateBuffer // ); // CopyX3MaMid( zIndex, loopback, conditions.x3maMidBuffer // ); // CopyX3MaMidState( zIndex, loopback, conditions.x3maMidStateBuffer // ); // CopyX3MaSlow( zIndex, loopback, conditions.x3maSlowBuffer // ); // CopyX3MaSlowState( zIndex, loopback, conditions.x3maSlowStateBuffer // ); // // Conditions ... // int cIDX = 1; int pIDX = cIDX + 1; // // SAR ... // bool isX3MaFastBullish = IsX3MABullish(conditions.x3maFastStateBuffer[cIDX]); bool isX3MaFastBullishPrev = IsX3MABullish(conditions.x3maFastStateBuffer[pIDX]); // bool isX3MaFastBearish = IsX3MABearish(conditions.x3maFastStateBuffer[cIDX]); bool isX3MaFastBearishPrev = IsX3MABearish(conditions.x3maFastStateBuffer[pIDX]); // bool isX3MaFastNeutural = IsX3MANeutural(conditions.x3maFastStateBuffer[cIDX]); bool isX3MaFastNeuturalPrev = IsX3MANeutural(conditions.x3maFastStateBuffer[pIDX]); // bool isX3MaMidBullish = IsX3MABullish(conditions.x3maMidStateBuffer[cIDX]); bool isX3MaMidBullishPrev = IsX3MABullish(conditions.x3maMidStateBuffer[pIDX]); // bool isX3MaMidBearish = IsX3MABearish(conditions.x3maMidStateBuffer[cIDX]); bool isX3MaMidBearishPrev = IsX3MABearish(conditions.x3maMidStateBuffer[pIDX]); // bool isX3MaMidNeutural = IsX3MANeutural(conditions.x3maMidStateBuffer[cIDX]); bool isX3MaMidNeuturalPrev = IsX3MANeutural(conditions.x3maMidStateBuffer[pIDX]); // bool isX3MaSlowBullish = IsX3MABullish(conditions.x3maSlowStateBuffer[cIDX]); bool isX3MaSlowBullishPrev = IsX3MABullish(conditions.x3maSlowStateBuffer[pIDX]); // bool isX3MaSlowBearish = IsX3MABearish(conditions.x3maSlowStateBuffer[cIDX]); bool isX3MaSlowBearishPrev = IsX3MABearish(conditions.x3maSlowStateBuffer[pIDX]); // bool isX3MaSlowNeutural = IsX3MANeutural(conditions.x3maSlowStateBuffer[cIDX]); bool isX3MaSlowNeuturalPrev = IsX3MANeutural(conditions.x3maSlowStateBuffer[pIDX]); // bool isX3MaFastOverMid = conditions.x3maFastBuffer[cIDX] > conditions.x3maMidBuffer[cIDX]; bool isX3MaFastOverMidPrev = conditions.x3maFastBuffer[pIDX] > conditions.x3maMidBuffer[pIDX]; // bool isX3MaMidOverSlow = conditions.x3maMidBuffer[cIDX] > conditions.x3maSlowBuffer[cIDX]; bool isX3MaMidOverSlowPrev = conditions.x3maMidBuffer[pIDX] > conditions.x3maSlowBuffer[pIDX]; // bool isX3MaFastUnderMid = conditions.x3maFastBuffer[cIDX] < conditions.x3maMidBuffer[cIDX]; bool isX3MaFastUnderMidPrev = conditions.x3maFastBuffer[pIDX] < conditions.x3maMidBuffer[pIDX]; // bool isX3MaMidUnderSlow = conditions.x3maMidBuffer[cIDX] < conditions.x3maSlowBuffer[cIDX]; bool isX3MaMidUnderSlowPrev = conditions.x3maMidBuffer[pIDX] < conditions.x3maSlowBuffer[pIDX]; // bool isX3MaBullishState = isX3MaFastBullish && isX3MaMidBullish && isX3MaSlowBullish; bool isX3MaBullishStatePrev = isX3MaFastBullishPrev && isX3MaMidBullishPrev && isX3MaSlowBullishPrev; // bool isX3MaBearishState = isX3MaFastBearish && isX3MaMidBearish && isX3MaSlowBearish; bool isX3MaBearishStatePrev = isX3MaFastBearishPrev && isX3MaMidBearishPrev && isX3MaSlowBearishPrev; // bool isX3MaNeuturalState = isX3MaFastNeutural && isX3MaMidNeutural && isX3MaSlowNeutural; bool isX3MaNeuturalStatePrev = isX3MaFastNeuturalPrev && isX3MaMidNeuturalPrev && isX3MaSlowNeuturalPrev; // bool isX3MaBullishOrdered = isX3MaFastOverMid && isX3MaMidOverSlow; bool isX3MaBullishOrderedPrev = isX3MaFastOverMidPrev && isX3MaMidOverSlowPrev; // bool isX3MaBearishOrdered = isX3MaFastUnderMid && isX3MaMidUnderSlow; bool isX3MaBearishOrderedPrev = isX3MaFastUnderMidPrev && isX3MaMidUnderSlowPrev; // bool isX3MaSwitchedToBullishOrdered = isX3MaBullishOrdered && !isX3MaBullishOrderedPrev; bool isX3MaSwitchedToBearishOrdered = isX3MaBearishOrdered && !isX3MaBearishOrderedPrev; // bool isX3MaSwitchedToBullishState = isX3MaBullishState && !isX3MaBullishStatePrev; bool isX3MaSwitchedToBearishState = isX3MaBearishState && !isX3MaBearishStatePrev; bool isX3MaSwitchedToNeuturalState = isX3MaNeuturalState && !isX3MaNeuturalStatePrev; // conditions.isX3MaFastBullish = isX3MaFastBullish; conditions.isX3MaFastBearish = isX3MaFastBearish; conditions.isX3MaFastNeutural = isX3MaFastNeutural; conditions.isX3MaMidBullish = isX3MaMidBullish; conditions.isX3MaMidBearish = isX3MaMidBearish; conditions.isX3MaMidNeutural = isX3MaMidNeutural; conditions.isX3MaSlowBullish = isX3MaSlowBullish; conditions.isX3MaSlowBearish = isX3MaSlowBearish; conditions.isX3MaSlowNeutural = isX3MaSlowNeutural; conditions.isX3MaFastOverMid = isX3MaFastOverMid; conditions.isX3MaMidOverSlow = isX3MaMidOverSlow; conditions.isX3MaFastUnderMid = isX3MaFastUnderMid; conditions.isX3MaMidUnderSlow = isX3MaMidUnderSlow; conditions.isX3MaBullishState = isX3MaBullishState; conditions.isX3MaBearishState = isX3MaBearishState; conditions.isX3MaNeuturalState = isX3MaNeuturalState; conditions.isX3MaBullishOrdered = isX3MaBullishOrdered; conditions.isX3MaBearishOrdered = isX3MaBearishOrdered; conditions.isX3MaSwitchedToBullishOrdered = isX3MaSwitchedToBullishOrdered; conditions.isX3MaSwitchedToBearishOrdered = isX3MaSwitchedToBearishOrdered; conditions.isX3MaSwitchedToBullishState = isX3MaSwitchedToBullishState; conditions.isX3MaSwitchedToBearishState = isX3MaSwitchedToBearishState; conditions.isX3MaSwitchedToNeuturalState = isX3MaSwitchedToNeuturalState; // Cleanup(); // zBar.Clean(); cBar.Clean(); pBar.Clean(); // return result; } // // Protected ... protected: // // Private ... private: // // Props ... X121X3MAInputs mInputs; // Inputs ... // // Buffers ... double x3maFastBuffer[]; double x3maMidBuffer[]; double x3maSlowBuffer[]; double x3maFastStateBuffer[]; double x3maMidStateBuffer[]; double x3maSlowStateBuffer[]; // void Calculate( int barIndex = 0, int maxRequiredBars = 100 // ) { // // Buffers ... if (barIndex < 0) { barIndex = 0; } // // FAST ... CopyBuffer( mHandler, X121_X3MA_FAST_LINE, barIndex, maxRequiredBars, x3maFastBuffer // ); // // FAST STATE ... CopyBuffer( mHandler, X121_X3MA_FAST_STATE_LINE, barIndex, maxRequiredBars, x3maFastStateBuffer // ); // // MID ... CopyBuffer( mHandler, X121_X3MA_MID_LINE, barIndex, maxRequiredBars, x3maMidBuffer // ); // // MID STATE ... CopyBuffer( mHandler, X121_X3MA_MID_STATE_LINE, barIndex, maxRequiredBars, x3maMidStateBuffer // ); // // SLOW ... CopyBuffer( mHandler, X121_X3MA_SLOW_LINE, barIndex, maxRequiredBars, x3maSlowBuffer // ); // // SLOW STATE ... CopyBuffer( mHandler, X121_X3MA_SLOW_STATE_LINE, barIndex, maxRequiredBars, x3maSlowStateBuffer // ); } // void Cleanup( int maxAllowed = 100 // ) { // CleanupArray( x3maFastBuffer, maxAllowed // ); // CleanupArray( x3maMidBuffer, maxAllowed // ); // CleanupArray( x3maSlowBuffer, maxAllowed // ); // CleanupArray( x3maFastStateBuffer, maxAllowed // ); // CleanupArray( x3maMidStateBuffer, maxAllowed // ); // CleanupArray( x3maSlowStateBuffer, maxAllowed // ); // } // }; // // Tools ...