From 8d90d3bcc2d2fdf23b99cc75951b9a3837ff3256 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 30 Dec 2024 22:20:32 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x-cobject.class.mq5 | 13 +- Classes/x-saherelm.x-poi.drawer.class.mq5 | 75 +- Helpers/x-saherelm.x3ma.helper.mq5 | 758 ---- Helpers/x-saherelm.x3vwap.helper.mq5 | 1150 ------ Helpers/x-saherelm.xchsar.helper.mq5 | 1267 ------- Helpers/x-saherelm.xpv.helper.mq5 | 3237 ----------------- .../Signals/x-121.smc.xtwpv.signal.lib.mq5 | 205 +- .../Strategy/x-121.smc.strategy.class.mq5 | 118 +- 8 files changed, 258 insertions(+), 6565 deletions(-) delete mode 100644 Helpers/x-saherelm.x3ma.helper.mq5 delete mode 100644 Helpers/x-saherelm.x3vwap.helper.mq5 delete mode 100644 Helpers/x-saherelm.xchsar.helper.mq5 delete mode 100644 Helpers/x-saherelm.xpv.helper.mq5 diff --git a/Classes/x-saherelm.x-cobject.class.mq5 b/Classes/x-saherelm.x-cobject.class.mq5 index ec757618..383fc7fd 100644 --- a/Classes/x-saherelm.x-cobject.class.mq5 +++ b/Classes/x-saherelm.x-cobject.class.mq5 @@ -1755,24 +1755,27 @@ class XCSignalObject : public XCBaseObject */ bool Create( long chart_id, - const string name, const int window, - XSignal &signal // + XSignal &signal, + string prefix = NULL // ) { // bool result = false; // - result = IsValid(name) && - signal - .IsValid(); + result = signal.IsValid(); if (!result) { return result; } // + string name = signal.GetTag(); + if (IsValid(prefix)) + { + name = prefix + "_" + name; + } string nameMD5 = ToMD5(name); // diff --git a/Classes/x-saherelm.x-poi.drawer.class.mq5 b/Classes/x-saherelm.x-poi.drawer.class.mq5 index e31cbb2d..b1a0646d 100644 --- a/Classes/x-saherelm.x-poi.drawer.class.mq5 +++ b/Classes/x-saherelm.x-poi.drawer.class.mq5 @@ -2487,12 +2487,6 @@ class XCPOIDrawer : public XCBase long chartID = ChartIdentification(); int window = SubWindowIdentification(); - // - // bool fill = BearishFVGFill(); - // int width = BearishFVGWidth(); - // color crl = BearishFVGColor(); - // ENUM_LINE_STYLE style = BearishFVGStyle(); - // object = new XCTicksZoneObject(); result = object.Create( @@ -2513,6 +2507,49 @@ class XCPOIDrawer : public XCBase return result; } + /** + * Create Consolidation Zone Object ... + * + * @param zone: XConsolidationZone instance Reference ... + * + * @return ( bool ) + */ + bool CreateConsolidationZone( + XConsolidationZone &zone, + XCConsolidationZoneObject *&object // + ) + { + // + bool result = false; + + // + object = NULL; + + // + result = zone.IsValid(); + if (!result) + { + return result; + } + + // + string prefix = Prefix(); + long chartID = ChartIdentification(); + int window = SubWindowIdentification(); + + // + object = new XCConsolidationZoneObject(); + result = object.Create( + chartID, + window, + zone, + prefix // + ); + + // + return result; + } + /** * Draw Specified Signal ... * @@ -2537,13 +2574,17 @@ class XCPOIDrawer : public XCBase } // - string name = signal.GetTag(); + string prefix = Prefix(); + long chartID = ChartIdentification(); + int window = SubWindowIdentification(); + + // object = new XCSignalObject(); result = object.Create( - ChartIdentification(), - name, - SubWindowIdentification(), - signal // + chartID, + window, + signal, + prefix // ); if (!result) { @@ -3155,14 +3196,20 @@ class XCPOIDrawer : public XCBase return result; } + // + string prefix = Prefix(); + long chartID = ChartIdentification(); + int window = SubWindowIdentification(); + // // Draw Pivot it self ... XCXPVPivotObject *iPivotObj; iPivotObj = new XCXPVPivotObject(); bool isCreated = iPivotObj.Create( - ChartIdentification(), - SubWindowIdentification(), - pivot // + chartID, + window, + pivot, + prefix // ); if (!isCreated) { diff --git a/Helpers/x-saherelm.x3ma.helper.mq5 b/Helpers/x-saherelm.x3ma.helper.mq5 deleted file mode 100644 index 96458f22..00000000 --- a/Helpers/x-saherelm.x3ma.helper.mq5 +++ /dev/null @@ -1,758 +0,0 @@ -/////////////////////////////////////////////////////// -// -// SaherElm IT Center MQL5 Helper Class Library -// ---------------------------------------------- -// Name: XSCX3MAHelper -// 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 ... - -// -enum ENUM_X3MA_BUFFERS -{ - // - X3MA_FAST_LINE = 0, - X3MA_MID_LINE = 1, - X3MA_SLOW_LINE = 2, -}; - -// -// Input Models ... -struct X3MAInputs -{ - // - // Props ... - - // - // Market ... - int fastLength; // Fast Length - int midLength; // Mid Length - int slowLength; // Slow Length - int shiftLength; // Shift - ENUM_MA_METHOD method; // Mode - ENUM_APPLIED_PRICE appliedTo; // Applied To - - // - // Presentation ... - - // - bool showFast; // Show Fast - bool showMid; // Show Mid - bool showSlow; // Show Slow - - // - // Constructor(s) ... - X3MAInputs() - { - // - Clean(); - } - - // - // Tools ... - - // - // Clean ... - void Clean() - { - // - fastLength = 0; - midLength = 0; - slowLength = 0; - shiftLength = 0; - method = MODE_SMA; - appliedTo = PRICE_CLOSE; - - // - showFast = false; - showMid = false; - showSlow = false; - } - - // - // Default ... - void Default() - { - // - fastLength = 50; - midLength = 100; - slowLength = 200; - shiftLength = 0; - method = MODE_SMA; - appliedTo = PRICE_CLOSE; - - // - showFast = true; - showMid = true; - showSlow = true; - } - - // - // Validate ... - bool IsValid() - { - // - bool result = false; - - // - result = - // - fastLength > 2 && - midLength > fastLength && - slowLength > midLength && - // - shiftLength >= 0 - // - ; - - // - return result; - } - - // - // Retrieve MAx Length ... - int Max() - { - // - int result = 0; - - // - result = MathMax(fastLength, midLength); - result = MathMax(result, slowLength); - - // - return result; - } -}; - -// -// Define Conditions ... -struct X3MAConditions -{ - // - // Common ... - string symbol; - ENUM_TIMEFRAMES period; - datetime time; - - // - // Buffers ... - - // - double fasts[]; - double mids[]; - double slows[]; - - // - // Conditions ... - - // - bool isFastOverMid; - bool isMidOverSlow; - - // - bool isFastUnderMid; - bool isMidUnderSlow; - - // - bool isBullishOrdered; - bool isBearishOrdered; - - // - bool isSwitchedToBullishOrdered; - bool isSwitchedToBearishOrdered; - - // - void X3MAConditions() - { - Clean(); - } - - // - void Clean() - { - // - Clean(fasts); - Clean(mids); - Clean(slows); - - // - ArraySetAsSeries(fasts, true); - ArraySetAsSeries(mids, true); - ArraySetAsSeries(slows, true); - - // - isFastOverMid = false; - isMidOverSlow = false; - isFastUnderMid = false; - isMidUnderSlow = false; - isBullishOrdered = false; - isBearishOrdered = false; - isSwitchedToBullishOrdered = false; - isSwitchedToBearishOrdered = 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 ... - } - - // - 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 = - // - "" - // - ; - - // - result = - // - "[" + GetTag() + "]" + separator + - (onlyConditions - ? "" - : commonStr) + - (!includeScores - ? "" - : scoresStr) + - " " + separator + - (onlyCommons - ? "" - : conditionsStr) + - "" - // - ; - - // - return result; - } - - // - string GetTag() - { - return "X3MA"; - } -}; - -// -// Class ... -class XCX3MAHelper : public XCBaseHelper -{ - // - // Public ... - public: - // - // Props ... - - // - // Constructors ... - XCX3MAHelper() - : XCBaseHelper(_Symbol, _Period) - { - } - - // - // Deconstructor ... - ~XCX3MAHelper() - { - // - Clean(fastBuffer); - Clean(midBuffer); - Clean(slowBuffer); - } - - // - // Tools ... - bool Init( - string symbol, // Trading Symbol - ENUM_TIMEFRAMES period, // Trading Period - X3MAInputs &inputs // Inputs - ) - { - // - bool result = false; - - // - mSymbol = symbol; - mPeriod = period; - - // - result = inputs.IsValid(); - if (!result) - { - return result; - } - - // - mInputs = inputs; - - // - ArraySetAsSeries(fastBuffer, true); - ArraySetAsSeries(midBuffer, true); - ArraySetAsSeries(slowBuffer, true); - - // - mHandler = iCustom( - mSymbol, - mPeriod, - "x-saherelm.x3ma", - // - // Inputs ... - // - // Market ... - "", - mInputs.fastLength, - mInputs.midLength, - mInputs.slowLength, - mInputs.shiftLength, - mInputs.method, - mInputs.appliedTo, - // - // Presentation ... - "", - // - mInputs.showFast, - mInputs.showMid, - mInputs.showSlow - // - ); - result = mHandler != INVALID_HANDLE; - if (!result) - { - return result; - } - - // - return result; - } - - // - // Inputs ... - - // - X3MAInputs GetInputs() - { - return mInputs; - } - - // - bool SetInputs( - X3MAInputs &inputs // Configs - ) - { - // - return Init( - mSymbol, - mPeriod, - inputs - // - ); - } - - // - // Buffers ... - - // - double GetFast( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(fastBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return fastBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyFast( - 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, - fastBuffer, - buffer, - forceClean - // - ); - } - - // - double GetMid( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(midBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return midBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyMid( - 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, - midBuffer, - buffer, - forceClean - // - ); - } - - // - double GetSlow( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(slowBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return slowBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopySlow( - 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, - slowBuffer, - buffer, - forceClean - // - ); - } - - // - // Conditions ... - - // - bool GetConditions( - X3MAConditions &conditions, // - int barIndex = 0, // - int loopback = 5 // - ) - { - // - bool result = true; - - // - if (loopback < 3) - { - loopback = 3; - } - - // - 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 ... - - // - // Fast ... - CopyFast( - zIndex, - loopback, - conditions.fasts // - ); - - // - // Mid ... - CopyMid( - zIndex, - loopback, - conditions.mids // - ); - - // - // Slow ... - CopySlow( - zIndex, - loopback, - conditions.slows // - ); - - // - // Conditions ... - - // - bool isFastOverMid = - conditions.fasts[cIndex] > conditions.mids[cIndex]; - bool isFastOverMidPrev = - conditions.fasts[pIndex] > conditions.mids[pIndex]; - - // - bool isMidOverSlow = - conditions.mids[cIndex] > conditions.slows[cIndex]; - bool isMidOverSlowPrev = - conditions.mids[pIndex] > conditions.slows[pIndex]; - - // - bool isFastUnderMid = - conditions.fasts[cIndex] < conditions.mids[cIndex]; - bool isFastUnderMidPrev = - conditions.fasts[pIndex] < conditions.mids[pIndex]; - - // - bool isMidUnderSlow = - conditions.mids[cIndex] < conditions.slows[cIndex]; - bool isMidUnderSlowPrev = - conditions.mids[pIndex] < conditions.slows[pIndex]; - - // - bool isBullishOrdered = isFastOverMid && - isMidOverSlow; - bool isBullishOrderedPrev = isFastOverMidPrev && - isMidOverSlowPrev; - - // - bool isBearishOrdered = isFastUnderMid && - isMidUnderSlow; - bool isBearishOrderedPrev = isFastUnderMidPrev && - isMidUnderSlowPrev; - - // - bool isSwitchedToBullishOrdered = isBullishOrdered && - !isBullishOrderedPrev; - bool isSwitchedToBearishOrdered = isBearishOrdered && - !isBearishOrderedPrev; - - // - conditions.isFastOverMid = isFastOverMid; - conditions.isMidOverSlow = isMidOverSlow; - conditions.isFastUnderMid = isFastUnderMid; - conditions.isMidUnderSlow = isMidUnderSlow; - conditions.isBullishOrdered = isBullishOrdered; - conditions.isBearishOrdered = isBearishOrdered; - conditions.isSwitchedToBullishOrdered = isSwitchedToBullishOrdered; - conditions.isSwitchedToBearishOrdered = isSwitchedToBearishOrdered; - - // - return result; - } - - // - // Protected ... - protected: - // - // Private ... - private: - // - // Props ... - X3MAInputs mInputs; // Inputs ... - - // - // Buffers ... - double fastBuffer[]; - double midBuffer[]; - double slowBuffer[]; - - // - // Tools ... - - // - // Calculate Values Until Now ... - void Calculate() - { - // - int totalBars = CountBars(); - if (totalBars > 1000) - { - totalBars = 1000; - } - - // - // Fast ... - CopyBuffer( - mHandler, - X3MA_FAST_LINE, - 0, - totalBars, - fastBuffer - // - ); - - // - // Mid ... - CopyBuffer( - mHandler, - X3MA_MID_LINE, - 0, - totalBars, - midBuffer - // - ); - - // - // Slow ... - CopyBuffer( - mHandler, - X3MA_SLOW_LINE, - 0, - totalBars, - slowBuffer - // - ); - } -}; - -// \ No newline at end of file diff --git a/Helpers/x-saherelm.x3vwap.helper.mq5 b/Helpers/x-saherelm.x3vwap.helper.mq5 deleted file mode 100644 index e3cc34a2..00000000 --- a/Helpers/x-saherelm.x3vwap.helper.mq5 +++ /dev/null @@ -1,1150 +0,0 @@ -/////////////////////////////////////////////////////// -// -// SaherElm IT Center MQL5 Helper Class Library -// ---------------------------------------------- -// Name: XSCX3VWAPHelper -// 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 ... - -// -enum ENUM_X3VWAP_BUFFERS -{ - // - X3VWAP_FAST_LINE = 0, - X3VWAP_FAST_STATE_LINE = 8, - X3VWAP_MID_LINE = 2, - X3VWAP_MID_STATE_LINE = 9, - X3VWAP_SLOW_LINE = 4, - X3VWAP_SLOW_STATE_LINE = 10, -}; - -// -enum ENUM_X3VWAP_STATES -{ - // - X3VWAP_STATE_BULLISH = 1, - X3VWAP_STATE_BEARISH = 2, - X3VWAP_STATE_NEUTURAL = 3, -}; - -// -// Input Models ... -struct X3VWAPInputs -{ - // - // Props ... - - // - // Market ... - int fastLength; // Fast Length - int midLength; // Mid Length - int slowLength; // Slow Length - ENUM_APPLIED_PRICE appliedTo; // Applied To - - // - // Presentation ... - - // - bool showFast; // Show Fast - bool showMid; // Show Mid - bool showSlow; // Show Slow - - // - // Constructor(s) ... - X3VWAPInputs() - { - // - Clean(); - } - - // - // Tools ... - - // - // Clean ... - void Clean() - { - // - fastLength = 0; - midLength = 0; - slowLength = 0; - appliedTo = PRICE_CLOSE; - - // - showFast = false; - showMid = false; - showSlow = false; - } - - // - // Default ... - void Default() - { - // - fastLength = 50; - midLength = 100; - slowLength = 200; - appliedTo = PRICE_CLOSE; - - // - showFast = true; - showMid = true; - showSlow = true; - } - - // - // Validate ... - bool IsValid() - { - // - bool result = false; - - // - result = - // - fastLength > 2 && - midLength > fastLength && - slowLength > midLength - // - ; - - // - return result; - } - - // - // Retrieve MAx Length ... - int Max() - { - // - int result = 0; - - // - result = MathMax(fastLength, midLength); - result = MathMax(result, slowLength); - - // - return result; - } -}; - -// -// Define Conditions ... -struct X3VWAPConditions -{ - // - // Common ... - string symbol; - ENUM_TIMEFRAMES period; - datetime time; - - // - // Buffers ... - - // - double fasts[]; - double fastStates[]; - double mids[]; - double midStates[]; - double slows[]; - double slowStates[]; - - // - // Conditions ... - - // - bool isFastBullish; - bool isFastBearish; - bool isFastNeutural; - - // - bool isMidBullish; - bool isMidBearish; - bool isMidNeutural; - - // - bool isSlowBullish; - bool isSlowBearish; - bool isSlowNeutural; - - // - bool isFastOverMid; - bool isMidOverSlow; - - // - bool isFastUnderMid; - bool isMidUnderSlow; - - // - bool isBullishState; - bool isBearishState; - bool isNeuturalState; - - // - bool isBullishOrdered; - bool isBearishOrdered; - - // - bool isSwitchedToBullishOrdered; - bool isSwitchedToBearishOrdered; - - // - bool isSwitchedToBullishState; - bool isSwitchedToBearishState; - bool isSwitchedToNeuturalState; - - // - void X3VWAPConditions() - { - Clean(); - } - - // - void Clean() - { - // - Clean(fasts); - Clean(mids); - Clean(slows); - - // - Clean(fastStates); - Clean(midStates); - Clean(slowStates); - - // - ArraySetAsSeries(fasts, true); - ArraySetAsSeries(mids, true); - ArraySetAsSeries(slows, true); - - // - ArraySetAsSeries(fastStates, true); - ArraySetAsSeries(midStates, true); - ArraySetAsSeries(slowStates, true); - - // - isFastBullish = false; - isFastBearish = false; - isFastNeutural = false; - isMidBullish = false; - isMidBearish = false; - isMidNeutural = false; - isSlowBullish = false; - isSlowBearish = false; - isSlowNeutural = false; - isFastOverMid = false; - isMidOverSlow = false; - isFastUnderMid = false; - isMidUnderSlow = false; - isBullishState = false; - isBearishState = false; - isNeuturalState = false; - isBullishOrdered = false; - isBearishOrdered = false; - isSwitchedToBullishOrdered = false; - isSwitchedToBearishOrdered = false; - isSwitchedToBullishState = false; - isSwitchedToBearishState = false; - isSwitchedToNeuturalState = 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 ... - } - - // - 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 = - // - "" - // - ; - - // - result = - // - "[" + GetTag() + "]" + separator + - (onlyConditions - ? "" - : commonStr) + - (!includeScores - ? "" - : scoresStr) + - " " + separator + - (onlyCommons - ? "" - : conditionsStr) + - "" - // - ; - - // - return result; - } - - // - string GetTag() - { - return "X3VWAP"; - } -}; - -// -// Class ... -class XCX3VWAPHelper : public XCBaseHelper -{ - // - // Public ... - public: - // - // Props ... - - // - // Constructors ... - XCX3VWAPHelper() - : XCBaseHelper(_Symbol, _Period) - { - } - - // - // Deconstructor ... - ~XCX3VWAPHelper() - { - // - Clean(fastBuffer); - Clean(midBuffer); - Clean(slowBuffer); - } - - // - // Tools ... - bool Init( - string symbol, // Trading Symbol - ENUM_TIMEFRAMES period, // Trading Period - X3VWAPInputs &inputs // Inputs - ) - { - // - bool result = false; - - // - mSymbol = symbol; - mPeriod = period; - - // - result = inputs.IsValid(); - if (!result) - { - return result; - } - - // - mInputs = inputs; - - // - ArraySetAsSeries(fastBuffer, true); - ArraySetAsSeries(fastStateBuffer, true); - - // - ArraySetAsSeries(midBuffer, true); - ArraySetAsSeries(midStateBuffer, true); - - // - ArraySetAsSeries(slowBuffer, true); - ArraySetAsSeries(slowStateBuffer, true); - - // - mHandler = iCustom( - mSymbol, - mPeriod, - "x-saherelm.x3vwap", - // - // Inputs ... - // - // Market ... - "", - mInputs.fastLength, - mInputs.midLength, - mInputs.slowLength, - mInputs.appliedTo, - // - // Presentation ... - "", - // - mInputs.showFast, - mInputs.showMid, - mInputs.showSlow - // - ); - result = mHandler != INVALID_HANDLE; - if (!result) - { - return result; - } - - // - return result; - } - - // - // Inputs ... - - // - X3VWAPInputs GetInputs() - { - return mInputs; - } - - // - bool SetInputs( - X3VWAPInputs &inputs // Configs - ) - { - // - return Init( - mSymbol, - mPeriod, - inputs - // - ); - } - - // - // Buffers ... - - // - double GetFast( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(fastBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return fastBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyFast( - 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, - fastBuffer, - buffer, - forceClean - // - ); - } - - // - double GetFastState( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(fastStateBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return fastStateBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyFastState( - 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, - fastStateBuffer, - buffer, - forceClean - // - ); - } - - // - double GetMid( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(midBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return midBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyMid( - 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, - midBuffer, - buffer, - forceClean - // - ); - } - - // - double GetMidState( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(midStateBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return midStateBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyMidState( - 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, - midStateBuffer, - buffer, - forceClean - // - ); - } - - // - double GetSlow( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(slowBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return slowBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopySlow( - 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, - slowBuffer, - buffer, - forceClean - // - ); - } - - // - double GetSlowState( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(slowStateBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return slowStateBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopySlowState( - 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, - slowStateBuffer, - buffer, - forceClean - // - ); - } - - // - // Converts to State ... - ENUM_X3VWAP_STATES ToState(double value) - { - // - ENUM_X3VWAP_STATES result = - value == 1 - ? X3VWAP_STATE_BULLISH - : value == 2 - ? X3VWAP_STATE_BEARISH - : X3VWAP_STATE_NEUTURAL; - - // - return result; - } - - // - bool IsBullish(double value) - { - // - bool result = false; - - // - result = ToState(value) == X3VWAP_STATE_BULLISH; - - // - return result; - } - - // - bool IsBearish(double value) - { - // - bool result = false; - - // - result = ToState(value) == X3VWAP_STATE_BEARISH; - - // - return result; - } - - // - bool IsNeutural(double value) - { - // - bool result = false; - - // - result = ToState(value) == X3VWAP_STATE_NEUTURAL; - - // - return result; - } - - // - // Conditions ... - - // - bool GetConditions( - X3VWAPConditions &conditions, // - int barIndex = 0, // - int loopback = 5 // - ) - { - // - bool result = true; - - // - if (loopback < 3) - { - loopback = 3; - } - - // - 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 ... - - // - // Fast ... - CopyFast( - zIndex, - loopback, - conditions.fasts // - ); - CopyFastState( - zIndex, - loopback, - conditions.fastStates // - ); - - // - // Mid ... - CopyMid( - zIndex, - loopback, - conditions.mids // - ); - CopyMidState( - zIndex, - loopback, - conditions.midStates // - ); - - // - // Slow ... - CopySlow( - zIndex, - loopback, - conditions.slows // - ); - CopySlowState( - zIndex, - loopback, - conditions.slowStates // - ); - - // - // Conditions ... - - // - bool isFastBullish = IsBullish(conditions.fastStates[cIndex]); - bool isFastBullishPrev = IsBullish(conditions.fastStates[pIndex]); - - // - bool isFastBearish = IsBearish(conditions.fastStates[cIndex]); - bool isFastBearishPrev = IsBearish(conditions.fastStates[pIndex]); - - // - bool isFastNeutural = IsNeutural(conditions.fastStates[cIndex]); - bool isFastNeuturalPrev = IsNeutural(conditions.fastStates[pIndex]); - - // - bool isMidBullish = IsBullish(conditions.midStates[cIndex]); - bool isMidBullishPrev = IsBullish(conditions.midStates[pIndex]); - - // - bool isMidBearish = IsBearish(conditions.midStates[cIndex]); - bool isMidBearishPrev = IsBearish(conditions.midStates[pIndex]); - - // - bool isMidNeutural = IsNeutural(conditions.midStates[cIndex]); - bool isMidNeuturalPrev = IsNeutural(conditions.midStates[pIndex]); - - // - bool isSlowBullish = IsBullish(conditions.slowStates[cIndex]); - bool isSlowBullishPrev = IsBullish(conditions.slowStates[pIndex]); - - // - bool isSlowBearish = IsBearish(conditions.slowStates[cIndex]); - bool isSlowBearishPrev = IsBearish(conditions.slowStates[pIndex]); - - // - bool isSlowNeutural = IsNeutural(conditions.slowStates[cIndex]); - bool isSlowNeuturalPrev = IsNeutural(conditions.slowStates[pIndex]); - - // - bool isFastOverMid = - conditions.fasts[cIndex] > conditions.mids[cIndex]; - bool isFastOverMidPrev = - conditions.fasts[pIndex] > conditions.mids[pIndex]; - - // - bool isMidOverSlow = - conditions.mids[cIndex] > conditions.slows[cIndex]; - bool isMidOverSlowPrev = - conditions.mids[pIndex] > conditions.slows[pIndex]; - - // - bool isFastUnderMid = - conditions.fasts[cIndex] < conditions.mids[cIndex]; - bool isFastUnderMidPrev = - conditions.fasts[pIndex] < conditions.mids[pIndex]; - - // - bool isMidUnderSlow = - conditions.mids[cIndex] < conditions.slows[cIndex]; - bool isMidUnderSlowPrev = - conditions.mids[pIndex] < conditions.slows[pIndex]; - - // - bool isBullishState = isFastBullish && - isMidBullish && - isSlowBullish; - bool isBullishStatePrev = isFastBullishPrev && - isMidBullishPrev && - isSlowBullishPrev; - - // - bool isBearishState = isFastBearish && - isMidBearish && - isSlowBearish; - bool isBearishStatePrev = isFastBearishPrev && - isMidBearishPrev && - isSlowBearishPrev; - - // - bool isNeuturalState = isFastNeutural && - isMidNeutural && - isSlowNeutural; - bool isNeuturalStatePrev = isFastNeuturalPrev && - isMidNeuturalPrev && - isSlowNeuturalPrev; - - // - bool isBullishOrdered = isFastOverMid && - isMidOverSlow; - bool isBullishOrderedPrev = isFastOverMidPrev && - isMidOverSlowPrev; - - // - bool isBearishOrdered = isFastUnderMid && - isMidUnderSlow; - bool isBearishOrderedPrev = isFastUnderMidPrev && - isMidUnderSlowPrev; - - // - bool isSwitchedToBullishOrdered = isBullishOrdered && - !isBullishOrderedPrev; - bool isSwitchedToBearishOrdered = isBearishOrdered && - !isBearishOrderedPrev; - - // - bool isSwitchedToBullishState = isBullishState && - !isBullishStatePrev; - bool isSwitchedToBearishState = isBearishState && - !isBearishStatePrev; - bool isSwitchedToNeuturalState = isNeuturalState && - !isNeuturalStatePrev; - - // - conditions.isFastBullish = isFastBullish; - conditions.isFastBearish = isFastBearish; - conditions.isFastNeutural = isFastNeutural; - conditions.isMidBullish = isMidBullish; - conditions.isMidBearish = isMidBearish; - conditions.isMidNeutural = isMidNeutural; - conditions.isSlowBullish = isSlowBullish; - conditions.isSlowBearish = isSlowBearish; - conditions.isSlowNeutural = isSlowNeutural; - conditions.isFastOverMid = isFastOverMid; - conditions.isMidOverSlow = isMidOverSlow; - conditions.isFastUnderMid = isFastUnderMid; - conditions.isMidUnderSlow = isMidUnderSlow; - conditions.isBullishState = isBullishState; - conditions.isBearishState = isBearishState; - conditions.isNeuturalState = isNeuturalState; - conditions.isBullishOrdered = isBullishOrdered; - conditions.isBearishOrdered = isBearishOrdered; - conditions.isSwitchedToBullishOrdered = isSwitchedToBullishOrdered; - conditions.isSwitchedToBearishOrdered = isSwitchedToBearishOrdered; - conditions.isSwitchedToBullishState = isSwitchedToBullishState; - conditions.isSwitchedToBearishState = isSwitchedToBearishState; - conditions.isSwitchedToNeuturalState = isSwitchedToNeuturalState; - - // - return result; - } - - // - // Protected ... - protected: - // - // Private ... - private: - // - // Props ... - X3VWAPInputs mInputs; // Inputs ... - - // - // Buffers ... - double fastBuffer[]; - double fastStateBuffer[]; - double midBuffer[]; - double midStateBuffer[]; - double slowBuffer[]; - double slowStateBuffer[]; - - // - // Tools ... - - // - // Calculate Values Until Now ... - void Calculate() - { - // - int totalBars = CountBars(); - if (totalBars > 1000) - { - totalBars = 1000; - } - - // - // Fast ... - CopyBuffer( - mHandler, - X3VWAP_FAST_LINE, - 0, - totalBars, - fastBuffer - // - ); - CopyBuffer( - mHandler, - X3VWAP_FAST_STATE_LINE, - 0, - totalBars, - fastStateBuffer - // - ); - - // - // Mid ... - CopyBuffer( - mHandler, - X3VWAP_MID_LINE, - 0, - totalBars, - midBuffer - // - ); - CopyBuffer( - mHandler, - X3VWAP_MID_STATE_LINE, - 0, - totalBars, - midStateBuffer - // - ); - - // - // Slow ... - CopyBuffer( - mHandler, - X3VWAP_SLOW_LINE, - 0, - totalBars, - slowBuffer - // - ); - CopyBuffer( - mHandler, - X3VWAP_SLOW_STATE_LINE, - 0, - totalBars, - slowStateBuffer - // - ); - } -}; - -// \ No newline at end of file diff --git a/Helpers/x-saherelm.xchsar.helper.mq5 b/Helpers/x-saherelm.xchsar.helper.mq5 deleted file mode 100644 index de0a620b..00000000 --- a/Helpers/x-saherelm.xchsar.helper.mq5 +++ /dev/null @@ -1,1267 +0,0 @@ -/////////////////////////////////////////////////////// -// -// SaherElm IT Center MQL5 Helper Class Library -// ---------------------------------------------- -// Name: XCXCHSARHelper -// 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 ... - -// -enum ENUM_XCHSAR_BUFFERS -{ - // - // Current ... - XCHSAR_C_LINE = 0, - // - // Short ... - XCHSAR_S_LINE = 1, - // - // Medium ... - XCHSAR_M_LINE = 2, - // - // Long ... - XCHSAR_L_LINE = 3, - // - // Hind ... - XCHSAR_H_LINE = 4, -}; - -// -// Input Models ... -struct XCHSARInputs -{ - // - // Props ... - - // - // Market ... - double sarStep; // Step - double sarMax; // Maximum - - // - // 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 ... - - // - int cArrowCode; // Current Cycle Arrow Code - int sArrowCode; // Short Cycle Arrow Code - int mArrowCode; // Medium Cycle Arrow Code - int lArrowCode; // Long Cycle Arrow Code - int hArrowCode; // Hind Cycle Arrow Code - - // - 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) ... - XCHSARInputs() - { - // - Clean(); - } - - // - // Tools ... - - // - // Clean ... - void Clean() - { - // - sarStep = 0.02; - sarMax = 0.2; - - // - scMethod = X_PERIOD_AUTO; - scPeriod = NULL; - mcMethod = X_PERIOD_AUTO; - mcPeriod = NULL; - lcMethod = X_PERIOD_AUTO; - lcPeriod = NULL; - hcMethod = X_PERIOD_AUTO; - hcPeriod = NULL; - - // - cArrowCode = 255; - sArrowCode = 255; - mArrowCode = 255; - lArrowCode = 255; - hArrowCode = 255; - - // - showCurrent = true; - showShort = true; - showMedium = true; - showLong = true; - showHind = true; - } - - // - // Default ... - void Default() - { - // - sarStep = 0.02; - sarMax = 0.2; - - // - scMethod = X_PERIOD_AUTO; - scPeriod = NULL; - mcMethod = X_PERIOD_AUTO; - mcPeriod = NULL; - lcMethod = X_PERIOD_AUTO; - lcPeriod = NULL; - hcMethod = X_PERIOD_AUTO; - hcPeriod = NULL; - - // - cArrowCode = 255; - sArrowCode = 255; - mArrowCode = 255; - lArrowCode = 255; - hArrowCode = 255; - - // - showCurrent = true; - showShort = true; - showMedium = true; - showLong = true; - showHind = true; - } - - // - // Validate ... - bool IsValid() - { - // - bool result = false; - - // - result = - // - sarStep > 0 && - sarMax > sarStep && - // - (IsValid(scMethod, scPeriod) && - IsValid(mcMethod, mcPeriod) && - IsValid(lcMethod, lcPeriod) && - IsValid(hcMethod, hcPeriod)) - // - ; - - // - return result; - } - - // - // Retrieve MAx Length ... - int Max() - { - // - int result = 0; - - // - return result; - } -}; - -// -// Define Conditions ... -struct XCHSARConditions -{ - // - // Common ... - string symbol; - ENUM_TIMEFRAMES period; - datetime time; - - // - // Buffers ... - - // - double cSars[]; - double sSars[]; - double mSars[]; - double lSars[]; - double hSars[]; - - // - // Conditions ... - - // - // Current ... - - // - bool isCBullish; - bool isCBearish; - - // - bool isCSwitchedBullish; - bool isCSwitchedBearish; - - // - // Short ... - - // - bool isSBullish; - bool isSBearish; - - // - bool isSSwitchedBullish; - bool isSSwitchedBearish; - - // - // Medium ... - - // - bool isMBullish; - bool isMBearish; - - // - bool isMSwitchedBullish; - bool isMSwitchedBearish; - - // - // Long ... - - // - bool isLBullish; - bool isLBearish; - - // - bool isLSwitchedBullish; - bool isLSwitchedBearish; - - // - // Hind ... - - // - bool isHBullish; - bool isHBearish; - - // - bool isHSwitchedBullish; - bool isHSwitchedBearish; - - // - void Clean() - { - // - Clean(cSars); - Clean(sSars); - Clean(mSars); - Clean(lSars); - Clean(hSars); - - // - ArraySetAsSeries(cSars, true); - ArraySetAsSeries(sSars, true); - ArraySetAsSeries(mSars, true); - ArraySetAsSeries(lSars, true); - ArraySetAsSeries(hSars, true); - - // - isCBullish = false; - isCBearish = false; - isCSwitchedBullish = false; - isCSwitchedBearish = false; - isSBullish = false; - isSBearish = false; - isSSwitchedBullish = false; - isSSwitchedBearish = false; - isMBullish = false; - isMBearish = false; - isMSwitchedBullish = false; - isMSwitchedBearish = false; - isLBullish = false; - isLBearish = false; - isLSwitchedBullish = false; - isLSwitchedBearish = false; - isHBullish = false; - isHBearish = false; - isHSwitchedBullish = false; - isHSwitchedBearish = false; - } - - // - void GenerateScore( - double &bullishScore, - double &bearishScore // - ) - { - // - bullishScore = 0; - bearishScore = 0; - - // - // Current ... - if (isCBullish) - { - bullishScore++; - } - if (isCSwitchedBullish) - { - bullishScore++; - } - if (isCBearish) - { - bearishScore++; - } - if (isCSwitchedBearish) - { - bearishScore++; - } - - // - // Short ... - if (isSBullish) - { - bullishScore++; - } - if (isSSwitchedBullish) - { - bullishScore++; - } - if (isSBearish) - { - bearishScore++; - } - if (isSSwitchedBearish) - { - bearishScore++; - } - - // - // Medium ... - if (isMBullish) - { - bullishScore++; - } - if (isMSwitchedBullish) - { - bullishScore++; - } - if (isMBearish) - { - bearishScore++; - } - if (isMSwitchedBearish) - { - bearishScore++; - } - - // - // Long ... - if (isLBullish) - { - bullishScore++; - } - if (isLSwitchedBullish) - { - bullishScore++; - } - if (isLBearish) - { - bearishScore++; - } - if (isLSwitchedBearish) - { - bearishScore++; - } - - // - // Hind ... - if (isHBullish) - { - bullishScore++; - } - if (isHSwitchedBullish) - { - bullishScore++; - } - if (isHBearish) - { - bearishScore++; - } - if (isHSwitchedBearish) - { - 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 = - // - // Current ... - ToString("isCBullish", isCBullish, ignoreFalseConditions, separator) + - ToString("isCBearish", isCBearish, ignoreFalseConditions, separator) + - ToString("isCSwitchedBullish", isCSwitchedBullish, ignoreFalseConditions, separator) + - ToString("isCSwitchedBearish", isCSwitchedBearish, ignoreFalseConditions, separator) + - // - // Short ... - ToString("isSBullish", isSBullish, ignoreFalseConditions, separator) + - ToString("isSBearish", isSBearish, ignoreFalseConditions, separator) + - ToString("isSSwitchedBullish", isSSwitchedBullish, ignoreFalseConditions, separator) + - ToString("isSSwitchedBearish", isSSwitchedBearish, ignoreFalseConditions, separator) + - // - // Medium ... - ToString("isMBullish", isMBullish, ignoreFalseConditions, separator) + - ToString("isMBearish", isMBearish, ignoreFalseConditions, separator) + - ToString("isMSwitchedBullish", isMSwitchedBullish, ignoreFalseConditions, separator) + - ToString("isMSwitchedBearish", isMSwitchedBearish, ignoreFalseConditions, separator) + - // - // Long ... - ToString("isLBullish", isLBullish, ignoreFalseConditions, separator) + - ToString("isLBearish", isLBearish, ignoreFalseConditions, separator) + - ToString("isLSwitchedBullish", isLSwitchedBullish, ignoreFalseConditions, separator) + - ToString("isLSwitchedBearish", isLSwitchedBearish, ignoreFalseConditions, separator) + - // - // Hind ... - ToString("isHBullish", isHBullish, ignoreFalseConditions, separator) + - ToString("isHBearish", isHBearish, ignoreFalseConditions, separator) + - ToString("isHSwitchedBullish", isHSwitchedBullish, ignoreFalseConditions, separator) + - ToString("isHSwitchedBearish", isHSwitchedBearish, ignoreFalseConditions, separator) + - // - "" - // - ; - - // - result = - // - "[" + GetTag() + "]" + separator + - (onlyConditions - ? "" - : commonStr) + - (!includeScores - ? "" - : scoresStr) + - " " + separator + - (onlyCommons - ? "" - : conditionsStr) + - "" - // - ; - - // - return result; - } - - // - string GetTag() - { - return "XCHSAR"; - } -}; - -// -// Class ... -class XCXCHSARHelper : public XCBaseHelper -{ - // - // Public ... - public: - // - // Props ... - - // - // Constructors ... - XCXCHSARHelper() - : XCBaseHelper(_Symbol, _Period) - { - } - - // - // Deconstructor ... - ~XCXCHSARHelper() - { - } - - // - // Tools ... - bool Init( - string symbol, // Trading Symbol - ENUM_TIMEFRAMES period, // Trading Period - XCHSARInputs &inputs // Inputs - ) - { - // - bool result = false; - - // - mSymbol = symbol; - mPeriod = period; - - // - result = inputs.IsValid(); - if (!result) - { - return result; - } - - // - mInputs = inputs; - - // - ArraySetAsSeries(cBuffer, true); - ArraySetAsSeries(sBuffer, true); - ArraySetAsSeries(mBuffer, true); - ArraySetAsSeries(lBuffer, true); - ArraySetAsSeries(hBuffer, true); - - // - mHandler = iCustom( - mSymbol, - mPeriod, - "x-saherelm.xchsar", - // - // Inputs ... - // - // Market ... - "", - mInputs.sarStep, - mInputs.sarMax, - // - // Cycles ... - "", - // - // Short ... - "", - mInputs.scMethod, - mInputs.scPeriod, - // - // Medium ... - "", - mInputs.mcMethod, - mInputs.mcPeriod, - // - // Long ... - "", - mInputs.lcMethod, - mInputs.lcPeriod, - // - // Hind ... - "", - mInputs.hcMethod, - mInputs.hcPeriod, - // - // Presentation ... - "", - mInputs.cArrowCode, - mInputs.sArrowCode, - mInputs.mArrowCode, - mInputs.lArrowCode, - mInputs.hArrowCode, - mInputs.showCurrent, - mInputs.showShort, - mInputs.showMedium, - mInputs.showLong, - mInputs.showHind - // - ); - result = mHandler != INVALID_HANDLE; - if (!result) - { - return result; - } - - // - return result; - } - - // - // Inputs ... - - // - XCHSARInputs GetInputs() - { - return mInputs; - } - - // - bool SetInputs( - XCHSARInputs &inputs // Configs - ) - { - // - return Init( - mSymbol, - mPeriod, - inputs - // - ); - } - - // - // Buffers ... - - // - // Current ... - - // - double GetC( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(cBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return cBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyC( - 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, - cBuffer, - buffer, - forceClean - // - ); - } - - // - // Short ... - - // - double GetS( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(sBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return sBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyS( - 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, - sBuffer, - buffer, - forceClean - // - ); - } - - // - // Medium ... - - // - double GetM( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(mBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return mBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyM( - 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, - mBuffer, - buffer, - forceClean - // - ); - } - - // - // Long ... - - // - double GetL( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(lBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return lBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyL( - 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, - lBuffer, - buffer, - forceClean - // - ); - } - - // - // Hind ... - - // - double GetH( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(hBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return hBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyH( - 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, - hBuffer, - buffer, - forceClean - // - ); - } - - // - bool GetConditions( - XCHSARConditions &conditions, // - int barIndex = 0, // - int loopback = 3 // - ) - { - // - bool result = true; - - // - if (loopback < 3) - { - loopback = 3; - } - - // - 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 ... - CopyC( - zIndex, - loopback, - conditions.cSars // - ); - - // - // Short ... - CopyS( - zIndex, - loopback, - conditions.sSars // - ); - - // - // Medium ... - CopyM( - zIndex, - loopback, - conditions.mSars // - ); - - // - // Long ... - CopyL( - zIndex, - loopback, - conditions.lSars // - ); - - // - // Hind ... - CopyH( - zIndex, - loopback, - conditions.hSars // - ); - - // - // Conditions ... - - // - XOHCL cBar; - result = cBar.Init( - mSymbol, - mPeriod, - cIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL pBar; - result = pBar.Init( - mSymbol, - mPeriod, - pIndex // - ); - if (!result) - { - return result; - } - double hhValue = pBar.FindHighest( - loopback, - MODE_HIGH // - ); - double llValue = pBar.FindLowest( - loopback, - MODE_LOW // - ); - - // - // Current ... - - // - bool isCBullish = conditions.cSars[cIndex] < cBar.low; - bool isCBullishPrev = conditions.cSars[pIndex] < pBar.low; - - // - bool isCBearish = conditions.cSars[cIndex] > cBar.high; - bool isCBearishPrev = conditions.cSars[pIndex] > pBar.high; - - // - bool isCSwitchedBullish = isCBullish && - !isCBullishPrev; - bool isCSwitchedBearish = isCBearish && - !isCBearishPrev; - - // - conditions.isCBullish = isCBullish; - conditions.isCBearish = isCBearish; - conditions.isCSwitchedBullish = isCSwitchedBullish; - conditions.isCSwitchedBearish = isCSwitchedBearish; - - // - // Short ... - - // - bool isSBullish = conditions.sSars[cIndex] < cBar.low; - bool isSBullishPrev = conditions.sSars[pIndex] < pBar.low; - - // - bool isSBearish = conditions.sSars[cIndex] > cBar.high; - bool isSBearishPrev = conditions.sSars[pIndex] > pBar.high; - - // - bool isSSwitchedBullish = isSBullish && - !isSBullishPrev; - bool isSSwitchedBearish = isSBearish && - !isSBearishPrev; - - // - conditions.isSBullish = isSBullish; - conditions.isSBearish = isSBearish; - conditions.isSSwitchedBullish = isSSwitchedBullish; - conditions.isSSwitchedBearish = isSSwitchedBearish; - - // - // Medium ... - - // - bool isMBullish = conditions.mSars[cIndex] < cBar.low; - bool isMBullishPrev = conditions.mSars[pIndex] < pBar.low; - - // - bool isMBearish = conditions.mSars[cIndex] > cBar.high; - bool isMBearishPrev = conditions.mSars[pIndex] > pBar.high; - - // - bool isMSwitchedBullish = isMBullish && - !isMBullishPrev; - bool isMSwitchedBearish = isMBearish && - !isMBearishPrev; - - // - conditions.isMBullish = isMBullish; - conditions.isMBearish = isMBearish; - conditions.isMSwitchedBullish = isMSwitchedBullish; - conditions.isMSwitchedBearish = isMSwitchedBearish; - - // - // Long ... - - // - bool isLBullish = conditions.lSars[cIndex] < cBar.low; - bool isLBullishPrev = conditions.lSars[pIndex] < pBar.low; - - // - bool isLBearish = conditions.lSars[cIndex] > cBar.high; - bool isLBearishPrev = conditions.lSars[pIndex] > pBar.high; - - // - bool isLSwitchedBullish = isLBullish && - !isLBullishPrev; - bool isLSwitchedBearish = isLBearish && - !isLBearishPrev; - - // - conditions.isLBullish = isLBullish; - conditions.isLBearish = isLBearish; - conditions.isLSwitchedBullish = isLSwitchedBullish; - conditions.isLSwitchedBearish = isLSwitchedBearish; - - // - // Hind ... - - // - bool isHBullish = conditions.hSars[cIndex] < cBar.low; - bool isHBullishPrev = conditions.hSars[pIndex] < pBar.low; - - // - bool isHBearish = conditions.hSars[cIndex] > cBar.high; - bool isHBearishPrev = conditions.hSars[pIndex] > pBar.high; - - // - bool isHSwitchedBullish = isHBullish && - !isHBullishPrev; - bool isHSwitchedBearish = isHBearish && - !isHBearishPrev; - - // - conditions.isHBullish = isHBullish; - conditions.isHBearish = isHBearish; - conditions.isHSwitchedBullish = isHSwitchedBullish; - conditions.isHSwitchedBearish = isHSwitchedBearish; - - // - return result; - } - - // - // Protected ... - protected: - // - // Private ... - private: - // - // Props ... - XCHSARInputs mInputs; // Inputs ... - - // - // Buffers ... - - // - double cBuffer[]; - double sBuffer[]; - double mBuffer[]; - double lBuffer[]; - double hBuffer[]; - - // - // Tools ... - - // - // Calculate Values Until Now ... - void Calculate() - { - // - int totalBars = CountBars(); - if (totalBars > 1000) - { - totalBars = 1000; - } - - // - // Current ... - CopyBuffer( - mHandler, - XCHSAR_C_LINE, - 0, - totalBars, - cBuffer - // - ); - - // - // Short ... - CopyBuffer( - mHandler, - XCHSAR_S_LINE, - 0, - totalBars, - sBuffer - // - ); - - // - // Medium ... - CopyBuffer( - mHandler, - XCHSAR_S_LINE, - 0, - totalBars, - mBuffer - // - ); - - // - // Long ... - CopyBuffer( - mHandler, - XCHSAR_S_LINE, - 0, - totalBars, - lBuffer - // - ); - - // - // Hind ... - CopyBuffer( - mHandler, - XCHSAR_S_LINE, - 0, - totalBars, - hBuffer - // - ); - } -}; - -// \ No newline at end of file diff --git a/Helpers/x-saherelm.xpv.helper.mq5 b/Helpers/x-saherelm.xpv.helper.mq5 deleted file mode 100644 index 5cad913f..00000000 --- a/Helpers/x-saherelm.xpv.helper.mq5 +++ /dev/null @@ -1,3237 +0,0 @@ -/////////////////////////////////////////////////////// -// -// SaherElm IT Center MQL5 Helper Class Library -// ---------------------------------------------- -// Name: XSCXPVHelper -// 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 ... - -// -enum ENUM_XPV_BUFFERS -{ - // - // Peaks and Vales ... - XPV_PEAKS_LINE = 0, - XPV_VALES_LINE = 1, - // - // Support and Resistances ... - XPV_RESISTANCE_LINE = 2, - XPV_SUPPORT_LINE = 4, - // - // Fibonacci ... - XPV_FIB_1_LINE = 6, - XPV_FIB_2_LINE = 8, - XPV_FIB_3_LINE = 10, - XPV_FIB_4_LINE = 12, - XPV_FIB_5_LINE = 14, - // - // Short ... - XPV_SC_HH_LINE = 16, - XPV_SC_LL_LINE = 18, - // - // Medium ... - XPV_MC_HH_LINE = 20, - XPV_MC_LL_LINE = 22, - // - // Long ... - XPV_LC_HH_LINE = 24, - XPV_LC_LL_LINE = 26, - // - // Hind ... - XPV_HC_HH_LINE = 28, - XPV_HC_LL_LINE = 30, -}; - -// -// Input Models ... -struct XPVInputs -{ - // - // Props ... - - // - // Makret 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 - - // - // Fibonacci ... - double fiboLevel1; // Fibio 1st Level - double fiboLevel2; // Fibio 2st Level - double fiboLevel3; // Fibio 3rd Level - double fiboLevel4; // Fibio 4th Level - double fiboLevel5; // Fibio 5th Level - - // - // Boundary Detection Modes ... - ENUM_SERIESMODE hhMode; // Highest High Calculation Method - ENUM_SERIESMODE llMode; // Lowest Low Calculation Method - - // - // Presentation ... - bool showPeaksAndVales; // Show Peaks and Vales - bool showLevels; // Show Levels - bool showConsolidations; // Show Consolidations - bool showFibo1Levels; // Show Fibo 1st Level - bool showFibo2Levels; // Show Fibo 2nd Level - bool showFibo3Levels; // Show Fibo 3rd Level - bool showFibo4Levels; // Show Fibo 4th Level - bool showFibo5Levels; // Show Fibo 5th Level - - // - // Constructor(s) ... - XPVInputs() - { - // - Clean(); - } - - // - // Tools ... - - // - // Clean ... - void Clean() - { - // - // Makret Cycles ... - - // - // Short ... - scMethod = X_PERIOD_NOTHING; - scPeriod = NULL; - - // - // Medium ... - mcMethod = X_PERIOD_NOTHING; - mcPeriod = NULL; - - // - // Long ... - lcMethod = X_PERIOD_NOTHING; - lcPeriod = NULL; - - // - // Hind ... - hcMethod = X_PERIOD_NOTHING; - hcPeriod = NULL; - - // - // Fibonacci ... - fiboLevel1 = 0; - fiboLevel2 = 0; - fiboLevel3 = 0; - fiboLevel4 = 0; - fiboLevel5 = 0; - - // - // Boundary Detection Modes ... - hhMode = MODE_HIGH; - llMode = MODE_LOW; - - // - // Presentation ... - showPeaksAndVales = false; - showLevels = false; - showConsolidations = false; - showFibo1Levels = false; - showFibo2Levels = false; - showFibo3Levels = false; - showFibo4Levels = false; - showFibo5Levels = false; - } - - // - // Default ... - void Default() - { - // - // Makret Cycles ... - - // - // Short ... - scMethod = X_PERIOD_AUTO; - scPeriod = NULL; - - // - // Medium ... - mcMethod = X_PERIOD_AUTO; - mcPeriod = NULL; - - // - // Long ... - lcMethod = X_PERIOD_AUTO; - lcPeriod = NULL; - - // - // Hind ... - hcMethod = X_PERIOD_AUTO; - hcPeriod = NULL; - - // - // Fibonacci ... - fiboLevel1 = 0.236; - fiboLevel2 = 0.382; - fiboLevel3 = 0.5; - fiboLevel4 = 0.618; - fiboLevel5 = 0.764; - - // - // Boundary Detection Modes ... - hhMode = MODE_HIGH; - llMode = MODE_LOW; - - // - // Presentation ... - showPeaksAndVales = true; - showLevels = false; - showConsolidations = false; - showFibo1Levels = true; - showFibo2Levels = true; - showFibo3Levels = true; - showFibo4Levels = true; - showFibo5Levels = true; - } - - // - // Validate ... - bool IsValid() - { - // - bool result = false; - - // - result = - // - IsValid(scMethod, scPeriod) && - IsValid(mcMethod, mcPeriod) && - IsValid(lcMethod, lcPeriod) && - IsValid(hcMethod, hcPeriod) - // - ; - - // - return result; - } - - // - // Retrieve MAx Length ... - int Max() - { - // - int result = 0; - - // - result = MathMax(result, 0); - - // - return result; - } -}; - -// -// Conditions ... -struct XPVConditions -{ - // - // Common ... - string symbol; - ENUM_TIMEFRAMES period; - datetime time; - - // - // Buffers ... - double peaks[]; - double vales[]; - double resistances[]; - double supports[]; - double fib1s[]; - double fib2s[]; - double fib3s[]; - double fib4s[]; - double fib5s[]; - double sCHHs[]; - double sCLLs[]; - double mCHHs[]; - double mCLLs[]; - double lCHHs[]; - double lCLLs[]; - double hCHHs[]; - double hCLLs[]; - - // - // Conditions ... - - // - bool isNewPeak; - bool isNewPeakOverLast; - bool isNewPeakUnderLast; - - // - bool isNewVale; - bool isNewValeOverLast; - bool isNewValeUnderLast; - - // - bool isFiboIncreased; - bool isFiboDecreased; - bool isFiboSectionChanged; - - // - // SC ... - - // - bool isSCBullish; - bool isSCHHBullish; - bool isSCLLBullish; - bool isSCSwitchedToBullish; - bool isSCHHSwitchedToBullish; - bool isSCLLSwitchedToBullish; - - // - bool isSCBearish; - bool isSCHHBearish; - bool isSCLLBearish; - bool isSCSwitchedToBearish; - bool isSCHHSwitchedToBearish; - bool isSCLLSwitchedToBeraish; - - // - // MC ... - - // - bool isMCBullish; - bool isMCHHBullish; - bool isMCLLBullish; - bool isMCSwitchedToBullish; - bool isMCHHSwitchedToBullish; - bool isMCLLSwitchedToBullish; - - // - bool isMCBearish; - bool isMCHHBearish; - bool isMCLLBearish; - bool isMCSwitchedToBearish; - bool isMCHHSwitchedToBearish; - bool isMCLLSwitchedToBeraish; - - // - // LC ... - - // - bool isLCBullish; - bool isLCHHBullish; - bool isLCLLBullish; - bool isLCSwitchedToBullish; - bool isLCHHSwitchedToBullish; - bool isLCLLSwitchedToBullish; - // - bool isLCBearish; - bool isLCHHBearish; - bool isLCLLBearish; - bool isLCSwitchedToBearish; - bool isLCHHSwitchedToBearish; - bool isLCLLSwitchedToBeraish; - - // - // HC ... - - // - bool isHCBullish; - bool isHCHHBullish; - bool isHCLLBullish; - bool isHCSwitchedToBullish; - bool isHCHHSwitchedToBullish; - bool isHCLLSwitchedToBullish; - - // - bool isHCBearish; - bool isHCHHBearish; - bool isHCLLBearish; - bool isHCSwitchedToBearish; - bool isHCHHSwitchedToBearish; - bool isHCLLSwitchedToBeraish; - - // - // Fibonachi Conditions ... - - // - bool isCloseOverFib1; - bool isCloseOverFib2; - bool isCloseOverFib3; - bool isCloseOverFib4; - bool isCloseOverFib5; - - // - bool isCloseUnderFib1; - bool isCloseUnderFib2; - bool isCloseUnderFib3; - bool isCloseUnderFib4; - bool isCloseUnderFib5; - - // - bool isCloseCrossedOverFib1; - bool isCloseCrossedOverFib2; - bool isCloseCrossedOverFib3; - bool isCloseCrossedOverFib4; - bool isCloseCrossedOverFib5; - - // - bool isCloseCrossedUnderFib1; - bool isCloseCrossedUnderFib2; - bool isCloseCrossedUnderFib3; - bool isCloseCrossedUnderFib4; - bool isCloseCrossedUnderFib5; - - // - void Clean() - { - // - Clean(peaks); - Clean(vales); - Clean(resistances); - Clean(supports); - Clean(fib1s); - Clean(fib2s); - Clean(fib3s); - Clean(fib4s); - Clean(fib5s); - Clean(sCHHs); - Clean(sCLLs); - Clean(mCHHs); - Clean(mCLLs); - Clean(lCHHs); - Clean(lCLLs); - Clean(hCHHs); - Clean(hCLLs); - - // - ArraySetAsSeries(peaks, true); - ArraySetAsSeries(vales, true); - ArraySetAsSeries(resistances, true); - ArraySetAsSeries(supports, true); - ArraySetAsSeries(fib1s, true); - ArraySetAsSeries(fib2s, true); - ArraySetAsSeries(fib3s, true); - ArraySetAsSeries(fib4s, true); - ArraySetAsSeries(fib5s, true); - ArraySetAsSeries(sCHHs, true); - ArraySetAsSeries(sCLLs, true); - ArraySetAsSeries(mCHHs, true); - ArraySetAsSeries(mCLLs, true); - ArraySetAsSeries(lCHHs, true); - ArraySetAsSeries(lCLLs, true); - ArraySetAsSeries(hCHHs, true); - ArraySetAsSeries(hCLLs, true); - - // - isNewPeak = false; - isNewPeakOverLast = false; - isNewPeakUnderLast = false; - isNewVale = false; - isNewValeOverLast = false; - isNewValeUnderLast = false; - isFiboIncreased = false; - isFiboDecreased = false; - isFiboSectionChanged = false; - isCloseOverFib1 = false; - isCloseOverFib2 = false; - isCloseOverFib3 = false; - isCloseOverFib4 = false; - isCloseOverFib5 = false; - isCloseUnderFib1 = false; - isCloseUnderFib2 = false; - isCloseUnderFib3 = false; - isCloseUnderFib4 = false; - isCloseUnderFib5 = false; - isCloseCrossedOverFib1 = false; - isCloseCrossedOverFib2 = false; - isCloseCrossedOverFib3 = false; - isCloseCrossedOverFib4 = false; - isCloseCrossedOverFib5 = false; - isCloseCrossedUnderFib1 = false; - isCloseCrossedUnderFib2 = false; - isCloseCrossedUnderFib3 = false; - isCloseCrossedUnderFib4 = false; - isCloseCrossedUnderFib5 = false; - isSCBullish = false; - isSCHHBullish = false; - isSCLLBullish = false; - isSCSwitchedToBullish = false; - isSCHHSwitchedToBullish = false; - isSCLLSwitchedToBullish = false; - isSCBearish = false; - isSCHHBearish = false; - isSCLLBearish = false; - isSCSwitchedToBearish = false; - isSCHHSwitchedToBearish = false; - isSCLLSwitchedToBeraish = false; - isMCBullish = false; - isMCHHBullish = false; - isMCLLBullish = false; - isMCSwitchedToBullish = false; - isMCHHSwitchedToBullish = false; - isMCLLSwitchedToBullish = false; - isMCBearish = false; - isMCHHBearish = false; - isMCLLBearish = false; - isMCSwitchedToBearish = false; - isMCHHSwitchedToBearish = false; - isMCLLSwitchedToBeraish = false; - isLCBullish = false; - isLCHHBullish = false; - isLCLLBullish = false; - isLCSwitchedToBullish = false; - isLCHHSwitchedToBullish = false; - isLCLLSwitchedToBullish = false; - isLCBearish = false; - isLCHHBearish = false; - isLCLLBearish = false; - isLCSwitchedToBearish = false; - isLCHHSwitchedToBearish = false; - isLCLLSwitchedToBeraish = false; - isHCBullish = false; - isHCHHBullish = false; - isHCLLBullish = false; - isHCSwitchedToBullish = false; - isHCHHSwitchedToBullish = false; - isHCLLSwitchedToBullish = false; - isHCBearish = false; - isHCHHBearish = false; - isHCLLBearish = false; - isHCSwitchedToBearish = false; - isHCHHSwitchedToBearish = false; - isHCLLSwitchedToBeraish = false; - } - - // - void GenerateScore( - double &bullishScore, - double &bearishScore // - ) - { - // - bullishScore = 0; - bearishScore = 0; - - // - if (isNewPeak) - { - } - if (isNewPeakOverLast) - { - } - if (isNewPeakUnderLast) - { - } - - // - if (isNewVale) - { - } - if (isNewValeOverLast) - { - } - if (isNewValeUnderLast) - { - } - - // - if (isFiboIncreased) - { - } - if (isFiboDecreased) - { - } - if (isFiboSectionChanged) - { - } - - // - if (isSCBullish) - { - bullishScore++; - } - if (isSCHHBullish) - { - bullishScore++; - } - if (isSCLLBullish) - { - bullishScore++; - } - if (isSCSwitchedToBullish) - { - bullishScore++; - } - if (isSCHHSwitchedToBullish) - { - bullishScore++; - } - if (isSCLLSwitchedToBullish) - { - bullishScore++; - } - - // - if (isSCBearish) - { - bearishScore++; - } - if (isSCHHBearish) - { - bearishScore++; - } - if (isSCLLBearish) - { - bearishScore++; - } - if (isSCSwitchedToBearish) - { - bearishScore++; - } - if (isSCHHSwitchedToBearish) - { - bearishScore++; - } - if (isSCLLSwitchedToBeraish) - { - bearishScore++; - } - - // - if (isMCBullish) - { - bullishScore++; - } - if (isMCHHBullish) - { - bullishScore++; - } - if (isMCLLBullish) - { - bullishScore++; - } - if (isMCSwitchedToBullish) - { - bullishScore++; - } - if (isMCHHSwitchedToBullish) - { - bullishScore++; - } - if (isMCLLSwitchedToBullish) - { - bullishScore++; - } - - // - if (isMCBearish) - { - bearishScore++; - } - if (isMCHHBearish) - { - bearishScore++; - } - if (isMCLLBearish) - { - bearishScore++; - } - if (isMCSwitchedToBearish) - { - bearishScore++; - } - if (isMCHHSwitchedToBearish) - { - bearishScore++; - } - if (isMCLLSwitchedToBeraish) - { - bearishScore++; - } - - // - if (isLCBullish) - { - bullishScore++; - } - if (isLCHHBullish) - { - bullishScore++; - } - if (isLCLLBullish) - { - bullishScore++; - } - if (isLCSwitchedToBullish) - { - bullishScore++; - } - if (isLCHHSwitchedToBullish) - { - bullishScore++; - } - if (isLCLLSwitchedToBullish) - { - bullishScore++; - } - - // - if (isLCBearish) - { - bearishScore++; - } - if (isLCHHBearish) - { - bearishScore++; - } - if (isLCLLBearish) - { - bearishScore++; - } - if (isLCSwitchedToBearish) - { - bearishScore++; - } - if (isLCHHSwitchedToBearish) - { - bearishScore++; - } - if (isLCLLSwitchedToBeraish) - { - bearishScore++; - } - - if (isHCBullish) - { - bullishScore++; - } - if (isHCHHBullish) - { - bullishScore++; - } - if (isHCLLBullish) - { - bullishScore++; - } - if (isHCSwitchedToBullish) - { - bullishScore++; - } - if (isHCHHSwitchedToBullish) - { - bullishScore++; - } - if (isHCLLSwitchedToBullish) - { - bullishScore++; - } - - // - if (isHCBearish) - { - bearishScore++; - } - if (isHCHHBearish) - { - bearishScore++; - } - if (isHCLLBearish) - { - bearishScore++; - } - if (isHCSwitchedToBearish) - { - bearishScore++; - } - if (isHCHHSwitchedToBearish) - { - bearishScore++; - } - if (isHCLLSwitchedToBeraish) - { - 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 = - // - ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) + - ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) + - ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) + - ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) + - ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) + - ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) + - ToString("isFiboIncreased", isFiboIncreased, ignoreFalseConditions, separator) + - ToString("isFiboDecreased", isFiboDecreased, ignoreFalseConditions, separator) + - ToString("isFiboSectionChanged", isFiboSectionChanged, ignoreFalseConditions, separator) + - ToString("isCloseOverFib1", isCloseOverFib1, ignoreFalseConditions, separator) + - ToString("isCloseOverFib2", isCloseOverFib2, ignoreFalseConditions, separator) + - ToString("isCloseOverFib3", isCloseOverFib3, ignoreFalseConditions, separator) + - ToString("isCloseOverFib4", isCloseOverFib4, ignoreFalseConditions, separator) + - ToString("isCloseOverFib5", isCloseOverFib5, ignoreFalseConditions, separator) + - ToString("isCloseUnderFib1", isCloseUnderFib1, ignoreFalseConditions, separator) + - ToString("isCloseUnderFib2", isCloseUnderFib2, ignoreFalseConditions, separator) + - ToString("isCloseUnderFib3", isCloseUnderFib3, ignoreFalseConditions, separator) + - ToString("isCloseUnderFib4", isCloseUnderFib4, ignoreFalseConditions, separator) + - ToString("isCloseUnderFib5", isCloseUnderFib5, ignoreFalseConditions, separator) + - ToString("isCloseCrossedOverFib1", isCloseCrossedOverFib1, ignoreFalseConditions, separator) + - ToString("isCloseCrossedOverFib2", isCloseCrossedOverFib2, ignoreFalseConditions, separator) + - ToString("isCloseCrossedOverFib3", isCloseCrossedOverFib3, ignoreFalseConditions, separator) + - ToString("isCloseCrossedOverFib4", isCloseCrossedOverFib4, ignoreFalseConditions, separator) + - ToString("isCloseCrossedOverFib5", isCloseCrossedOverFib5, ignoreFalseConditions, separator) + - ToString("isCloseCrossedUnderFib1", isCloseCrossedUnderFib1, ignoreFalseConditions, separator) + - ToString("isCloseCrossedUnderFib2", isCloseCrossedUnderFib2, ignoreFalseConditions, separator) + - ToString("isCloseCrossedUnderFib3", isCloseCrossedUnderFib3, ignoreFalseConditions, separator) + - ToString("isCloseCrossedUnderFib4", isCloseCrossedUnderFib4, ignoreFalseConditions, separator) + - ToString("isCloseCrossedUnderFib5", isCloseCrossedUnderFib5, ignoreFalseConditions, separator) + - ToString("isSCBullish", isSCBullish, ignoreFalseConditions, separator) + - ToString("isSCHHBullish", isSCHHBullish, ignoreFalseConditions, separator) + - ToString("isSCLLBullish", isSCLLBullish, ignoreFalseConditions, separator) + - ToString("isSCSwitchedToBullish", isSCSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isSCHHSwitchedToBullish", isSCHHSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isSCLLSwitchedToBullish", isSCLLSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isSCBearish", isSCBearish, ignoreFalseConditions, separator) + - ToString("isSCHHBearish", isSCHHBearish, ignoreFalseConditions, separator) + - ToString("isSCLLBearish", isSCLLBearish, ignoreFalseConditions, separator) + - ToString("isSCSwitchedToBearish", isSCSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isSCHHSwitchedToBearish", isSCHHSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isSCLLSwitchedToBeraish", isSCLLSwitchedToBeraish, ignoreFalseConditions, separator) + - ToString("isMCBullish", isMCBullish, ignoreFalseConditions, separator) + - ToString("isMCHHBullish", isMCHHBullish, ignoreFalseConditions, separator) + - ToString("isMCLLBullish", isMCLLBullish, ignoreFalseConditions, separator) + - ToString("isMCSwitchedToBullish", isMCSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isMCHHSwitchedToBullish", isMCHHSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isMCLLSwitchedToBullish", isMCLLSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isMCBearish", isMCBearish, ignoreFalseConditions, separator) + - ToString("isMCHHBearish", isMCHHBearish, ignoreFalseConditions, separator) + - ToString("isMCLLBearish", isMCLLBearish, ignoreFalseConditions, separator) + - ToString("isMCSwitchedToBearish", isMCSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isMCHHSwitchedToBearish", isMCHHSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isMCLLSwitchedToBeraish", isMCLLSwitchedToBeraish, ignoreFalseConditions, separator) + - ToString("isLCBullish", isLCBullish, ignoreFalseConditions, separator) + - ToString("isLCHHBullish", isLCHHBullish, ignoreFalseConditions, separator) + - ToString("isLCLLBullish", isLCLLBullish, ignoreFalseConditions, separator) + - ToString("isLCSwitchedToBullish", isLCSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isLCHHSwitchedToBullish", isLCHHSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isLCLLSwitchedToBullish", isLCLLSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isLCBearish", isLCBearish, ignoreFalseConditions, separator) + - ToString("isLCHHBearish", isLCHHBearish, ignoreFalseConditions, separator) + - ToString("isLCLLBearish", isLCLLBearish, ignoreFalseConditions, separator) + - ToString("isLCSwitchedToBearish", isLCSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isLCHHSwitchedToBearish", isLCHHSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isLCLLSwitchedToBeraish", isLCLLSwitchedToBeraish, ignoreFalseConditions, separator) + - ToString("isHCBullish", isHCBullish, ignoreFalseConditions, separator) + - ToString("isHCHHBullish", isHCHHBullish, ignoreFalseConditions, separator) + - ToString("isHCLLBullish", isHCLLBullish, ignoreFalseConditions, separator) + - ToString("isHCSwitchedToBullish", isHCSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isHCHHSwitchedToBullish", isHCHHSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isHCLLSwitchedToBullish", isHCLLSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isHCBearish", isHCBearish, ignoreFalseConditions, separator) + - ToString("isHCHHBearish", isHCHHBearish, ignoreFalseConditions, separator) + - ToString("isHCLLBearish", isHCLLBearish, ignoreFalseConditions, separator) + - ToString("isHCSwitchedToBearish", isHCSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isHCHHSwitchedToBearish", isHCHHSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isHCLLSwitchedToBeraish", isHCLLSwitchedToBeraish, ignoreFalseConditions, separator) + - // - "" - // - ; - - // - result = - // - "[" + GetTag() + "]" + separator + - (onlyConditions - ? "" - : commonStr) + - (!includeScores - ? "" - : scoresStr) + - " " + separator + - (onlyCommons - ? "" - : conditionsStr) + - "" - // - ; - - // - return result; - } - - // - string GetTag() - { - return "XPV"; - } -}; - -// -// Class ... -class XCXPVHelper : public XCBaseHelper -{ - // - // Public ... -public: - // - // Props ... - - // - // Constructors ... - XCXPVHelper() : XCBaseHelper(_Symbol, _Period) - { - } - - // - // Deconstructor ... - ~XCXPVHelper() - { - // - Clean(fib1Buffer); - Clean(fib2Buffer); - Clean(fib3Buffer); - Clean(fib4Buffer); - Clean(fib5Buffer); - Clean(scHHBuffer); - Clean(scLLBuffer); - Clean(mcHHBuffer); - Clean(mcLLBuffer); - Clean(lcHHBuffer); - Clean(lcLLBuffer); - Clean(hcHHBuffer); - Clean(hcLLBuffer); - Clean(peaksBuffer); - Clean(valesBuffer); - Clean(supportBuffer); - Clean(resistanceBuffer); - } - - // - // Tools ... - bool Init( - string symbol, // Trading Symbol - ENUM_TIMEFRAMES period, // Trading Period - XPVInputs &inputs // Inputs - ) - { - // - bool result = false; - - // - mSymbol = symbol; - mPeriod = period; - - // - result = inputs.IsValid(); - if (!result) - { - return result; - } - - // - mInputs = inputs; - - // - ArraySetAsSeries(peaksBuffer, true); - ArraySetAsSeries(valesBuffer, true); - ArraySetAsSeries(resistanceBuffer, true); - ArraySetAsSeries(supportBuffer, true); - ArraySetAsSeries(fib1Buffer, true); - ArraySetAsSeries(fib2Buffer, true); - ArraySetAsSeries(fib3Buffer, true); - ArraySetAsSeries(fib4Buffer, true); - ArraySetAsSeries(fib5Buffer, true); - ArraySetAsSeries(scHHBuffer, true); - ArraySetAsSeries(scLLBuffer, true); - ArraySetAsSeries(mcHHBuffer, true); - ArraySetAsSeries(mcLLBuffer, true); - ArraySetAsSeries(lcHHBuffer, true); - ArraySetAsSeries(lcLLBuffer, true); - ArraySetAsSeries(hcHHBuffer, true); - ArraySetAsSeries(hcLLBuffer, true); - - // - mHandler = iCustom( - mSymbol, - mPeriod, - "x-saherelm.xpv", - // - // Inputs ... - // - // Makret Cycles ... - "", - // - // Short ... - "", - mInputs.scMethod, // How to Find Period - mInputs.scPeriod, // Time Period - // - // Medium ... - "", - mInputs.mcMethod, // How to Find Period - mInputs.mcPeriod, // Time Period - // - // Long ... - "", - mInputs.lcMethod, // How to Find Period - mInputs.lcPeriod, // Time Period - // - // Hind ... - "", - mInputs.hcMethod, // How to Find Period - mInputs.hcPeriod, // Time Period - // - // Fibonacci ... - "", - mInputs.fiboLevel1, // Fibio 1st Level - mInputs.fiboLevel2, // Fibio 2st Level - mInputs.fiboLevel3, // Fibio 3rd Level - mInputs.fiboLevel4, // Fibio 4th Level - mInputs.fiboLevel5, // Fibio 5th Level - // - // Boundary Detection Modes ... - "", - mInputs.hhMode, // Highest High Calculation Method - mInputs.llMode, // Lowest Low Calculation Method - // - // Presentation ... - "", - mInputs.showPeaksAndVales, // Show Peaks and Vales - mInputs.showLevels, // Show Levels - mInputs.showConsolidations, // Show Consolidations - mInputs.showFibo1Levels, // Show Fibo 1st Level - mInputs.showFibo2Levels, // Show Fibo 2nd Level - mInputs.showFibo3Levels, // Show Fibo 3rd Level - mInputs.showFibo4Levels, // Show Fibo 4th Level - mInputs.showFibo5Levels // Show Fibo 5th Level - // - ); - result = mHandler != INVALID_HANDLE; - if (!result) - { - return result; - } - - // - return result; - } - - // - // Inputs ... - - // - XPVInputs GetInputs() - { - return mInputs; - } - - // - bool SetInputs( - XPVInputs &inputs // Configs - ) - { - // - return Init( - mSymbol, - mPeriod, - inputs - // - ); - } - - // - // Buffers ... - - // - // Peaks ... - - // - double GetPeak( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(peaksBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return peaksBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyPeak( - 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, - peaksBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSamePeak( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - peaksBuffer, - verifier, - barIndex // - ); - } - - // - // Vales ... - - // - double GetVale( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(valesBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return valesBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyVale( - 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, - valesBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameVale( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - valesBuffer, - verifier, - barIndex // - ); - } - - // - // Resistance ... - - // - double GetResistance( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(resistanceBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return resistanceBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyResistance( - 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, - resistanceBuffer, - buffer, - forceClean - // - ); - } - - // - // Support ... - - // - double GetSupport( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(supportBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return supportBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopySupport( - 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, - supportBuffer, - buffer, - forceClean - // - ); - } - - // - // Fibonacci ... - - // - // Level 1 ... - - // - double GetFib1( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(fib1Buffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return fib1Buffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyFib1( - 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, - fib1Buffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameFib1( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - fib1Buffer, - verifier, - barIndex // - ); - } - - // - // Level 2 ... - - // - double GetFib2( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(fib2Buffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return fib2Buffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyFib2( - 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, - fib2Buffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameFib2( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - fib2Buffer, - verifier, - barIndex // - ); - } - - // - // Level 3 ... - - // - double GetFib3( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(fib3Buffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return fib3Buffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyFib3( - 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, - fib3Buffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameFib3( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - fib3Buffer, - verifier, - barIndex // - ); - } - - // - // Level 4 ... - - // - double GetFib4( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(fib4Buffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return fib4Buffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyFib4( - 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, - fib4Buffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameFib4( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - fib4Buffer, - verifier, - barIndex // - ); - } - - // - // Level 5 ... - - // - double GetFib5( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(fib5Buffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return fib5Buffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyFib5( - 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, - fib5Buffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameFib5( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - fib5Buffer, - verifier, - barIndex // - ); - } - - // - // Cycles ... - - // - // Short ... - - // - // HH ... - - // - double GetSCHH( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(scHHBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return scHHBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopySCHH( - 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, - scHHBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameSCHH( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - scHHBuffer, - verifier, - barIndex // - ); - } - - // - // LL ... - - // - double GetSCLL( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(scLLBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return scLLBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopySCLL( - 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, - scLLBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameSCLL( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - scLLBuffer, - verifier, - barIndex // - ); - } - - // - // Medium ... - - // - // HH ... - - // - double GetMCHH( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(mcHHBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return mcHHBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyMCHH( - 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, - mcHHBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameMCHH( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - mcHHBuffer, - verifier, - barIndex // - ); - } - - // - // LL ... - - // - double GetMCLL( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(mcLLBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return mcLLBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyMCLL( - 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, - mcLLBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameMCLL( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - mcLLBuffer, - verifier, - barIndex // - ); - } - - // - // Long ... - - // - // HH ... - - // - double GetLCHH( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(lcHHBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return lcHHBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyLCHH( - 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, - lcHHBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameLCHH( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - lcHHBuffer, - verifier, - barIndex // - ); - } - - // - // LL ... - - // - double GetLCLL( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(lcLLBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return lcLLBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyLCLL( - 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, - lcLLBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameLCLL( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - lcLLBuffer, - verifier, - barIndex // - ); - } - - // - // Hind ... - - // - // HH ... - - // - double GetHCHH( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(hcHHBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return hcHHBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyHCHH( - 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, - hcHHBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameHCHH( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - hcHHBuffer, - verifier, - barIndex // - ); - } - - // - // LL ... - - // - double GetHCLL( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(hcLLBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return hcLLBuffer[barIndex]; - } - - // - // Copy Required Items ... - int CopyHCLL( - 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, - hcLLBuffer, - buffer, - forceClean - // - ); - } - - // - bool IsSameHCLL( - int barIndex, // Start Bar Index - int verifier = 71 // Number of Verifiers - ) - { - // - // Update Calculations ... - Calculate(); - - // - return IsSame( - hcLLBuffer, - verifier, - barIndex // - ); - } - - // - bool GetConditions( - XPVConditions &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 ... - - // - CopyPeak( - zIndex, - loopback, - conditions.peaks // - ); - - // - CopyVale( - zIndex, - loopback, - conditions.vales // - ); - - // - CopySupport( - zIndex, - loopback, - conditions.supports // - ); - - // - CopyResistance( - zIndex, - loopback, - conditions.resistances // - ); - - // - CopyFib1( - zIndex, - loopback, - conditions.fib1s // - ); - - // - CopyFib2( - zIndex, - loopback, - conditions.fib2s // - ); - - // - CopyFib3( - zIndex, - loopback, - conditions.fib3s // - ); - - // - CopyFib4( - zIndex, - loopback, - conditions.fib4s // - ); - - // - CopyFib5( - zIndex, - loopback, - conditions.fib5s // - ); - - // - CopySCHH( - zIndex, - loopback, - conditions.sCHHs // - ); - - // - CopySCLL( - zIndex, - loopback, - conditions.sCLLs // - ); - - // - CopyMCHH( - zIndex, - loopback, - conditions.mCHHs // - ); - - // - CopyMCLL( - zIndex, - loopback, - conditions.mCLLs // - ); - - // - CopyLCHH( - zIndex, - loopback, - conditions.lCHHs // - ); - - // - CopyLCLL( - zIndex, - loopback, - conditions.lCLLs // - ); - - // - CopyHCHH( - zIndex, - loopback, - conditions.hCHHs // - ); - - // - CopyHCLL( - zIndex, - loopback, - conditions.hCLLs // - ); - - // - // Conditions ... - - // - bool isNewPeak = conditions.peaks[cIndex] != conditions.peaks[pIndex]; - bool isNewPeakOverLast = isNewPeak && - conditions.peaks[cIndex] > conditions.peaks[pIndex]; - bool isNewPeakUnderLast = isNewPeak && - conditions.peaks[cIndex] < conditions.peaks[pIndex]; - - // - bool isNewVale = conditions.vales[cIndex] != conditions.vales[pIndex]; - bool isNewValeOverLast = isNewVale && - conditions.vales[cIndex] > conditions.vales[pIndex]; - bool isNewValeUnderLast = isNewVale && - conditions.vales[cIndex] < conditions.vales[pIndex]; - - // - bool isFiboIncreased = - // - conditions.fib1s[cIndex] > conditions.fib1s[pIndex] && - conditions.fib2s[cIndex] > conditions.fib2s[pIndex] && - conditions.fib3s[cIndex] > conditions.fib3s[pIndex] && - conditions.fib4s[cIndex] > conditions.fib4s[pIndex] && - conditions.fib5s[cIndex] > conditions.fib5s[pIndex] - // - ; - bool isFiboDecreased = - // - conditions.fib1s[cIndex] < conditions.fib1s[pIndex] && - conditions.fib2s[cIndex] < conditions.fib2s[pIndex] && - conditions.fib3s[cIndex] < conditions.fib3s[pIndex] && - conditions.fib4s[cIndex] < conditions.fib4s[pIndex] && - conditions.fib5s[cIndex] < conditions.fib5s[pIndex] - // - ; - bool isFiboSectionChanged = - // - (isFiboDecreased && - isNewPeakUnderLast) - // - || - // - (isFiboIncreased && - isNewValeOverLast) - // - ; - - // - // SC ... - - // - bool isSCHHBullish = conditions.sCHHs[cIndex] > conditions.sCHHs[pIndex]; - bool isSCLLBullish = conditions.sCLLs[cIndex] > conditions.sCLLs[pIndex]; - - // - bool isSCHHBullishPrev = conditions.sCHHs[pIndex] > conditions.sCHHs[ppIndex]; - bool isSCLLBullishPrev = conditions.sCLLs[pIndex] > conditions.sCLLs[ppIndex]; - - // - bool isSCBullish = isSCHHBullish && - isSCLLBullish; - - // - bool isSCBullishPrev = isSCHHBullishPrev && - isSCLLBullishPrev; - - // - bool isSCHHSwitchedToBullish = isSCHHBullish && - !isSCHHBullishPrev; - bool isSCLLSwitchedToBullish = isSCLLBullish && - !isSCLLBullishPrev; - - // - bool isSCHHBearish = conditions.sCHHs[cIndex] < conditions.sCHHs[pIndex]; - bool isSCLLBearish = conditions.sCLLs[cIndex] < conditions.sCLLs[pIndex]; - - // - bool isSCHHBearishPrev = conditions.sCHHs[pIndex] < conditions.sCHHs[ppIndex]; - bool isSCLLBearishPrev = conditions.sCLLs[pIndex] < conditions.sCLLs[ppIndex]; - - // - bool isSCBearish = isSCHHBearish && - isSCLLBearish; - - // - bool isSCBearishPrev = isSCHHBearishPrev && - isSCLLBearishPrev; - - // - bool isSCHHSwitchedToBearish = isSCHHBearish && - !isSCHHBearishPrev; - bool isSCLLSwitchedToBeraish = isSCLLBearish && - !isSCLLBearishPrev; - - // - bool isSCSwitchedToBullish = - // - (isSCHHSwitchedToBullish && - !isSCLLBearish) - // - || - // - (isSCLLSwitchedToBullish && - !isSCHHBearish) - // - ; - - // - bool isSCSwitchedToBearish = - // - (isSCHHSwitchedToBearish && - !isSCLLBullish) - // - || - // - (isSCLLSwitchedToBeraish && - !isSCHHBullish) - // - ; - - // - // MC ... - - // - bool isMCHHBullish = conditions.mCHHs[cIndex] > conditions.mCHHs[pIndex]; - bool isMCLLBullish = conditions.mCLLs[cIndex] > conditions.mCLLs[pIndex]; - - // - bool isMCHHBullishPrev = conditions.mCHHs[pIndex] > conditions.mCHHs[ppIndex]; - bool isMCLLBullishPrev = conditions.mCLLs[pIndex] > conditions.mCLLs[ppIndex]; - - // - bool isMCBullish = isMCHHBullish && - isMCLLBullish; - - // - bool isMCBullishPrev = isMCHHBullishPrev && - isMCLLBullishPrev; - - // - bool isMCHHSwitchedToBullish = isMCHHBullish && - !isMCHHBullishPrev; - bool isMCLLSwitchedToBullish = isMCLLBullish && - !isMCLLBullishPrev; - - // - bool isMCHHBearish = conditions.mCHHs[cIndex] < conditions.mCHHs[pIndex]; - bool isMCLLBearish = conditions.mCLLs[cIndex] < conditions.mCLLs[pIndex]; - - // - bool isMCHHBearishPrev = conditions.mCHHs[pIndex] < conditions.mCHHs[ppIndex]; - bool isMCLLBearishPrev = conditions.mCLLs[pIndex] < conditions.mCLLs[ppIndex]; - - // - bool isMCBearish = isMCHHBearish && - isMCLLBearish; - - // - bool isMCBearishPrev = isMCHHBearishPrev && - isMCLLBearishPrev; - - // - bool isMCHHSwitchedToBearish = isMCHHBearish && - !isMCHHBearishPrev; - bool isMCLLSwitchedToBeraish = isMCLLBearish && - !isMCLLBearishPrev; - - // - bool isMCSwitchedToBullish = - // - (isMCHHSwitchedToBullish && - !isMCLLBearish) - // - || - // - (isMCLLSwitchedToBullish && - !isMCHHBearish) - // - ; - - // - bool isMCSwitchedToBearish = - // - (isMCHHSwitchedToBearish && - !isMCLLBullish) - // - || - // - (isMCLLSwitchedToBeraish && - !isMCHHBullish) - // - ; - - // - // LC ... - - // - bool isLCHHBullish = conditions.lCHHs[cIndex] > conditions.lCHHs[pIndex]; - bool isLCLLBullish = conditions.lCLLs[cIndex] > conditions.lCLLs[pIndex]; - - // - bool isLCHHBullishPrev = conditions.lCHHs[pIndex] > conditions.lCHHs[ppIndex]; - bool isLCLLBullishPrev = conditions.lCLLs[pIndex] > conditions.lCLLs[ppIndex]; - - // - bool isLCBullish = isLCHHBullish && - isLCLLBullish; - - // - bool isLCBullishPrev = isLCHHBullishPrev && - isLCLLBullishPrev; - - // - bool isLCHHSwitchedToBullish = isLCHHBullish && - !isLCHHBullishPrev; - bool isLCLLSwitchedToBullish = isLCLLBullish && - !isLCLLBullishPrev; - - // - bool isLCHHBearish = conditions.lCHHs[cIndex] < conditions.lCHHs[pIndex]; - bool isLCLLBearish = conditions.lCLLs[cIndex] < conditions.lCLLs[pIndex]; - - // - bool isLCHHBearishPrev = conditions.lCHHs[pIndex] < conditions.lCHHs[ppIndex]; - bool isLCLLBearishPrev = conditions.lCLLs[pIndex] < conditions.lCLLs[ppIndex]; - - // - bool isLCBearish = isLCHHBearish && - isLCLLBearish; - - // - bool isLCBearishPrev = isLCHHBearishPrev && - isLCLLBearishPrev; - - // - bool isLCHHSwitchedToBearish = isLCHHBearish && - !isLCHHBearishPrev; - bool isLCLLSwitchedToBeraish = isLCLLBearish && - !isLCLLBearishPrev; - - // - bool isLCSwitchedToBullish = - // - (isLCHHSwitchedToBullish && - !isLCLLBearish) - // - || - // - (isLCLLSwitchedToBullish && - !isLCHHBearish) - // - ; - - // - bool isLCSwitchedToBearish = - // - (isLCHHSwitchedToBearish && - !isLCLLBullish) - // - || - // - (isLCLLSwitchedToBeraish && - !isLCHHBullish) - // - ; - - // - // HC ... - - // - bool isHCHHBullish = conditions.hCHHs[cIndex] > conditions.hCHHs[pIndex]; - bool isHCLLBullish = conditions.hCLLs[cIndex] > conditions.hCLLs[pIndex]; - - // - bool isHCHHBullishPrev = conditions.hCHHs[pIndex] > conditions.hCHHs[ppIndex]; - bool isHCLLBullishPrev = conditions.hCLLs[pIndex] > conditions.hCLLs[ppIndex]; - - // - bool isHCBullish = isHCHHBullish && - isHCLLBullish; - - // - bool isHCBullishPrev = isHCHHBullishPrev && - isHCLLBullishPrev; - - // - bool isHCHHSwitchedToBullish = isHCHHBullish && - !isHCHHBullishPrev; - bool isHCLLSwitchedToBullish = isHCLLBullish && - !isHCLLBullishPrev; - - // - bool isHCHHBearish = conditions.hCHHs[cIndex] < conditions.hCHHs[pIndex]; - bool isHCLLBearish = conditions.hCLLs[cIndex] < conditions.hCLLs[pIndex]; - - // - bool isHCHHBearishPrev = conditions.hCHHs[pIndex] < conditions.hCHHs[ppIndex]; - bool isHCLLBearishPrev = conditions.hCLLs[pIndex] < conditions.hCLLs[ppIndex]; - - // - bool isHCBearish = isHCHHBearish && - isHCLLBearish; - - // - bool isHCBearishPrev = isHCHHBearishPrev && - isHCLLBearishPrev; - - // - bool isHCHHSwitchedToBearish = isHCHHBearish && - !isHCHHBearishPrev; - bool isHCLLSwitchedToBeraish = isHCLLBearish && - !isHCLLBearishPrev; - - // - bool isHCSwitchedToBullish = - // - (isHCHHSwitchedToBullish && - !isHCLLBearish) - // - || - // - (isHCLLSwitchedToBullish && - !isHCHHBearish) - // - ; - - // - bool isHCSwitchedToBearish = - // - (isHCHHSwitchedToBearish && - !isHCLLBullish) - // - || - // - (isHCLLSwitchedToBeraish && - !isHCHHBullish) - // - ; - - // - // Define Bars For Calculations ... - - // - XOHCL cBar; - result = cBar.Init( - mSymbol, - mPeriod, - cIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL pBar; - result = pBar.Init( - mSymbol, - mPeriod, - pIndex // - ); - if (!result) - { - return result; - } - - // - bool isCloseOverFib1 = cBar.close > conditions.fib1s[cIndex]; - bool isCloseOverFib1Prev = pBar.close > conditions.fib1s[pIndex]; - - // - bool isCloseOverFib2 = cBar.close > conditions.fib2s[cIndex]; - bool isCloseOverFib2Prev = pBar.close > conditions.fib2s[pIndex]; - - // - bool isCloseOverFib3 = cBar.close > conditions.fib3s[cIndex]; - bool isCloseOverFib3Prev = pBar.close > conditions.fib3s[pIndex]; - - // - bool isCloseOverFib4 = cBar.close > conditions.fib4s[cIndex]; - bool isCloseOverFib4Prev = pBar.close > conditions.fib4s[pIndex]; - - // - bool isCloseOverFib5 = cBar.close > conditions.fib5s[cIndex]; - bool isCloseOverFib5Prev = pBar.close > conditions.fib5s[pIndex]; - - // - bool isCloseUnderFib1 = cBar.close < conditions.fib1s[cIndex]; - bool isCloseUnderFib1Prev = pBar.close < conditions.fib1s[pIndex]; - - // - bool isCloseUnderFib2 = cBar.close < conditions.fib2s[cIndex]; - bool isCloseUnderFib2Prev = pBar.close < conditions.fib2s[pIndex]; - - // - bool isCloseUnderFib3 = cBar.close < conditions.fib3s[cIndex]; - bool isCloseUnderFib3Prev = pBar.close < conditions.fib3s[pIndex]; - - // - bool isCloseUnderFib4 = cBar.close < conditions.fib4s[cIndex]; - bool isCloseUnderFib4Prev = pBar.close < conditions.fib4s[pIndex]; - - // - bool isCloseUnderFib5 = cBar.close < conditions.fib5s[cIndex]; - bool isCloseUnderFib5Prev = pBar.close < conditions.fib5s[pIndex]; - - // - bool isCloseCrossedOverFib1 = isCloseOverFib1 && - !isCloseOverFib1Prev; - bool isCloseCrossedOverFib2 = isCloseOverFib2 && - !isCloseOverFib2Prev; - bool isCloseCrossedOverFib3 = isCloseOverFib3 && - !isCloseOverFib3Prev; - bool isCloseCrossedOverFib4 = isCloseOverFib4 && - !isCloseOverFib4Prev; - bool isCloseCrossedOverFib5 = isCloseOverFib5 && - !isCloseOverFib5Prev; - - // - bool isCloseCrossedUnderFib1 = isCloseUnderFib1 && - !isCloseUnderFib1Prev; - bool isCloseCrossedUnderFib2 = isCloseUnderFib2 && - !isCloseUnderFib2Prev; - bool isCloseCrossedUnderFib3 = isCloseUnderFib3 && - !isCloseUnderFib3Prev; - bool isCloseCrossedUnderFib4 = isCloseUnderFib4 && - !isCloseUnderFib4Prev; - bool isCloseCrossedUnderFib5 = isCloseUnderFib5 && - !isCloseUnderFib5Prev; - - // - conditions.isNewPeak = isNewPeak; - conditions.isNewPeakOverLast = isNewPeakOverLast; - conditions.isNewPeakUnderLast = isNewPeakUnderLast; - conditions.isNewVale = isNewVale; - conditions.isNewValeOverLast = isNewValeOverLast; - conditions.isNewValeUnderLast = isNewValeUnderLast; - conditions.isFiboIncreased = isFiboIncreased; - conditions.isFiboDecreased = isFiboDecreased; - conditions.isFiboSectionChanged = isFiboSectionChanged; - conditions.isCloseOverFib1 = isCloseOverFib1; - conditions.isCloseOverFib2 = isCloseOverFib2; - conditions.isCloseOverFib3 = isCloseOverFib3; - conditions.isCloseOverFib4 = isCloseOverFib4; - conditions.isCloseOverFib5 = isCloseOverFib5; - conditions.isCloseUnderFib1 = isCloseUnderFib1; - conditions.isCloseUnderFib2 = isCloseUnderFib2; - conditions.isCloseUnderFib3 = isCloseUnderFib3; - conditions.isCloseUnderFib4 = isCloseUnderFib4; - conditions.isCloseUnderFib5 = isCloseUnderFib5; - conditions.isCloseCrossedOverFib1 = isCloseCrossedOverFib1; - conditions.isCloseCrossedOverFib2 = isCloseCrossedOverFib2; - conditions.isCloseCrossedOverFib3 = isCloseCrossedOverFib3; - conditions.isCloseCrossedOverFib4 = isCloseCrossedOverFib4; - conditions.isCloseCrossedOverFib5 = isCloseCrossedOverFib5; - conditions.isCloseCrossedUnderFib1 = isCloseCrossedUnderFib1; - conditions.isCloseCrossedUnderFib2 = isCloseCrossedUnderFib2; - conditions.isCloseCrossedUnderFib3 = isCloseCrossedUnderFib3; - conditions.isCloseCrossedUnderFib4 = isCloseCrossedUnderFib4; - conditions.isCloseCrossedUnderFib5 = isCloseCrossedUnderFib5; - conditions.isSCBullish = isSCBullish; - conditions.isSCHHBullish = isSCHHBullish; - conditions.isSCLLBullish = isSCLLBullish; - conditions.isSCSwitchedToBullish = isSCSwitchedToBullish; - conditions.isSCHHSwitchedToBullish = isSCHHSwitchedToBullish; - conditions.isSCLLSwitchedToBullish = isSCLLSwitchedToBullish; - conditions.isSCBearish = isSCBearish; - conditions.isSCHHBearish = isSCHHBearish; - conditions.isSCLLBearish = isSCLLBearish; - conditions.isSCSwitchedToBearish = isSCSwitchedToBearish; - conditions.isSCHHSwitchedToBearish = isSCHHSwitchedToBearish; - conditions.isSCLLSwitchedToBeraish = isSCLLSwitchedToBeraish; - conditions.isMCBullish = isMCBullish; - conditions.isMCHHBullish = isMCHHBullish; - conditions.isMCLLBullish = isMCLLBullish; - conditions.isMCSwitchedToBullish = isMCSwitchedToBullish; - conditions.isMCHHSwitchedToBullish = isMCHHSwitchedToBullish; - conditions.isMCLLSwitchedToBullish = isMCLLSwitchedToBullish; - conditions.isMCBearish = isMCBearish; - conditions.isMCHHBearish = isMCHHBearish; - conditions.isMCLLBearish = isMCLLBearish; - conditions.isMCSwitchedToBearish = isMCSwitchedToBearish; - conditions.isMCHHSwitchedToBearish = isMCHHSwitchedToBearish; - conditions.isMCLLSwitchedToBeraish = isMCLLSwitchedToBeraish; - conditions.isLCBullish = isLCBullish; - conditions.isLCHHBullish = isLCHHBullish; - conditions.isLCLLBullish = isLCLLBullish; - conditions.isLCSwitchedToBullish = isLCSwitchedToBullish; - conditions.isLCHHSwitchedToBullish = isLCHHSwitchedToBullish; - conditions.isLCLLSwitchedToBullish = isLCLLSwitchedToBullish; - conditions.isLCBearish = isLCBearish; - conditions.isLCHHBearish = isLCHHBearish; - conditions.isLCLLBearish = isLCLLBearish; - conditions.isLCSwitchedToBearish = isLCSwitchedToBearish; - conditions.isLCHHSwitchedToBearish = isLCHHSwitchedToBearish; - conditions.isLCLLSwitchedToBeraish = isLCLLSwitchedToBeraish; - conditions.isHCBullish = isHCBullish; - conditions.isHCHHBullish = isHCHHBullish; - conditions.isHCLLBullish = isHCLLBullish; - conditions.isHCSwitchedToBullish = isHCSwitchedToBullish; - conditions.isHCHHSwitchedToBullish = isHCHHSwitchedToBullish; - conditions.isHCLLSwitchedToBullish = isHCLLSwitchedToBullish; - conditions.isHCBearish = isHCBearish; - conditions.isHCHHBearish = isHCHHBearish; - conditions.isHCLLBearish = isHCLLBearish; - conditions.isHCSwitchedToBearish = isHCSwitchedToBearish; - conditions.isHCHHSwitchedToBearish = isHCHHSwitchedToBearish; - conditions.isHCLLSwitchedToBeraish = isHCLLSwitchedToBeraish; - // - return result; - } - - // - // Protected ... -protected: - // - // Private ... -private: - // - // Props ... - XPVInputs mInputs; // Inputs ... - - // - // Buffers ... - double peaksBuffer[]; - double valesBuffer[]; - double resistanceBuffer[]; - double supportBuffer[]; - double fib1Buffer[]; - double fib2Buffer[]; - double fib3Buffer[]; - double fib4Buffer[]; - double fib5Buffer[]; - double scHHBuffer[]; - double scLLBuffer[]; - double mcHHBuffer[]; - double mcLLBuffer[]; - double lcHHBuffer[]; - double lcLLBuffer[]; - double hcHHBuffer[]; - double hcLLBuffer[]; - - // - // Tools ... - - // - // Calculate Values Until Now ... - void Calculate() - { - // - int totalBars = CountBars(); - if (totalBars > 1000) - { - totalBars = 1000; - } - - // - // Peaks and Vales ... - - // - // Peaks Buffer ... - CopyBuffer( - mHandler, - XPV_PEAKS_LINE, - 0, - totalBars, - peaksBuffer - // - ); - - // - // Vales Buffer ... - CopyBuffer( - mHandler, - XPV_VALES_LINE, - 0, - totalBars, - valesBuffer - // - ); - - // - // Support and Resistances ... - - // - // Resistances Buffer ... - CopyBuffer( - mHandler, - XPV_RESISTANCE_LINE, - 0, - totalBars, - resistanceBuffer - // - ); - - // - // Supports Buffer ... - CopyBuffer( - mHandler, - XPV_SUPPORT_LINE, - 0, - totalBars, - supportBuffer - // - ); - - // - // Fibonacci ... - - // - // Level 1 Buffer ... - CopyBuffer( - mHandler, - XPV_FIB_1_LINE, - 0, - totalBars, - fib1Buffer - // - ); - - // - // Level 2 Buffer ... - CopyBuffer( - mHandler, - XPV_FIB_2_LINE, - 0, - totalBars, - fib2Buffer - // - ); - - // - // Level 3 Buffer ... - CopyBuffer( - mHandler, - XPV_FIB_3_LINE, - 0, - totalBars, - fib3Buffer - // - ); - - // - // Level 4 Buffer ... - CopyBuffer( - mHandler, - XPV_FIB_4_LINE, - 0, - totalBars, - fib4Buffer - // - ); - - // - // Level 5 Buffer ... - CopyBuffer( - mHandler, - XPV_FIB_5_LINE, - 0, - totalBars, - fib5Buffer - // - ); - - // - // Cycles ... - - // - // Short ... - - // - // HH ... - CopyBuffer( - mHandler, - XPV_SC_HH_LINE, - 0, - totalBars, - scHHBuffer - // - ); - - // - // LL ... - CopyBuffer( - mHandler, - XPV_SC_LL_LINE, - 0, - totalBars, - scLLBuffer - // - ); - - // - // Medium ... - - // - // HH ... - CopyBuffer( - mHandler, - XPV_MC_HH_LINE, - 0, - totalBars, - mcHHBuffer - // - ); - - // - // LL ... - CopyBuffer( - mHandler, - XPV_MC_LL_LINE, - 0, - totalBars, - mcLLBuffer - // - ); - - // - // Long ... - - // - // HH ... - CopyBuffer( - mHandler, - XPV_LC_HH_LINE, - 0, - totalBars, - lcHHBuffer - // - ); - - // - // LL ... - CopyBuffer( - mHandler, - XPV_LC_LL_LINE, - 0, - totalBars, - lcLLBuffer - // - ); - - // - // Hind ... - - // - // HH ... - CopyBuffer( - mHandler, - XPV_HC_HH_LINE, - 0, - totalBars, - hcHHBuffer - // - ); - - // - // LL ... - CopyBuffer( - mHandler, - XPV_HC_LL_LINE, - 0, - totalBars, - hcLLBuffer - // - ); - } -}; - -// -// Tools ... \ No newline at end of file diff --git a/X121SMCEA/Signals/x-121.smc.xtwpv.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xtwpv.signal.lib.mq5 index 0410829a..88a415d5 100644 --- a/X121SMCEA/Signals/x-121.smc.xtwpv.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xtwpv.signal.lib.mq5 @@ -122,6 +122,9 @@ struct X121SMCStrategyXTWPVSignalConditions double point; XPVPivot pivot; + // + XConsolidationZone consolidationZone; + // string method; @@ -256,6 +259,7 @@ struct X121SMCStrategyXTWPVSignalConditions // point = 0; pivot.Clean(); + consolidationZone.Clean(); // method = NULL; @@ -419,6 +423,16 @@ struct X121SMCStrategyXTWPVSignalConditions return pivot.IsValid(); } + /** + * Check Model Has Consolidation Zone or not ... + * + * @return ( bool ) + */ + bool HasConsolidationZone() + { + return consolidationZone.IsValid(); + } + // }; @@ -515,14 +529,6 @@ bool DetectX121SMCXTWPVSiganlSetup( double llDown = cBar.FindLowesttDown(swingLoopback); double hhUp = cBar.FindHighestUp(swingLoopback); - // - int zoneValidationDivider = 10; - int validPivotRepetition = triggerCycleHelper.mX121Helper - .GetDonChainLength(); - - // - double selectedSL = 0; - // // Cycles Conditions ... @@ -640,36 +646,43 @@ bool DetectX121SMCXTWPVSiganlSetup( // // Setup Conditions ... + // // + // // Select Sources ... + // XC121SMCCycleHelper *helper = analyseCycleHelper; + // X121SMCCycleConditions helperConditions = analyseConditions; + // XPOIState helperState = analyseState; + // - // Select Sources ... - XC121SMCCycleHelper *helper = analyseCycleHelper; - X121SMCCycleConditions helperConditions = analyseConditions; - XPOIState helperState = analyseState; - - // - // Instance Helper CBar ... - XOHCL helperCBar; - result = helper.GetBar( + XOHCL analyseCBar; + result = analyseCycleHelper.GetBar( cBar, - helperCBar // + analyseCBar // ); if (!result) { return result; } + // + XOHCL analysePBar; + result = analyseCBar.GetPreviousBar(analysePBar); + if (!result) + { + return result; + } + // double bullishFib = GetFibonacciLevel( - helperCBar.high, - helperCBar.low, + analyseCBar.high, + analyseCBar.low, GetFiboLevelValue(X_FIBO_LEVEL_382), -1 // ); // double bearishFib = GetFibonacciLevel( - helperCBar.high, - helperCBar.low, + analyseCBar.high, + analyseCBar.low, GetFiboLevelValue(X_FIBO_LEVEL_382), 1 // ); @@ -705,12 +718,12 @@ bool DetectX121SMCXTWPVSiganlSetup( // XPVPivot peakPivot; - bool hasPeakPivot = helper + bool hasPeakPivot = analyseCycleHelper .GetActivePeakPivot(peakPivot); // XPVPivot valePivot; - bool hasValePivot = helper + bool hasValePivot = analyseCycleHelper .GetActiveValePivot(valePivot); // @@ -755,7 +768,7 @@ bool DetectX121SMCXTWPVSiganlSetup( { // conditions.pivot.to = cTime; - helper.FillPivotState(conditions.pivot); + analyseCycleHelper.FillPivotState(conditions.pivot); // // Check Pivot Renewation ... @@ -886,24 +899,24 @@ bool DetectX121SMCXTWPVSiganlSetup( // PV Conditions ... // - double peak = helperConditions.x121Conditions.peaksBuffer[1]; - double peakPrev = helperConditions.x121Conditions.peaksBuffer[2]; - double peakDiff = MathAbs(peakPrev - peak); + double analysePeak = analyseConditions.x121Conditions.peaksBuffer[1]; + double analysePeakPrev = analyseConditions.x121Conditions.peaksBuffer[2]; + double analysePeakDiff = MathAbs(analysePeakPrev - analysePeak); // - bool isNewPeak = helperConditions.x121Conditions.isNewPeak; - bool isNewPeakOverLast = helperConditions.x121Conditions.isNewPeakOverLast; - bool isNewPeakUnderLast = helperConditions.x121Conditions.isNewPeakUnderLast; + bool isNewAnalysePeak = analyseConditions.x121Conditions.isNewPeak; + bool isNewAnalysePeakOverLast = analyseConditions.x121Conditions.isNewPeakOverLast; + bool isNewAnalysePeakUnderLast = analyseConditions.x121Conditions.isNewPeakUnderLast; // - double vale = helperConditions.x121Conditions.valesBuffer[1]; - double valePrev = helperConditions.x121Conditions.valesBuffer[2]; - double valeDiff = MathAbs(valePrev - vale); + double analyseVale = analyseConditions.x121Conditions.valesBuffer[1]; + double analyseValePrev = analyseConditions.x121Conditions.valesBuffer[2]; + double analyseValeDiff = MathAbs(analyseValePrev - analyseVale); // - bool isNewVale = helperConditions.x121Conditions.isNewVale; - bool isNewValeOverLast = helperConditions.x121Conditions.isNewValeOverLast; - bool isNewValeUnderLast = helperConditions.x121Conditions.isNewValeUnderLast; + bool isNewAnalyseVale = analyseConditions.x121Conditions.isNewVale; + bool isNewAnalyseValeOverLast = analyseConditions.x121Conditions.isNewValeOverLast; + bool isNewAnalyseValeUnderLast = analyseConditions.x121Conditions.isNewValeUnderLast; // double triggerPeak = triggerConditions.x121Conditions.peaksBuffer[1]; @@ -911,19 +924,19 @@ bool DetectX121SMCXTWPVSiganlSetup( // int condition2MinPVDiffPoint = 30; - bool isPeakDiffPointPassed = peakDiff >= (condition2MinPVDiffPoint * points); - bool isValeDiffPointPassed = valeDiff >= (condition2MinPVDiffPoint * points); + bool isPeakDiffPointPassed = analysePeakDiff >= (condition2MinPVDiffPoint * points); + bool isValeDiffPointPassed = analyseValeDiff >= (condition2MinPVDiffPoint * points); // // DONCHAIN Conditions ... - // - double donCloseUpper = helperConditions.x121Conditions.donCloseUpperBuffer[1]; - double donCloseLower = helperConditions.x121Conditions.donCloseLowerBuffer[1]; + // // + // double analyseDonCloseUpper = analyseConditions.x121Conditions.donCloseUpperBuffer[1]; + // double analyseDonCloseLower = analyseConditions.x121Conditions.donCloseLowerBuffer[1]; - // - double donOpenUpper = helperConditions.x121Conditions.donOpenUpperBuffer[1]; - double donOpenLower = helperConditions.x121Conditions.donOpenLowerBuffer[1]; + // // + // double analyseonOpenUpper = analyseConditions.x121Conditions.donOpenUpperBuffer[1]; + // double analyseonOpenLower = analyseConditions.x121Conditions.donOpenLowerBuffer[1]; // // OPEN ... @@ -1029,12 +1042,12 @@ bool DetectX121SMCXTWPVSiganlSetup( // ; - // - if (isRejectDonUpper || - isRejectDonLower) - { - Print("Don Rejected ..."); - } + // // + // if (isRejectDonUpper || + // isRejectDonLower) + // { + // Print("Don Rejected ..."); + // } // bool isBreakedDonUpper = @@ -1073,12 +1086,12 @@ bool DetectX121SMCXTWPVSiganlSetup( // // false hasBullishTrend && - isNewPeakOverLast && isBullishFiboPassed && - helperCBar.IsBullish() && - conditions.pivot.upper < peak && - conditions.pivot.upper < helperCBar.GetUp() && - conditions.pivot.upper > helperCBar.GetDown() + analyseCBar.IsBullish() && + isNewAnalysePeakOverLast && + conditions.pivot.upper < analysePeak && + conditions.pivot.upper < analyseCBar.GetUp() && + conditions.pivot.upper > analyseCBar.GetDown() // ; if (bullishConditions1) @@ -1094,12 +1107,12 @@ bool DetectX121SMCXTWPVSiganlSetup( // // false hasBearishTrend && - isNewValeUnderLast && isBearishFiboPassed && - helperCBar.IsBearish() && - conditions.pivot.lower > vale && - conditions.pivot.lower < helperCBar.GetUp() && - conditions.pivot.lower > helperCBar.GetDown() + analyseCBar.IsBearish() && + isNewAnalyseValeUnderLast && + conditions.pivot.lower > analyseVale && + conditions.pivot.lower < analyseCBar.GetUp() && + conditions.pivot.lower > analyseCBar.GetDown() // ; if (bearishConditions1) @@ -1126,7 +1139,7 @@ bool DetectX121SMCXTWPVSiganlSetup( if (bullishConditions2) { // - conditions.point = vale; + conditions.point = analyseVale; conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2); } @@ -1144,7 +1157,7 @@ bool DetectX121SMCXTWPVSiganlSetup( if (bearishConditions2) { // - conditions.point = peak; + conditions.point = analysePeak; conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2); } @@ -1161,7 +1174,7 @@ bool DetectX121SMCXTWPVSiganlSetup( if (bullishConditions3) { // - conditions.point = vale; + conditions.point = analyseVale; conditions.method = ToString(X_X121SMC_XTWPV_METHOD_3); } @@ -1175,7 +1188,7 @@ bool DetectX121SMCXTWPVSiganlSetup( if (bearishConditions3) { // - conditions.point = peak; + conditions.point = analysePeak; conditions.method = ToString(X_X121SMC_XTWPV_METHOD_3); } @@ -1306,22 +1319,30 @@ bool DetectX121SMCXTWPVSiganlTrigger( return result; } + // + XOHCL pBar; + result = pBar.Init( + symbol, + period, + pIndex // + ); + if (!result) + { + return result; + } + // double ask = GetAsk(symbol); double bid = GetBid(symbol); datetime cTime = TimeCurrent(); + double points = GetPoints(symbol); // - double ll = cBar.FindLowest(9, MODE_LOW); - double hh = cBar.FindHighest(9, MODE_HIGH); - - // - int zoneValidationDivider = 10; - int validPivotRepetition = triggerCycleHelper.mX121Helper - .GetDonChainLength(); - - // - double selectedSL = 0; + int swingLoopback = 9; + double ll = cBar.FindLowest(swingLoopback, MODE_LOW); + double hh = cBar.FindHighest(swingLoopback, MODE_HIGH); + double llDown = cBar.FindLowesttDown(swingLoopback); + double hhUp = cBar.FindHighestUp(swingLoopback); // // Cycles Conditions ... @@ -1471,21 +1492,30 @@ bool DetectX121SMCXTWPVSiganlTrigger( // // Detect Consolidation ... - XConsolidationZone consolidationZone; - bool hasConsolidationZone = triggerCycleHelper - .GetLastConsolidationZone(consolidationZone); + bool hasConsolidationZone = conditions.HasConsolidationZone(); if (hasConsolidationZone) { // - hasConsolidationZone = - isBullish - ? consolidationZone.upper <= conditions.point - : consolidationZone.lower >= conditions.point; + hasConsolidationZone = triggerCycleHelper + .GetLastConsolidationZone(conditions.consolidationZone); // - if (!hasConsolidationZone) + if (hasConsolidationZone) { - consolidationZone.Clean(); + // + hasConsolidationZone = + isBullish + ? conditions.consolidationZone.upper <= conditions.point + : conditions.consolidationZone.lower >= conditions.point; + + // + if (!hasConsolidationZone) + { + // + conditions + .consolidationZone + .Clean(); + } } } @@ -1551,9 +1581,6 @@ bool DetectX121SMCXTWPVSiganlTrigger( Opposit(setupDir) // ); - // - double points = GetPoints(conditions.symbol); - // double entry = GetEntry( conditions.symbol, @@ -1569,14 +1596,14 @@ bool DetectX121SMCXTWPVSiganlTrigger( if (isBullish) { Add( - consolidationZone.lower, + conditions.consolidationZone.lower, sls // ); } else { Add( - consolidationZone.upper, + conditions.consolidationZone.upper, sls // ); } diff --git a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 index 2416acf3..93f970db 100644 --- a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 +++ b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 @@ -281,6 +281,16 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // result = PrepareSignal(signal); + // + if (result) + { + // + // TODO: Remove this ... + XCSignalObject *iObj; + mPOIDrawer.DrawSignal(signal, iObj); + Print(""); + } + // hasLong = false; hasShort = false; @@ -712,56 +722,74 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // Handle Required Drawings ... bool hasPivot = mXTWPVConditions.HasPivot(); bool hasPriceInsideZone = mXTWPVConditions.HasPriceInsideZones(); + bool hasConsolidationZone = mXTWPVConditions.HasConsolidationZone(); bool canDraw = hasPivot || - hasPriceInsideZone; + hasPriceInsideZone || + hasConsolidationZone; if (canDraw) { - // // - // ClearDraws(); + // + ClearDraws(); - // // - // // Draw Pivot Zone ... - // if (hasPivot) - // { - // // - // XCBaseObject *drawnObjects[]; - // int drawnObjectsCount = DrawXTWPVPivotZone( - // mXTWPVConditions, - // mPOIDrawer, - // drawnObjects, - // true, // Draw State ... - // true, // Draw Ticks Zone ... - // true, // Ignore SwingHighs ... - // true, // Ignore SwingLows ... - // true, // Ignore SupportZones ... - // true, // Ignore ResistanceZones ... - // true, // Ignore SupplyZones ... - // true, // Ignore DemandZones ... - // true, // Ignore BullishOrderBlocks ... - // true, // Ignore BearishOrderBlocks ... - // true, // Ignore BullishFairValueGaps ... - // true, // Ignore BearishFairValueGaps ... - // true, // Ignore BullishRejectionBars ... - // true, // Ignore BearishRejectionBars ... - // true, // Ignore BullishMomentumBars ... - // true // Ignore BearishMomentumBars ... - // ); - // AddObjectsIfNotExists(drawnObjects); - // } + // + // Draw Consolidation Zone ... + if (hasConsolidationZone) + { + // + XCConsolidationZoneObject *iObj; + bool isCreated = mPOIDrawer.CreateConsolidationZone( + mXTWPVConditions.consolidationZone, + iObj // + ); + if (isCreated) + { + AddObjectIfNotExists(iObj); + } + } - // // - // // Draw Price Inside Zones ... - // if (hasPriceInsideZone) - // { - // // - // XCBaseObject *drawnObjects[]; - // int drawnObjectsCount = DrawTWPVPriceInsideZones( - // mXTWPVConditions, - // mPOIDrawer, - // drawnObjects // - // ); - // AddObjectsIfNotExists(drawnObjects); - // } + // + // Draw Pivot Zone ... + if (hasPivot) + { + // + XCBaseObject *drawnObjects[]; + int drawnObjectsCount = DrawXTWPVPivotZone( + mXTWPVConditions, + mPOIDrawer, + drawnObjects, + false, // Draw State ... + false, // Draw Ticks Zone ... + true, // Ignore SwingHighs ... + true, // Ignore SwingLows ... + true, // Ignore SupportZones ... + true, // Ignore ResistanceZones ... + true, // Ignore SupplyZones ... + true, // Ignore DemandZones ... + true, // Ignore BullishOrderBlocks ... + true, // Ignore BearishOrderBlocks ... + true, // Ignore BullishFairValueGaps ... + true, // Ignore BearishFairValueGaps ... + true, // Ignore BullishRejectionBars ... + true, // Ignore BearishRejectionBars ... + true, // Ignore BullishMomentumBars ... + true // Ignore BearishMomentumBars ... + ); + AddObjectsIfNotExists(drawnObjects); + } + + // + // Draw Price Inside Zones ... + if (hasPriceInsideZone) + { + // + XCBaseObject *drawnObjects[]; + int drawnObjectsCount = DrawTWPVPriceInsideZones( + mXTWPVConditions, + mPOIDrawer, + drawnObjects // + ); + AddObjectsIfNotExists(drawnObjects); + } } //