From fa4c3098a96dd424b5e00afd8497906a290a51ac Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 25 Mar 2024 03:13:16 +0330 Subject: [PATCH] refactor for xTestEa all Workspace and Cleanup Providers Market Conditions ... --- ....xbtus5.ea.mq5 => x-saherelm.xtest.ea.mq5} | 128 +- ...aherelm.xbtus5.provider.indicators.lib.mq5 | 6436 ----------------- .../x-saherelm.xbtus5.provider.inputs.lib.mq5 | 283 - ...saherelm.xtest.provider.indicators.lib.mq5 | 2084 ++++++ .../x-saherelm.xtest.provider.inputs.lib.mq5 | 283 + ....mq5 => x-saherelm.xtest.provider.lib.mq5} | 528 +- 6 files changed, 2695 insertions(+), 7047 deletions(-) rename Experts/{x-saherelm.xbtus5.ea.mq5 => x-saherelm.xtest.ea.mq5} (67%) delete mode 100644 Providers/x-saherelm.xbtus5.provider.indicators.lib.mq5 delete mode 100644 Providers/x-saherelm.xbtus5.provider.inputs.lib.mq5 create mode 100644 Providers/x-saherelm.xtest.provider.indicators.lib.mq5 create mode 100644 Providers/x-saherelm.xtest.provider.inputs.lib.mq5 rename Providers/{x-saherelm.xbtus5.provider.lib.mq5 => x-saherelm.xtest.provider.lib.mq5} (61%) diff --git a/Experts/x-saherelm.xbtus5.ea.mq5 b/Experts/x-saherelm.xtest.ea.mq5 similarity index 67% rename from Experts/x-saherelm.xbtus5.ea.mq5 rename to Experts/x-saherelm.xtest.ea.mq5 index 6eda82ef..a41c1882 100644 --- a/Experts/x-saherelm.xbtus5.ea.mq5 +++ b/Experts/x-saherelm.xtest.ea.mq5 @@ -2,7 +2,7 @@ // // SaherElm IT Center MQL5 Expert Advisor // ---------------------------------------- -// Name: XBTUS5 +// Name: XTEST // Description: this is an expert controller // advisors which provides a mechanism for use them ... // @@ -17,7 +17,7 @@ #property copyright "Copyright 2023, SaherElm IT Center" #property link "https://saherelm.ir" #property version "1.00" -#property description "SaherElm XBTUS5 EA" +#property description "SaherElm XTEST EA" #property strict // @@ -28,9 +28,9 @@ input group "Commons"; // // XCTIMER inputs ... -input bool xBTUS5ShowCandleTimer = true; // Show Condle Remaining Time -input color xBTUS5CandleTimerColot = clrYellow; // Candle Timer Color -input ENUM_BASE_CORNER xBTUS5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer +input bool xTESTShowCandleTimer = true; // Show Condle Remaining Time +input color xTESTCandleTimerColot = clrYellow; // Candle Timer Color +input ENUM_BASE_CORNER xTESTCandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer // // END Inputs ... @@ -57,8 +57,8 @@ input ENUM_BASE_CORNER xBTUS5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to #include "../Libraries/x-saherelm.draw.lib.mq5" // -// XBTUS5 Signal Provider ... -#include "../Providers/x-saherelm.xbtus5.provider.lib.mq5" +// XTEST Signal Provider ... +#include "../Providers/x-saherelm.xtest.provider.lib.mq5" // // END Including Providers ... @@ -67,13 +67,13 @@ input ENUM_BASE_CORNER xBTUS5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to // // START Global Definitions: Variables, Properties and etc ... // -bool isXBTUS5NewHour; -bool isXBTUS5NewDay; -bool isXBTUS5NewWeek; -bool isXBTUS5NewMonth; +bool isXTESTNewHour; +bool isXTESTNewDay; +bool isXTESTNewWeek; +bool isXTESTNewMonth; // -int xBTUS5CTimerHandler = INVALID_HANDLE; +int xTESTCTimerHandler = INVALID_HANDLE; // // END Global Definitions: Variables, Properties and etc ... // @@ -87,7 +87,7 @@ int xBTUS5CTimerHandler = INVALID_HANDLE; int OnInit() { // - logTag = "XBTUS5EA"; + logTag = "XTESTEA"; drawPrefix = logTag; alertPrefix = logTag; @@ -107,17 +107,17 @@ int OnInit() } // - // Initialize XBTUS5 Provider ... - if (!XBTUS5InitSignalProviderLibrary()) + // Initialize XTEST Provider ... + if (!XTESTInitSignalProviderLibrary()) { return INIT_PARAMETERS_INCORRECT; } // // Init XCTimer ... - if (xBTUS5ShowCandleTimer) + if (xTESTShowCandleTimer) { - if (!XBTUS5CTimerInit()) + if (!XTESTCTimerInit()) { return INIT_FAILED; } @@ -148,15 +148,15 @@ void OnDeinit(const int reason) // Here we can handle De Initialization Reasons ... // - // De Initialize XBTUS5 Provider ... - XBTUS5DeinitSignalProviderLibrary(reason); + // De Initialize XTEST Provider ... + XTESTDeinitSignalProviderLibrary(reason); // // De Init XDraw Library ... // OnDeinitDrawLibrary(); // - IndicatorRelease(xBTUS5CTimerHandler); + IndicatorRelease(xTESTCTimerHandler); } // @@ -166,15 +166,15 @@ void OnTick() // // Handle Monthly Alert ... bool isFirstMonth = xMonth == -1; - isXBTUS5NewMonth = IsNewMonth(); + isXTESTNewMonth = IsNewMonth(); bool canMonthlyAlert = - isXBTUS5NewMonth && - xBTUS5EnableAlerts && - xBTUS5EnableMonthlyAlerts; + isXTESTNewMonth && + xTESTEnableAlerts && + xTESTEnableMonthlyAlerts; bool canMonthlyReport = !isFirstMonth && canMonthlyAlert && - xBTUS5EnableMonthlyReports; + xTESTEnableMonthlyReports; if (canMonthlyAlert) { // @@ -185,7 +185,7 @@ void OnTick() if (canMonthlyReport) { // - string report = xBTUS5Reporter.GenerateReportString(XREPORT_MONTHLY); + string report = xTESTReporter.GenerateReportString(XREPORT_MONTHLY); // message = "Last Month Report:\n" + report; @@ -193,7 +193,7 @@ void OnTick() // // Reset Report ... - xBTUS5Reporter.Reset(XREPORT_MONTHLY); + xTESTReporter.Reset(XREPORT_MONTHLY); // SendAlert(message); @@ -202,15 +202,15 @@ void OnTick() // // Handle Weekly Alert ... bool isFirstWeek = xDayOfWeek == -1; - isXBTUS5NewWeek = IsNewWeek(); + isXTESTNewWeek = IsNewWeek(); bool canWeeklyAlert = - isXBTUS5NewWeek && - xBTUS5EnableAlerts && - xBTUS5EnableWeeklyAlerts; + isXTESTNewWeek && + xTESTEnableAlerts && + xTESTEnableWeeklyAlerts; bool canWeeklyReport = !isFirstWeek && canWeeklyAlert && - xBTUS5EnableWeeklyReports; + xTESTEnableWeeklyReports; if (canWeeklyAlert) { // @@ -221,7 +221,7 @@ void OnTick() if (canWeeklyReport) { // - string report = xBTUS5Reporter.GenerateReportString(XREPORT_WEEKLY); + string report = xTESTReporter.GenerateReportString(XREPORT_WEEKLY); // message = "Last Week Report:\n" + report; @@ -229,7 +229,7 @@ void OnTick() // // Reset Report ... - xBTUS5Reporter.Reset(XREPORT_WEEKLY); + xTESTReporter.Reset(XREPORT_WEEKLY); // SendAlert(message); @@ -238,15 +238,15 @@ void OnTick() // // Handle Daily Alert ... bool isFirstDay = xDay == -1; - isXBTUS5NewDay = IsNewDay(); + isXTESTNewDay = IsNewDay(); bool canDailyAlert = - isXBTUS5NewDay && - xBTUS5EnableAlerts && - xBTUS5EnableDailyAlerts; + isXTESTNewDay && + xTESTEnableAlerts && + xTESTEnableDailyAlerts; bool canDailyReport = !isFirstDay && canDailyAlert && - xBTUS5EnableDailyReports; + xTESTEnableDailyReports; if (canDailyAlert) { // @@ -257,7 +257,7 @@ void OnTick() if (canDailyReport) { // - string report = xBTUS5Reporter.GenerateReportString(XREPORT_DAILY); + string report = xTESTReporter.GenerateReportString(XREPORT_DAILY); // message = "Last Week Report:\n" + report; @@ -265,7 +265,7 @@ void OnTick() // // Reset Report ... - xBTUS5Reporter.Reset(XREPORT_DAILY); + xTESTReporter.Reset(XREPORT_DAILY); // SendAlert(message); @@ -274,11 +274,11 @@ void OnTick() // // Handle Hourly Alert ... bool isFirstHour = xHour == -1; - isXBTUS5NewHour = IsNewHour(); + isXTESTNewHour = IsNewHour(); bool canHourlyAlert = - isXBTUS5NewHour && - xBTUS5EnableAlerts && - xBTUS5EnableHourlyAlerts; + isXTESTNewHour && + xTESTEnableAlerts && + xTESTEnableHourlyAlerts; if (canHourlyAlert) { // @@ -290,33 +290,33 @@ void OnTick() // // Prevent Going Forward if user Disable it ... - if (xBTUS5EnableProvider) + if (xTESTEnableProvider) { // - // Handle Processing on XBTUS5 Signal Provider ... - XBTUS5SignalProviderDoControlState(); + // Handle Processing on XTEST Signal Provider ... + XTESTSignalProviderDoControlState(); } // // Check Can Ignore Tick or not .. - bool canIgnoreTick = xBTUS5IsTestMode + bool canIgnoreTick = xTESTIsTestMode ? !IsNewCandle() - : !IsNewCandle() && xBTUS5WaitUntilNextCandle; + : !IsNewCandle() && xTESTWaitUntilNextCandle; if (canIgnoreTick) { return; } // - xBTUS5WaitUntilNextCandle = false; + xTESTWaitUntilNextCandle = false; // // Prevent Going Forward if user Disable it ... - if (xBTUS5EnableProvider) + if (xTESTEnableProvider) { // - // Handle Processing on XBTUS5 Signal Provider ... - XBTUS5SignalProviderHandleTick(); + // Handle Processing on XTEST Signal Provider ... + XTESTSignalProviderHandleTick(); } } @@ -327,11 +327,11 @@ void OnTrade() // // Prevent Going Forward if user Disable it ... - if (xBTUS5EnableProvider) + if (xTESTEnableProvider) { // - // Handle Processing Trades on XBTUS5 Signal Provider ... - XBTUS5SignalProviderHandleTrade(); + // Handle Processing Trades on XTEST Signal Provider ... + XTESTSignalProviderHandleTrade(); } } @@ -354,8 +354,8 @@ bool ValidateInputs() // Validate Args ... // - // Validate XBTUS5 Provider Inputs ... - result = XBTUS5ValidateInputs(); + // Validate XTEST Provider Inputs ... + result = XTESTValidateInputs(); if (!result) { return false; @@ -370,23 +370,23 @@ bool ValidateInputs() return result; } -bool XBTUS5CTimerInit() +bool XTESTCTimerInit() { // bool result = true; // - xBTUS5CTimerHandler = iCustom( + xTESTCTimerHandler = iCustom( _Symbol, _Period, "x-saherelm.xctimer.indicator", // // Inputs ... - xBTUS5CandleTimerColot, - xBTUS5CandleTimerCorner); + xTESTCandleTimerColot, + xTESTCandleTimerCorner); // - if (xBTUS5CTimerHandler == INVALID_HANDLE) + if (xTESTCTimerHandler == INVALID_HANDLE) { result = false; } diff --git a/Providers/x-saherelm.xbtus5.provider.indicators.lib.mq5 b/Providers/x-saherelm.xbtus5.provider.indicators.lib.mq5 deleted file mode 100644 index a08f2c3a..00000000 --- a/Providers/x-saherelm.xbtus5.provider.indicators.lib.mq5 +++ /dev/null @@ -1,6436 +0,0 @@ -/////////////////////////////////////////////////////////////////// -// -// SaherElm IT Center MQL5 XBTUS5 Signal Provider Indicators Library -// ---------------------------------------------------------------- -// -// Maintainer: -// ------------ -// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) -// -////////////////////////////////////////////////////// -// -// Global Properties ... -#property library -#property copyright "Copyright 2023, SaherElm IT Center" -#property link "https://www.saherelm.ir" -#property version "1.00" -#property strict - -// -// Include Provider Inputs ... -#include "x-saherelm.xbtus5.provider.inputs.lib.mq5" - -// -// Include Provider Class ... -#include "../Classes/x-saherelm.provider.lib.mq5" - -// -// Signallers ... -input group "XBTUS5 Signallers"; - -// -// XTD ... -input group "XBTUS5 XTD Signaller"; -input bool xBTUS5XTDEnableSignaller = true; // Enable Signaller -input bool xBTUS5XTDAllowLongSignals = true; // Enable Long Signals -input bool xBTUS5XTDAllowShortSignals = true; // Enable Short Signals - -// -// XTAM ... -input group "XBTUS5 XTAM Signaller"; -input bool xBTUS5XTAMEnableSignaller = true; // Enable Signaller -input bool xBTUS5XTAMAllowLongSignals = true; // Enable Long Signals -input bool xBTUS5XTAMAllowShortSignals = true; // Enable Short Signals - -// -// XSI ... -input group "XBTUS5 XSI Signaller"; -input bool xBTUS5XSIEnableSignaller = true; // Enable Signaller -input bool xBTUS5XSIAllowLongSignals = true; // Enable Long Signals -input bool xBTUS5XSIAllowShortSignals = true; // Enable Short Signals - -// -// XTSFI ... -input group "XBTUS5 XTSFI Signaller"; -input bool xBTUS5XTSFIEnableSignaller = true; // Enable Signaller -input bool xBTUS5XTSFIAllowLongSignals = true; // Enable Long Signals -input bool xBTUS5XTSFIAllowShortSignals = true; // Enable Short Signals - -// -// XOBDLH ... -// input group "XBTUS5 XOBDLH Signaller"; -// input bool xBTUS5XOBDLHEnableSignaller = true; // Enable Signaller -// input bool xBTUS5XOBDLHAllowLongSignals = true; // Enable Long Signals -// input bool xBTUS5XOBDLHAllowShortSignals = true; // Enable Short Signals - -// -// XCHMACC ... -input group "XBTUS5 XCHMACC Signaller"; -input bool xBTUS5XCHMACCEnableSignaller = true; // Enable Signaller -input bool xBTUS5XCHMACCAllowLongSignals = true; // Enable Long Signals -input bool xBTUS5XCHMACCAllowShortSignals = true; // Enable Short Signals - -// -// XCHMAMX ... -// input group "XBTUS5 XCHMAMX Signaller"; -// input bool xBTUS5XCHMAMXEnableSignaller = true; // Enable Signaller -// input bool xBTUS5XCHMAMXAllowLongSignals = true; // Enable Long Signals -// input bool xBTUS5XCHMAMXAllowShortSignals = true; // Enable Short Signals - -// -// XCHMAMN ... -input group "XBTUS5 XCHMAMN Signaller"; -// input bool xBTUS5XCHMAMNEnableSignaller = true; // Enable Signaller -// input bool xBTUS5XCHMAMNAllowLongSignals = true; // Enable Long Signals -// input bool xBTUS5XCHMAMNAllowShortSignals = true; // Enable Short Signals - -// -// Check in Test Mode or not ... -bool xBTUS5IsTestMode = false; - -// -// Detect max Input Length of Indicators ... -int xBTUS5MaxLengthOfInputs = 0; - -// -// Detect Calculated Bars ... -int xBTUS5CalculatedBars = 0; - -// -// Check prevent Double Signalling on Same Candle ... -bool xBTUS5WaitUntilNextCandle = false; - -// -// Signaller Variables ... -// -// XTD ... -bool xBTUS5MXTDEnableSignaller = xBTUS5XTDEnableSignaller; -bool xBTUS5MXTDAllowLongSignals = xBTUS5XTDAllowLongSignals; -bool xBTUS5MXTDAllowShortSignals = xBTUS5XTDAllowShortSignals; - -// -// XTAM ... -bool xBTUS5MXTAMEnableSignaller = xBTUS5XTAMEnableSignaller; -bool xBTUS5MXTAMAllowLongSignals = xBTUS5XTAMAllowLongSignals; -bool xBTUS5MXTAMAllowShortSignals = xBTUS5XTAMAllowShortSignals; - -// -// XSI ... -bool xBTUS5MXSIEnableSignaller = xBTUS5XSIEnableSignaller; -bool xBTUS5MXSIAllowLongSignals = xBTUS5XSIAllowLongSignals; -bool xBTUS5MXSIAllowShortSignals = xBTUS5XSIAllowShortSignals; - -// -// XTSFI ... -bool xBTUS5MXTSFIEnableSignaller = xBTUS5XTSFIEnableSignaller; -bool xBTUS5MXTSFIAllowLongSignals = xBTUS5XTSFIAllowLongSignals; -bool xBTUS5MXTSFIAllowShortSignals = xBTUS5XTSFIAllowShortSignals; - -// -// XOBDLH ... -bool xBTUS5MXOBDLHEnableSignaller = false; // xBTUS5XOBDLHEnableSignaller; -bool xBTUS5MXOBDLHAllowLongSignals = false; // xBTUS5XOBDLHAllowLongSignals; -bool xBTUS5MXOBDLHAllowShortSignals = false; // xBTUS5XOBDLHAllowShortSignals; - -// -// XCHMACC ... -bool xBTUS5MXCHMACCEnableSignaller = xBTUS5XCHMACCEnableSignaller; -bool xBTUS5MXCHMACCAllowLongSignals = xBTUS5XCHMACCAllowLongSignals; -bool xBTUS5MXCHMACCAllowShortSignals = xBTUS5XCHMACCAllowShortSignals; - -// -// XCHMAMX ... -bool xBTUS5MXCHMAMXEnableSignaller = false; // xBTUS5XCHMAMXEnableSignaller; -bool xBTUS5MXCHMAMXAllowLongSignals = false; // xBTUS5XCHMAMXAllowLongSignals; -bool xBTUS5MXCHMAMXAllowShortSignals = false; // xBTUS5XCHMAMXAllowShortSignals; - -// -// XCHMAMN ... -bool xBTUS5MXCHMAMNEnableSignaller = false; // xBTUS5XCHMAMNEnableSignaller; -bool xBTUS5MXCHMAMNAllowLongSignals = false; // xBTUS5XCHMAMNAllowLongSignals; -bool xBTUS5MXCHMAMNAllowShortSignals = false; // xBTUS5XCHMAMNAllowShortSignals; - -// -XCProvider *xBTUS5Provider; - -// -// Validate Indicators Inputs ... -bool XBTUS5ValidateIndicatorsInputs() -{ - // - bool result = false; - - // - // XTM ... - result = XTMValidateInputs(); - if (!result) - { - return result; - } - - // - // XAMA ... - result = XAMAValidateInputs(); - if (!result) - { - return result; - } - - // - // XTD ... - result = XTDValidateInputs(); - if (!result) - { - return result; - } - - // - // XFI ... - result = XFIValidateInputs(); - if (!result) - { - return result; - } - - // - // XTS ... - result = XTSValidateInputs(); - if (!result) - { - return result; - } - - // - // XOBD ... - result = XOBDValidateInputs(); - if (!result) - { - return result; - } - - // - // XLH ... - result = XLHValidateInputs(); - if (!result) - { - return result; - } - - // - // XRSI ... - result = XRSIValidateInputs(); - if (!result) - { - return result; - } - - // - // XCHLH ... - result = XCHLHValidateInputs(); - if (!result) - { - return result; - } - - // - // XCHMA ... - result = XCHMAValidateInputs(); - if (!result) - { - return result; - } - - // - // Make an Instance Of XCProvider Class for Use ... - xBTUS5Provider = new XCProvider( - // - // Commons ... - _Symbol, - _Period, - // - // Signallers ... - // - // XTD ... - xBTUS5MXTDEnableSignaller, - xBTUS5MXTDAllowLongSignals, - xBTUS5MXTDAllowShortSignals, - // - // XTAM ... - xBTUS5MXTAMEnableSignaller, - xBTUS5MXTAMAllowLongSignals, - xBTUS5MXTAMAllowShortSignals, - // - // XSI ... - xBTUS5MXSIEnableSignaller, - xBTUS5MXSIAllowLongSignals, - xBTUS5MXSIAllowShortSignals, - // - // XTSFI ... - xBTUS5MXTSFIEnableSignaller, - xBTUS5MXTSFIAllowLongSignals, - xBTUS5MXTSFIAllowShortSignals, - // - // XOBDLH ... - xBTUS5MXOBDLHEnableSignaller, - xBTUS5MXOBDLHAllowLongSignals, - xBTUS5MXOBDLHAllowShortSignals, - // - // XCHMACC ... - xBTUS5MXCHMACCEnableSignaller, - xBTUS5MXCHMACCAllowLongSignals, - xBTUS5MXCHMACCAllowShortSignals, - // - // XCHMAMX ... - xBTUS5MXCHMAMXEnableSignaller, - xBTUS5MXCHMAMXAllowLongSignals, - xBTUS5MXCHMAMXAllowShortSignals, - // - // XCHMAMN ... - xBTUS5MXCHMAMNEnableSignaller, - xBTUS5MXCHMAMNAllowLongSignals, - xBTUS5MXCHMAMNAllowShortSignals - // - ); - - // - result = true; - - // - return result; -} - -// -// Init Indicators ... -bool XBTUS5InitIndicators() -{ - // - bool result = false; - - // - // Make it Enable when we need to Log Market Conditions ... - xBTUS5IsTestMode = IsRunningOnTestMode(); - - // - // Check and Calculate Max Length in Inputs ... - // - - // - // XTM ... - xBTUS5MaxLengthOfInputs = MathMax( - xTMMaPeriod, - xBTUS5NumberOfItemsPerTick); - - // - // XAMA ... - xBTUS5MaxLengthOfInputs = MathMax( - xAMALength, - xBTUS5NumberOfItemsPerTick); - xBTUS5MaxLengthOfInputs = MathMax( - xAMAFastEMA, - xBTUS5NumberOfItemsPerTick); - xBTUS5MaxLengthOfInputs = MathMax( - xAMASlowEMA, - xBTUS5NumberOfItemsPerTick); - - // - // XLH ... - xBTUS5MaxLengthOfInputs = MathMax( - xLHLength, - xBTUS5NumberOfItemsPerTick); - - // - // XTD ... - xBTUS5MaxLengthOfInputs = MathMax( - xTDLength, - xBTUS5MaxLengthOfInputs); - - // - // XFI ... - xBTUS5MaxLengthOfInputs = MathMax( - xFILength, - xBTUS5MaxLengthOfInputs); - - // - // XRSI ... - xBTUS5MaxLengthOfInputs = MathMax( - xRSILength, - xBTUS5MaxLengthOfInputs); - - // - // XOBD ... - xBTUS5MaxLengthOfInputs = MathMax( - xOBDLength, - xBTUS5MaxLengthOfInputs); - - // - // XCHLH ... - xBTUS5MaxLengthOfInputs = MathMax( - xCHLHLcLength, - xBTUS5MaxLengthOfInputs); - xBTUS5MaxLengthOfInputs = MathMax( - xCHLHMcLength, - xBTUS5MaxLengthOfInputs); - xBTUS5MaxLengthOfInputs = MathMax( - xCHLHScLength, - xBTUS5MaxLengthOfInputs); - - // - // XCHMA ... - xBTUS5MaxLengthOfInputs = MathMax( - xCHMAScFastLength, - xBTUS5MaxLengthOfInputs); - xBTUS5MaxLengthOfInputs = MathMax( - xCHMAScSlowLength, - xBTUS5MaxLengthOfInputs); - xBTUS5MaxLengthOfInputs = MathMax( - xCHMAMcFastLength, - xBTUS5MaxLengthOfInputs); - xBTUS5MaxLengthOfInputs = MathMax( - xCHMAMcSlowLength, - xBTUS5MaxLengthOfInputs); - xBTUS5MaxLengthOfInputs = MathMax( - xCHMALcFastLength, - xBTUS5MaxLengthOfInputs); - xBTUS5MaxLengthOfInputs = MathMax( - xCHMALcSlowLength, - xBTUS5MaxLengthOfInputs); - - // - // Validate Indicators Inputs before Initialization ... - result = XBTUS5ValidateIndicatorsInputs(); - if (!result) - { - return result; - } - - // - // Validate Signallers ... - - // - // XTD ... - bool isXTDEnable = - xBTUS5XTDEnableSignaller && - (xBTUS5XTDAllowLongSignals || - xBTUS5XTDAllowShortSignals); - - // - // XTAM ... - bool isXTAMEnable = - xBTUS5XTAMEnableSignaller && - (xBTUS5XTAMAllowLongSignals || - xBTUS5XTAMAllowShortSignals); - - // - // XSI ... - bool isXSIEnable = - xBTUS5XSIEnableSignaller && - (xBTUS5XSIAllowLongSignals || - xBTUS5XSIAllowShortSignals); - - // - // XTSFI ... - bool isXTSFIEnable = - xBTUS5XTSFIEnableSignaller && - (xBTUS5XTSFIAllowLongSignals || - xBTUS5XTSFIAllowShortSignals); - - // - // XOBDLH ... - bool isXOBDLHEnable = false; - // xBTUS5XOBDLHEnableSignaller && - // (xBTUS5XOBDLHAllowLongSignals || - // xBTUS5XOBDLHAllowShortSignals); - - // - // XCHMACC ... - bool isXCHMACCEnable = - xBTUS5XCHMACCEnableSignaller && - (xBTUS5XCHMACCAllowLongSignals || - xBTUS5XCHMACCAllowShortSignals); - - // - // XCHMAMX ... - bool isXCHMAMXEnable = false; - // xBTUS5XCHMAMXEnableSignaller && - // (xBTUS5XCHMAMXAllowLongSignals || - // xBTUS5XCHMAMXAllowShortSignals); - - // - // XCHMAMN ... - bool isXCHMAMNEnable = false; - // xBTUS5XCHMAMNEnableSignaller && - // (xBTUS5XCHMAMNAllowLongSignals || - // xBTUS5XCHMAMNAllowShortSignals); - - // - bool hasSignaller = - // - isXTDEnable || - isXTAMEnable || - isXSIEnable || - isXTSFIEnable || - isXOBDLHEnable || - isXCHMACCEnable || - isXCHMAMXEnable || - isXCHMAMNEnable - // - ; - result = hasSignaller; - if (!result) - { - // - LogMessage("XBTUS5 doesn't enable any Signaller ..."); - - // - return result; - } - - // - // Initialize Indicator/Oscillator Handlers ... - ResetLastError(); - - // - // XTM Init ... - result = XTMInitHandlers(); - if (!result) - { - return result; - } - - // - // XAMA Init ... - result = XAMAInitHandlers(); - if (!result) - { - return result; - } - - // - // XLH Init ... - result = XLHInitHandlers(); - if (!result) - { - return result; - } - - // - // XTD Init ... - result = XTDInitHandlers(); - if (!result) - { - return result; - } - - // - // XFI Init ... - result = XFIInitHandlers(); - if (!result) - { - return result; - } - - // - // XTS Init ... - result = XTSInitHandlers(); - if (!result) - { - return result; - } - - // - // XRSI Init ... - result = XRSIInitHandlers(); - if (!result) - { - return result; - } - - // - // XOBD Init ... - result = XOBDInitHandlers(); - if (!result) - { - return result; - } - - // - // XCLH Init ... - result = XCHLHInitHandlers(); - if (!result) - { - return result; - } - - // - // XCHMA Init ... - result = XCHMAInitHandlers(); - if (!result) - { - return result; - } - - // - result = true; - - // - return result; -} - -// -// Release Indicators ... -void XBTUS5ReleaseIndicators() -{ - // - // Release Handlers ... - XTMReleaseHandlers(); - XAMAReleaseHandlers(); - XLHReleaseHandlers(); - XTDReleaseHandlers(); - XFIReleaseHandlers(); - XTSReleaseHandlers(); - XRSIReleaseHandlers(); - XOBDReleaseHandlers(); - XCHMAReleaseHandlers(); - XCHLHReleaseHandlers(); -} - -// -// Handle Reading Buffers ... -void XBTUS5HandleReadingBuffers() -{ - // - // Reading Calculated Bars for a Simple Handler ... - xBTUS5CalculatedBars = BarsCalculated(xTMHandler); - - // - // Read Indicators Buffers ... - XTMReadBuffers(xBTUS5NumberOfItemsPerTick); - XAMAReadBuffers(xBTUS5NumberOfItemsPerTick); - XLHReadBuffers(xBTUS5NumberOfItemsPerTick); - XTDReadBuffers(xBTUS5NumberOfItemsPerTick); - XFIReadBuffers(xBTUS5NumberOfItemsPerTick); - XTSReadBuffers(xBTUS5NumberOfItemsPerTick); - XRSIReadBuffers(xBTUS5NumberOfItemsPerTick); - XOBDReadBuffers(xBTUS5NumberOfItemsPerTick); - XCHMAReadBuffers(xBTUS5NumberOfItemsPerTick); - XCHLHReadBuffers(xBTUS5NumberOfItemsPerTick); - - // - xBTUS5Provider.ReadConditions(); -} - -// -// -// START Combination Functions ... -// -// - -// -// Can Open Long Trade ... -// this is a Function will Check all market Conditions and get all -// Strategy requirement Verifications for Long Signals ... -bool XBTUS5CanOpenLongTrade( - XProvidedSignal &info // Retrieve Signal Additional Info on this Object -) -{ - // - bool result = false; - - // - info.tp = 0; - info.sl = 0; - ArrayResize( - info.signallers, - 0); - - // - bool hasSignal = XBTUS5HasLongSignal(info); - - // - result = - // - hasSignal - // - ; - - // - if (result) - { - xBTUS5Provider.ClearConditions(); - } - - // - return result; -} - -// -// Can Close Long Trade ... -// this is a Function will Check all market Conditions and get all -// Strategy requirement Verifications for Long Signals ... -bool XBTUS5CanCloseLongTrade() -{ - // - bool result = false; - - // - return result; -} - -// -// Can Open Short Trade ... -// this is a Function will Check all market Conditions and get all -// Strategy requirement Verifications for Short Signals ... -bool XBTUS5CanOpenShortTrade( - XProvidedSignal &info // Retrieve Signal Additional Info on this Object -) -{ - // - bool result = false; - - // - info.tp = 0; - info.sl = 0; - ArrayResize( - info.signallers, - 0); - - // - bool hasSignal = XBTUS5HasShortSignal(info); - - // - result = - // - hasSignal - // - ; - - // - if (result) - { - xBTUS5Provider.ClearConditions(); - } - - // - return result; -} - -// -// Can Close Short Trade ... -// this is a Function will Check all market Conditions and get all -// Strategy requirement Verifications for Short Signals ... -bool XBTUS5CanCloseShortTrade() -{ - // - bool result = false; - - // - return result; -} - -// -// -// END Combination Functions ... -// -// - -// -// -// START Combination Signaling ... -// -// - -// -// Check Market Conditions by Combination of Power of All tools for LONGs ... -bool XBTUS5HasLongSignal( - XProvidedSignal &info // Retrieve Signal Additional Info on this Object -) -{ - // - bool result = false; - - // - // XTD ... - bool isXTDHasSignal = XBTUS5XTDHasLongSignal(); - if (isXTDHasSignal) - { - // - Add( - EnumToString(XTD), - info.signallers); - } - - // - // XTAM ... - bool isXTAMHasSignal = XBTUS5XTAMHasLongSignal(); - if (isXTAMHasSignal) - { - // - Add( - EnumToString(XTAM), - info.signallers); - } - - // - // XSI ... - bool isXSIHasSignal = XBTUS5XSIHasLongSignal(); - if (isXSIHasSignal) - { - // - Add( - EnumToString(XSI), - info.signallers); - } - - // - // XTSFI ... - bool isXTSFIHasSignal = XBTUS5XTSFIHasLongSignal(); - if (isXTSFIHasSignal) - { - // - Add( - EnumToString(XTSFI), - info.signallers); - } - - // - // XOBD XLH ... - bool isXOBDLHHasSignal = XBTUS5XOBDLHHasLongSignal(); - if (isXOBDLHHasSignal) - { - // - Add( - EnumToString(XOBDLH), - info.signallers); - } - - // - // XCHMA Cycles Cross ... - bool isXCHMACCHasSignal = XBTUS5XCHMACCHasLongSignal(); - if (isXCHMACCHasSignal) - { - // - Add( - EnumToString(XCHMACC), - info.signallers); - } - - // - // XCHMA Cycles Min ... - bool isXCHMAMNHasSignal = XBTUS5XCHMAMNHasLongSignal(); - if (isXCHMAMNHasSignal) - { - // - Add( - EnumToString(XCHMAMN), - info.signallers); - } - - // - // XCHMA Cycles Max - bool isXCHMAMXHasSignal = XBTUS5XCHMAMXHasLongSignal(); - if (isXCHMAMXHasSignal) - { - // - Add( - EnumToString(XCHMAMX), - info.signallers); - } - - // - result = - // - isXTDHasSignal - // - || - // - isXTAMHasSignal - // - || - // - isXSIHasSignal - // - || - // - isXTSFIHasSignal - // - || - // - isXOBDLHHasSignal - // - || - // - isXCHMACCHasSignal - // - || - // - isXCHMAMNHasSignal - // - || - // - isXCHMAMXHasSignal - // - ; - - // - if (result) - { - // - // Only Log Signals Time Market Conditions if is in Testing Mode ... - if (xBTUS5IsTestMode || xBTUS5EnableSignalAlerts) - { - // - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - string message = xBTUS5Provider.GenerateConditionsString(mConditions); - - // - LogMessage( - "Long Signal Provided by: \n" + - info.signallers[ArraySize(info.signallers) - 1] + "\n" + - "Pusher: " + (string)ArraySize(info.signallers) + "\n" + - "Market Conditions: " + message); - } - } - - // - return result; -} - -// -// Check Market Conditions by Combination of Power of All tools for SHORTs ... -bool XBTUS5HasShortSignal( - XProvidedSignal &info // Retrieve Signal Additional Info on this Object -) -{ - // - bool result = false; - - // - // XTD ... - bool isXTDHasSignal = XBTUS5XTDHasShortSignal(); - if (isXTDHasSignal) - { - // - Add( - EnumToString(XTD), - info.signallers); - } - - // - // XTAM ... - bool isXTAMHasSignal = XBTUS5XTAMHasShortSignal(); - if (isXTAMHasSignal) - { - // - Add( - EnumToString(XTAM), - info.signallers); - } - - // - // XSI ... - bool isXSIHasSignal = XBTUS5XSIHasShortSignal(); - if (isXSIHasSignal) - { - // - Add( - EnumToString(XSI), - info.signallers); - } - - // - // XTSFI ... - bool isXTSFIHasSignal = XBTUS5XTSFIHasShortSignal(); - if (isXTSFIHasSignal) - { - // - Add( - EnumToString(XTSFI), - info.signallers); - } - - // - // XOBD XLH ... - bool isXOBDLHHasSignal = XBTUS5XOBDLHHasShortSignal(); - if (isXOBDLHHasSignal) - { - // - Add( - EnumToString(XOBDLH), - info.signallers); - } - - // - // XCHMA Cycles Cross ... - bool isXCHMACCHasSignal = XBTUS5XCHMACCHasShortSignal(); - if (isXCHMACCHasSignal) - { - // - Add( - EnumToString(XCHMACC), - info.signallers); - } - - // - // XCHMA Cycles Min ... - bool isXCHMAMNHasSignal = XBTUS5XCHMAMNHasShortSignal(); - if (isXCHMAMNHasSignal) - { - // - Add( - EnumToString(XCHMAMN), - info.signallers); - } - - // - // XCHMA Cycles Max - bool isXCHMAMXHasSignal = XBTUS5XCHMAMXHasShortSignal(); - if (isXCHMAMXHasSignal) - { - // - Add( - EnumToString(XCHMAMX), - info.signallers); - } - - // - result = - // - isXTDHasSignal - // - || - // - isXTAMHasSignal - // - || - // - isXSIHasSignal - // - || - // - isXTSFIHasSignal - // - || - // - isXOBDLHHasSignal - // - || - // - isXCHMACCHasSignal - // - || - // - isXCHMAMNHasSignal - // - || - // - isXCHMAMXHasSignal - // - ; - - // - if (result) - { - // - // Only Log Signals Time Market Conditions if is in Testing Mode ... - if (xBTUS5IsTestMode || xBTUS5EnableSignalAlerts) - { - // - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - string message = xBTUS5Provider.GenerateConditionsString(mConditions); - - // - LogMessage( - "Short Signal Provided by: \n" + - info.signallers[ArraySize(info.signallers) - 1] + "\n" + - "Pusher: " + (string)ArraySize(info.signallers) + "\n" + - "Market Conditions: " + message); - } - } - - // - return result; -} - -// -// -// END Combination Signaling ... -// -// - -// -// START Signal Providers ... -// - -// -// Disbale All Signallers Longs ... -void XBTUS5DisableLongSignallers() -{ - // - // XTD ... - if (xBTUS5MXTDEnableSignaller) - { - // - xBTUS5Provider.DisbaleXTDLongs(); - xBTUS5MXTDAllowLongSignals = false; - } - - // - // XTAM ... - if (xBTUS5MXTAMEnableSignaller) - { - // - xBTUS5Provider.DisbaleXTAMLongs(); - xBTUS5MXTAMAllowLongSignals = false; - } - - // - // XSI ... - if (xBTUS5MXSIEnableSignaller) - { - // - xBTUS5Provider.DisbaleXSILongs(); - xBTUS5MXSIAllowLongSignals = false; - } - - // - // XTSFI ... - if (xBTUS5MXTSFIEnableSignaller) - { - // - xBTUS5Provider.DisbaleXTSFILongs(); - xBTUS5MXTSFIAllowLongSignals = false; - } - - // - // XOBDLH ... - // if (xBTUS5MXOBDLHEnableSignaller) - // { - // // - // xBTUS5Provider.DisbaleXOBDLHLongs(); - // xBTUS5MXOBDLHAllowLongSignals = false; - // } - - // - // XCHMACC ... - if (xBTUS5MXCHMACCEnableSignaller) - { - // - xBTUS5Provider.DisbaleXCHMACCLongs(); - xBTUS5MXCHMACCAllowLongSignals = false; - } - - // - // XCHMAMX ... - // if (xBTUS5MXCHMAMXEnableSignaller) - // { - // // - // xBTUS5Provider.DisbaleXCHMAMXLongs(); - // xBTUS5MXCHMAMXAllowLongSignals = false; - // } - - // - // XCHMAMN ... - // if (xBTUS5MXCHMAMNEnableSignaller) - // { - // // - // xBTUS5Provider.DisbaleXCHMAMNLongs(); - // xBTUS5MXCHMAMNAllowLongSignals = false; - // } -} - -// -// Enable All Signallers Longs ... -// Only if they are Configured as Enable at Settings ... -void XBTUS5EnableLongSignallers() -{ - // - // XTD ... - if (xBTUS5MXTDEnableSignaller) - { - // - xBTUS5MXTDAllowLongSignals = - xBTUS5XTDAllowLongSignals - ? true - : xBTUS5MXTDAllowLongSignals; - - // - if (xBTUS5MXTDAllowLongSignals) - { - xBTUS5Provider.EnableXTDLongs(); - } - } - - // - // XTAM ... - if (xBTUS5MXTAMEnableSignaller) - { - // - xBTUS5MXTAMAllowLongSignals = - xBTUS5XTAMAllowLongSignals - ? true - : xBTUS5MXTAMAllowLongSignals; - - // - if (xBTUS5MXTAMAllowLongSignals) - { - xBTUS5Provider.EnableXTAMLongs(); - } - } - - // - // XSI ... - if (xBTUS5MXSIEnableSignaller) - { - // - xBTUS5MXSIAllowLongSignals = - xBTUS5XSIAllowLongSignals - ? true - : xBTUS5MXSIAllowLongSignals; - - // - if (xBTUS5MXSIAllowLongSignals) - { - xBTUS5Provider.EnableXSILongs(); - } - } - - // - // XTSFI ... - if (xBTUS5MXTSFIEnableSignaller) - { - // - xBTUS5MXTSFIAllowLongSignals = - xBTUS5XTSFIAllowLongSignals - ? true - : xBTUS5MXTSFIAllowLongSignals; - - // - if (xBTUS5MXTSFIAllowLongSignals) - { - xBTUS5Provider.EnableXTSFILongs(); - } - } - - // - // XOBDLH ... - // if (xBTUS5MXOBDLHEnableSignaller) - // { - // // - // xBTUS5MXOBDLHAllowLongSignals = - // xBTUS5XOBDLHAllowLongSignals - // ? true - // : xBTUS5MXOBDLHAllowLongSignals; - - // // - // if (xBTUS5MXOBDLHAllowLongSignals) - // { - // xBTUS5Provider.EnableXOBDLHLongs(); - // } - // } - - // - // XCHMACC ... - if (xBTUS5MXCHMACCEnableSignaller) - { - // - xBTUS5MXCHMACCAllowLongSignals = - xBTUS5XCHMACCAllowLongSignals - ? true - : xBTUS5MXCHMACCAllowLongSignals; - - // - if (xBTUS5MXCHMACCAllowLongSignals) - { - xBTUS5Provider.EnableXCHMACCLongs(); - } - } - - // - // XCHMAMX ... - // if (xBTUS5MXCHMAMXEnableSignaller) - // { - // // - // xBTUS5MXCHMAMXAllowLongSignals = - // xBTUS5XCHMAMXAllowLongSignals - // ? true - // : xBTUS5MXCHMAMXAllowLongSignals; - - // // - // if (xBTUS5MXCHMAMXAllowLongSignals) - // { - // xBTUS5Provider.EnableXCHMAMXLongs(); - // } - // } - - // - // XCHMAMN ... - // if (xBTUS5MXCHMAMNEnableSignaller) - // { - // // - // xBTUS5MXCHMAMNAllowLongSignals = - // xBTUS5XCHMAMNAllowLongSignals - // ? true - // : xBTUS5MXCHMAMNAllowLongSignals; - - // // - // if (xBTUS5MXCHMAMNAllowLongSignals) - // { - // xBTUS5Provider.EnableXCHMAMNLongs(); - // } - // } -} - -// -// Disable All Signallers Shorts ... -void XBTUS5DisableShortSignallers() -{ - // - // XTD ... - if (xBTUS5MXTDEnableSignaller) - { - // - xBTUS5Provider.DisableXTDShorts(); - xBTUS5MXTDAllowShortSignals = false; - } - - // - // XTAM ... - if (xBTUS5MXTAMEnableSignaller) - { - // - xBTUS5Provider.DisableXTAMShorts(); - xBTUS5MXTAMAllowShortSignals = false; - } - - // - // XSI ... - if (xBTUS5MXSIEnableSignaller) - { - // - xBTUS5Provider.DisableXSIShorts(); - xBTUS5MXSIAllowShortSignals = false; - } - - // - // XTSFI ... - if (xBTUS5MXTSFIEnableSignaller) - { - // - xBTUS5Provider.DisableXTSFIShorts(); - xBTUS5MXTSFIAllowShortSignals = false; - } - - // - // XOBDLH ... - // if (xBTUS5MXOBDLHEnableSignaller) - // { - // // - // xBTUS5Provider.DisableXOBDLHShorts(); - // xBTUS5MXOBDLHAllowShortSignals = false; - // } - - // - // XCHMACC ... - if (xBTUS5MXCHMACCEnableSignaller) - { - // - xBTUS5Provider.DisableXCHMACCShorts(); - xBTUS5MXCHMACCAllowShortSignals = false; - } - - // - // XCHMAMX ... - // if (xBTUS5MXCHMAMXEnableSignaller) - // { - // // - // xBTUS5Provider.DisableXCHMAMXShorts(); - // xBTUS5MXCHMAMXAllowShortSignals = false; - // } - - // - // XCHMAMN ... - // if (xBTUS5MXCHMAMNEnableSignaller) - // { - // // - // xBTUS5Provider.DisableXCHMAMNShorts(); - // xBTUS5MXCHMAMNAllowShortSignals = false; - // } -} - -// -// Enable All Signallers Shorts ... -// Only if they are Configured as Enable at Settings ... -void XBTUS5EnableShortSignallers() -{ - // - // XTD ... - if (xBTUS5MXTDEnableSignaller) - { - // - xBTUS5MXTDAllowShortSignals = - xBTUS5XTDAllowShortSignals - ? true - : xBTUS5MXTDAllowShortSignals; - - // - if (xBTUS5MXTDAllowShortSignals) - { - xBTUS5Provider.EnableXTDShorts(); - } - } - - // - // XTAM ... - if (xBTUS5MXTAMEnableSignaller) - { - // - xBTUS5MXTAMAllowShortSignals = - xBTUS5XTAMAllowShortSignals - ? true - : xBTUS5MXTAMAllowShortSignals; - - // - if (xBTUS5MXTAMAllowShortSignals) - { - xBTUS5Provider.EnableXTAMShorts(); - } - } - - // - // XSI ... - if (xBTUS5MXSIEnableSignaller) - { - // - xBTUS5MXSIAllowShortSignals = - xBTUS5XSIAllowShortSignals - ? true - : xBTUS5MXSIAllowShortSignals; - - // - if (xBTUS5MXSIAllowShortSignals) - { - xBTUS5Provider.EnableXSIShorts(); - } - } - - // - // XTSFI ... - if (xBTUS5MXTSFIEnableSignaller) - { - // - xBTUS5MXTSFIAllowShortSignals = - xBTUS5XTSFIAllowShortSignals - ? true - : xBTUS5MXTSFIAllowShortSignals; - - // - if (xBTUS5MXTSFIAllowShortSignals) - { - xBTUS5Provider.EnableXTSFIShorts(); - } - } - - // - // XOBDLH ... - // if (xBTUS5MXOBDLHEnableSignaller) - // { - // // - // xBTUS5MXOBDLHAllowShortSignals = - // xBTUS5XOBDLHAllowShortSignals - // ? true - // : xBTUS5MXOBDLHAllowShortSignals; - - // // - // if (xBTUS5MXOBDLHAllowShortSignals) - // { - // xBTUS5Provider.EnableXOBDLHShorts(); - // } - // } - - // - // XCHMACC ... - if (xBTUS5MXCHMACCEnableSignaller) - { - // - xBTUS5MXCHMACCAllowShortSignals = - xBTUS5XCHMACCAllowShortSignals - ? true - : xBTUS5MXCHMACCAllowShortSignals; - - // - if (xBTUS5MXCHMACCAllowShortSignals) - { - xBTUS5Provider.EnableXCHMACCShorts(); - } - } - - // - // XCHMAMX ... - // if (xBTUS5MXCHMAMXEnableSignaller) - // { - // // - // xBTUS5MXCHMAMXAllowShortSignals = - // xBTUS5XCHMAMXAllowShortSignals - // ? true - // : xBTUS5MXCHMAMXAllowShortSignals; - - // // - // if (xBTUS5MXCHMAMXAllowShortSignals) - // { - // xBTUS5Provider.EnableXCHMAMXShorts(); - // } - // } - - // - // XCHMAMN ... - // if (xBTUS5MXCHMAMNEnableSignaller) - // { - // // - // xBTUS5MXCHMAMNAllowShortSignals = - // xBTUS5XCHMAMNAllowShortSignals - // ? true - // : xBTUS5MXCHMAMNAllowShortSignals; - - // // - // if (xBTUS5MXCHMAMNAllowShortSignals) - // { - // xBTUS5Provider.EnableXCHMAMNShorts(); - // } - // } -} - -// -// -// - -// -// XTD Long Signal Checking ... -bool XBTUS5XTDHasLongSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXTDEnableSignaller || - !xBTUS5MXTDAllowLongSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XTDHasLongConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTD Long ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTD Long ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTD Long ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTD Long ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Long ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XTD Short Signal Checking ... -bool XBTUS5XTDHasShortSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXTDEnableSignaller || - !xBTUS5MXTDAllowShortSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XTDHasShortConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTD Short ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTD Short ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTD Short ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTD Short ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTD Short ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XTAM Long Signal Checking ... -bool XBTUS5XTAMHasLongSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXTAMEnableSignaller || - !xBTUS5MXTAMAllowLongSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XTAMHasLongConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTAM Long ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTAM Long ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTAM Long ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTAM Long ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Long ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XTAM Short Signal Checking ... -bool XBTUS5XTAMHasShortSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXTAMEnableSignaller || - !xBTUS5MXTAMAllowShortSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XTAMHasShortConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTAM Short ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTAM Short ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTAM Short ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTAM Short ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTAM Short ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XSI Long Signal Checking ... -bool XBTUS5XSIHasLongSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXSIEnableSignaller || - !xBTUS5MXSIAllowLongSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XSIHasLongConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XSI Long ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XSI Long ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XSI Long ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XSI Long ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Long ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XSI Short Signal Checking ... -bool XBTUS5XSIHasShortSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXSIEnableSignaller || - !xBTUS5MXSIAllowShortSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XSIHasShortConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XSI Short ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XSI Short ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XSI Short ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XSI Short ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XSI Short ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XTSFI Long Signal Checking ... -bool XBTUS5XTSFIHasLongSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXTSFIEnableSignaller || - !xBTUS5MXTSFIAllowLongSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XTSFIHasLongConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTSFI Long ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTSFI Long ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTSFI Long ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTSFI Long ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Long ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XTSFI Short Signal Checking ... -bool XBTUS5XTSFIHasShortSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXTSFIEnableSignaller || - !xBTUS5MXTSFIAllowShortSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XTSFIHasShortConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTSFI Short ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTSFI Short ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTSFI Short ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XTSFI Short ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XTSFI Short ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XOBDLH Long Signal Checking ... -bool XBTUS5XOBDLHHasLongSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXOBDLHEnableSignaller || - !xBTUS5MXOBDLHAllowLongSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XOBDLHHasLongConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XOBDLH Long ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XOBDLH Long ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XOBDLH Long ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XOBDLH Long ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Long ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XOBDLH Short Signal Checking ... -bool XBTUS5XOBDLHHasShortSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXOBDLHEnableSignaller || - !xBTUS5MXOBDLHAllowShortSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XOBDLHHasShortConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XOBDLH Short ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XOBDLH Short ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XOBDLH Short ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XOBDLH Short ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XOBDLH Short ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XCHMACC Long Signal Checking ... -bool XBTUS5XCHMACCHasLongSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXCHMACCEnableSignaller || - !xBTUS5MXCHMACCAllowLongSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XCHMACCHasLongConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMACC Long ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMACC Long ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMACC Long ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMACC Long ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Long ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XCHMACC Short Signal Checking ... -bool XBTUS5XCHMACCHasShortSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXCHMACCEnableSignaller || - !xBTUS5MXCHMACCAllowShortSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XCHMACCHasShortConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMACC Short ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMACC Short ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMACC Short ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMACC Short ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMACC Short ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XCHMAMN Long Signal Checking ... -bool XBTUS5XCHMAMNHasLongSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXCHMAMNEnableSignaller || - !xBTUS5MXCHMAMNAllowLongSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XCHMAMNHasLongConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMN Long ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMN Long ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMN Long ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMN Long ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Long ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XCHMAMN Short Signal Checking ... -bool XBTUS5XCHMAMNHasShortSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXCHMAMNEnableSignaller || - !xBTUS5MXCHMAMNAllowShortSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XCHMAMNHasShortConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMN Short ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMN Short ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMN Short ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMN Short ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMN Short ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XCHMAMX Long Signal Checking ... -bool XBTUS5XCHMAMXHasLongSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXCHMAMXEnableSignaller || - !xBTUS5MXCHMAMXAllowLongSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XCHMAMXHasLongConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMX Long ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMX Long ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMX Long ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMX Long ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Long ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// XCHMAMX Short Signal Checking ... -bool XBTUS5XCHMAMXHasShortSignal() -{ - // - bool result = false; - - // - // Validate Args ... - if (!xBTUS5MXCHMAMXEnableSignaller || - !xBTUS5MXCHMAMXAllowShortSignals) - { - return result; - } - - // - // Retrieve Market Condition ... - XMarketConditions mConditions = xBTUS5Provider.GetLastMarketCondition(); - - // - // Start Analysing Market based On Conditions ... - result = - // - // Base Condition: - xBTUS5Provider.XCHMAMXHasShortConditions() - // - && - // - // Exceptions: - // there some commonly Exceptions which makes our choice incorrect, - // here we are combined knownly Exceptions ... - !( - // - // for Exception we used XLH Conditions as follow ... - // - // Check Conditions if Price In Signal Range ... - (mConditions.isXLHPriceInSignalRange && - // - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMX Short ... - // PriceInSignalRange ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceInSignalRange ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceInSignalRange ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceInSignalRange ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Under Signal ... - ( - // - ((mConditions.isXLHPriceUnderSignal || - mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMX Short ... - // PriceUnderSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceUnderSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceUnderSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceUnderSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is Over Signal ... - ( - // - ((mConditions.isXLHPriceOverSignal || - mConditions.isXLHPriceCrossedOverSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMX Short ... - // PriceOverSignal ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceOverSignal ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceOverSignal ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceOverSignal ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - || - // - // Check Conditions if Price is not has clear state ... - ( - // - ((!mConditions.isXLHPriceOverSignal && - !mConditions.isXLHPriceUnderSignal && - !mConditions.isXLHPriceInSignalRange && - !mConditions.isXLHPriceCrossedOverSignal && - !mConditions.isXLHPriceCrossedUnderSignal) && - ( - // - // Next Step is to Check LL and HH Same Style ... - // - // XCHMAMX Short ... - // PriceFree ... - // Check if Both LL and HH Same In Length ... - ((mConditions.isXLHLLSameInLength && - mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceFree ... - // Check If LL Same In Length ... - ((mConditions.isXLHLLSameInLength && - !mConditions.isXLHHHSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceFree ... - // Check If HH is Same In Length ... - ((mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - || - // - // XCHMAMX Short ... - // PriceFree ... - // Not Same LL or HH in Lenght ... - ((!mConditions.isXLHHHSameInLength && - !mConditions.isXLHLLSameInLength) && - // - ( - false) - // - ) - // - ) - // - ) - // - ) - // - ) - // - ; - - // - return result; -} - -// -// END Signal Providers ... -// diff --git a/Providers/x-saherelm.xbtus5.provider.inputs.lib.mq5 b/Providers/x-saherelm.xbtus5.provider.inputs.lib.mq5 deleted file mode 100644 index b6b8f1a1..00000000 --- a/Providers/x-saherelm.xbtus5.provider.inputs.lib.mq5 +++ /dev/null @@ -1,283 +0,0 @@ -/////////////////////////////////////////////////////////////// -// -// SaherElm IT Center MQL5 XBTUS5 Signal Provider Library Inputs -// ----------------------------------------------------------- -// -// Maintainer: -// ------------ -// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) -// -////////////////////////////////////////////////////// -// -// Global Properties ... -#property library -#property copyright "Copyright 2023, SaherElm IT Center" -#property link "https://www.saherelm.ir" -#property version "1.00" -#property strict - -// -// Include Logger ... -#include "../Libraries/x-saherelm.log.lib.mq5" - -// -// Include Classes ... -#include "../Classes/x-saherelm.class.lib.mq5" - -// -input group "XBTUS5 Provider"; - -// -// Commonly Used Configurations ... -input group "XBTUS5 Common"; -// -// Provider ... -input bool xBTUS5EnableProvider = true; // Enable Provider -input int xBTUS5NumberOfItemsPerTick = 30; // Number Of items Readed In Each Tick -// -// Alerts ... -input bool xBTUS5EnableAlerts = true; // Enable Events Alert -input bool xBTUS5EnableHourlyAlerts = false; // Send Alert on each new Hour -input bool xBTUS5EnableDailyAlerts = false; // Send Alert on each new Day -input bool xBTUS5EnableWeeklyAlerts = false; // Send Alert on each new Week -input bool xBTUS5EnableMonthlyAlerts = false; // Send Alert on each new Month -// -// Reports ... -input bool xBTUS5EnableDailyReports = false; // Send Report on each new Day -input bool xBTUS5EnableWeeklyReports = false; // Send Report on each new Week -input bool xBTUS5EnableMonthlyReports = false; // Send Report on each new Month - -// -// Trader and Expert Specific Configurations ... -input group "XBTUS5 Trader"; -input int xBTUS5MagicNumber = 16940563; // Trader MagicNumber -input int xBTUS5Slippage = 10; // Trader Slippage - -// -// Trades Management Configurations ... -input group "XBTUS5 Trade Management"; -input bool xBTUS5AllowLongTrades = true; // Allow Long Trades -input bool xBTUS5AllowShortTrades = true; // Allow Short Trades - -// -// Risk Management Configurations ... -input group "XBTUS5 Risk Management"; -// -// Trade Count ... -input int xBTUS5MaxAllowedTrades = 10; // Max Allowed Trades at Same Time -input ENUM_X_CROSS_SIGNAL_METHOD xBTUS5CrossSignalsMethod = X_CROSS_SIGNAL_REGULAR; // Handle Cross Signals Method -// -// Max Allowed Trade Age ... -input int xBTUS5MaxAllowedTradeAge = 1500; // Detect Long Time Trades -input ENUM_X_GUARD_ACTIONS xBTUS5OldTradesAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_1; // What to do with Old Trades -// -// Trade Volume Specific Configurations ... -input double xBTUS5StaticVolumeFactor = 0.0001; // Static Volume baesd on Balance -input ENUM_STATIC_VOLUME_METHODS xBTUS5StaticVolumeMethod = X_STATIC_VOLUME_BASED_ON_BALANCE; // How to Calculate Static Volume -input double xBTUS5VolumeMultiplier = 0; // Volume Increase Multiplier -input double xBTUS5ApplyVolumeMultiplierFactor = 0; // Apply Volume Multiplier Rate based on Balance -input double xBTUS5MaxSupportedVolumePerTradeFactor = 0; // Max Supported Volume Per Trade Factor based on Balance -input double xBTUS5IncreasedMaxSupportedVolumeRate = 0; // Increase Max Supported Volume based on Balance -// -// Trade Profits ... -input double xBTUS5MinRewardInPips = 60; // Minimum Reward Per Trade in Pips -input double xBTUS5RiskFreeStepInPips = 0; // Make Trades Risk Free Steps in Pips -input double xBTUS5RiskFreeRate = 0; // Volume Multiplier for Risk Free Trades -// -// Guard Riskable Money and Profits ... -input double xBTUS5CriticalDrawDownFactor = 0.30; // Critical Allowed Drawdown Factor based on Balance -input ENUM_X_GUARD_ACTIONS xBTUS5CriticalGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_1; // Specify Guard Action on Critical Drawdown -input double xBTUS5MaxAllowedDrawDownFactor = 0.40; // Max Allowed Drawdown Factor based on Balance -input ENUM_X_GUARD_ACTIONS xBTUS5MaxAllowedGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_5; // Specify Guard Action on Max Allowed Drawdown -input int xBTUS5GuardStopoutFiredAfterTouches = 5; // Guard Stopout all Trades if Max Allowed Drawdown touched - -// -// Account Conditions for Trading ... -input double xBTUS5BalanceFactorForOpenTrades = 0.5; // Minimum Balance for Open Trades -input double xBTUS5FreeMarginFactorForOpenTrades = 0.8; // Minimum Free Margin for Open Trades - -// -// May be Used Later as Input Params ... -bool xBTUS5UseVirtualTPSl = false; // Use Virtual TP SL -bool xBTUS5EnableSignalAlerts = false; // Send Signal Alert - -// -// Validate Inputs before Initialization ... -bool XBTUS5ValidateInputs() -{ - // - bool result = false; - - // - // Implement Other Verifications ... - - // - // Check Trading Availability ... - bool isTradeAvailable = xBTUS5AllowLongTrades || xBTUS5AllowShortTrades; - if (!isTradeAvailable) - { - LogMessage("XBTUS5 => Warning: Trading disabled ..."); - } - - // - // Chekc Number of reading items per tick ... - result = xBTUS5NumberOfItemsPerTick >= 5; - if (!result) - { - // - LogMessage("XBTUS5 invalid Number of items Reading Per Tick ..."); - - // - return result; - } - - // - // Check Max Allowed Trades Count ... - result = isTradeAvailable && xBTUS5MaxAllowedTrades >= 1; - if (!result) - { - // - LogMessage("XBTUS5 Number of Trades not valid ..."); - - // - return result; - } - - // - // Check Free Margin ... - result = - isTradeAvailable && - xBTUS5FreeMarginFactorForOpenTrades > 0 && - xBTUS5FreeMarginFactorForOpenTrades < 1; - if (!result) - { - // - LogMessage("XBTUS5 Invalid Free Margin ..."); - - // - return result; - } - - // - // Check min Balance for Open Trades ... - result = - isTradeAvailable && - xBTUS5BalanceFactorForOpenTrades > 0 && - xBTUS5BalanceFactorForOpenTrades < 1; - if (!result) - { - // - LogMessage("XBTUS5 Invalid Min Balance for Open Trades ..."); - - // - return result; - } - - // - // Check Min Reward Per Trade ... - result = xBTUS5MinRewardInPips > 0; - if (!result) - { - // - LogMessage("XBTUS5 Invalid Min Reward Per Trade ..."); - - // - return result; - } - - // - // Check Trades Volume ... - result = xBTUS5StaticVolumeFactor > 0; - if (!result) - { - // - LogMessage("XBTUS5 Invalid Static Volume ..."); - - // - return result; - } - - // - // Check Volume Multiplier ... - result = xBTUS5VolumeMultiplier >= 0; - if (!result) - { - // - LogMessage("XBTUS5 Invalid Volume Multiplier ..."); - - // - return result; - } - - // - result = - xBTUS5CriticalDrawDownFactor == 0 || (xBTUS5CriticalDrawDownFactor > 0 && - xBTUS5CriticalDrawDownFactor < 1); - if (!result) - { - // - LogMessage("XBTUS5 Invalid Critical DrawDown Factor ..."); - - // - return result; - } - - // - result = - xBTUS5MaxAllowedDrawDownFactor == 0 || (xBTUS5MaxAllowedDrawDownFactor > 0 && - xBTUS5MaxAllowedDrawDownFactor < 1); - if (!result) - { - // - LogMessage("XBTUS5 Invalid Max Allowed DrawDown Factor ..."); - - // - return result; - } - - // - // Check Guard Actions ... - // - result = - xBTUS5CriticalDrawDownFactor > 0 && - xBTUS5CriticalDrawDownFactor < 1 && - xBTUS5MaxAllowedDrawDownFactor > 0 && - xBTUS5MaxAllowedDrawDownFactor < 1; - if (!result) - { - // - LogMessage("XBTUS5 For Critical Drawdown, you have to Specify Max Drawdown also ..."); - - // - return result; - } - - // - result = xBTUS5CriticalDrawDownFactor > 0 && xBTUS5CriticalDrawDownFactor < xBTUS5MaxAllowedDrawDownFactor; - if (!result) - { - // - LogMessage("XBTUS5 Critical Drawdown must Smaller than Max Drawdown ..."); - - // - return result; - } - - // - if (xBTUS5CriticalDrawDownFactor > 0 && xBTUS5CriticalGuardAction == X_GUARD_DO_NOTHING) - { - LogMessage("XBTUS5 IMPORTANT you Specified Critical Drawdown, but there is no any Guard Action ..."); - } - - // - if (xBTUS5MaxAllowedDrawDownFactor > 0 && xBTUS5MaxAllowedGuardAction == X_GUARD_DO_NOTHING) - { - LogMessage("XBTUS5 IMPORTANT you Specified Max Allowed Drawdown, but there is no any Guard Action ..."); - } - - // - result = true; - - // - return result; -} \ No newline at end of file diff --git a/Providers/x-saherelm.xtest.provider.indicators.lib.mq5 b/Providers/x-saherelm.xtest.provider.indicators.lib.mq5 new file mode 100644 index 00000000..ee4ff3f3 --- /dev/null +++ b/Providers/x-saherelm.xtest.provider.indicators.lib.mq5 @@ -0,0 +1,2084 @@ +/////////////////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 XTEST Signal Provider Indicators Library +// ---------------------------------------------------------------- +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Include Provider Inputs ... +#include "x-saherelm.xtest.provider.inputs.lib.mq5" + +// +// Include Provider Class ... +#include "../Classes/x-saherelm.provider.lib.mq5" + +// +// Signallers ... +input group "XTEST Signallers"; + +// +// XTD ... +input group "XTEST XTD Signaller"; +input bool xTESTXTDEnableSignaller = true; // Enable Signaller +input bool xTESTXTDAllowLongSignals = true; // Enable Long Signals +input bool xTESTXTDAllowShortSignals = true; // Enable Short Signals + +// +// XTAM ... +input group "XTEST XTAM Signaller"; +input bool xTESTXTAMEnableSignaller = true; // Enable Signaller +input bool xTESTXTAMAllowLongSignals = true; // Enable Long Signals +input bool xTESTXTAMAllowShortSignals = true; // Enable Short Signals + +// +// XSI ... +input group "XTEST XSI Signaller"; +input bool xTESTXSIEnableSignaller = true; // Enable Signaller +input bool xTESTXSIAllowLongSignals = true; // Enable Long Signals +input bool xTESTXSIAllowShortSignals = true; // Enable Short Signals + +// +// XTSFI ... +input group "XTEST XTSFI Signaller"; +input bool xTESTXTSFIEnableSignaller = true; // Enable Signaller +input bool xTESTXTSFIAllowLongSignals = true; // Enable Long Signals +input bool xTESTXTSFIAllowShortSignals = true; // Enable Short Signals + +// +// XOBDLH ... +// input group "XTEST XOBDLH Signaller"; +// input bool xTESTXOBDLHEnableSignaller = true; // Enable Signaller +// input bool xTESTXOBDLHAllowLongSignals = true; // Enable Long Signals +// input bool xTESTXOBDLHAllowShortSignals = true; // Enable Short Signals + +// +// XCHMACC ... +input group "XTEST XCHMACC Signaller"; +input bool xTESTXCHMACCEnableSignaller = true; // Enable Signaller +input bool xTESTXCHMACCAllowLongSignals = true; // Enable Long Signals +input bool xTESTXCHMACCAllowShortSignals = true; // Enable Short Signals + +// +// XCHMAMX ... +// input group "XTEST XCHMAMX Signaller"; +// input bool xTESTXCHMAMXEnableSignaller = true; // Enable Signaller +// input bool xTESTXCHMAMXAllowLongSignals = true; // Enable Long Signals +// input bool xTESTXCHMAMXAllowShortSignals = true; // Enable Short Signals + +// +// XCHMAMN ... +input group "XTEST XCHMAMN Signaller"; +// input bool xTESTXCHMAMNEnableSignaller = true; // Enable Signaller +// input bool xTESTXCHMAMNAllowLongSignals = true; // Enable Long Signals +// input bool xTESTXCHMAMNAllowShortSignals = true; // Enable Short Signals + +// +// Check in Test Mode or not ... +bool xTESTIsTestMode = false; + +// +// Detect max Input Length of Indicators ... +int xTESTMaxLengthOfInputs = 0; + +// +// Detect Calculated Bars ... +int xTESTCalculatedBars = 0; + +// +// Check prevent Double Signalling on Same Candle ... +bool xTESTWaitUntilNextCandle = false; + +// +// Signaller Variables ... +// +// XTD ... +bool xTESTMXTDEnableSignaller = xTESTXTDEnableSignaller; +bool xTESTMXTDAllowLongSignals = xTESTXTDAllowLongSignals; +bool xTESTMXTDAllowShortSignals = xTESTXTDAllowShortSignals; + +// +// XTAM ... +bool xTESTMXTAMEnableSignaller = xTESTXTAMEnableSignaller; +bool xTESTMXTAMAllowLongSignals = xTESTXTAMAllowLongSignals; +bool xTESTMXTAMAllowShortSignals = xTESTXTAMAllowShortSignals; + +// +// XSI ... +bool xTESTMXSIEnableSignaller = xTESTXSIEnableSignaller; +bool xTESTMXSIAllowLongSignals = xTESTXSIAllowLongSignals; +bool xTESTMXSIAllowShortSignals = xTESTXSIAllowShortSignals; + +// +// XTSFI ... +bool xTESTMXTSFIEnableSignaller = xTESTXTSFIEnableSignaller; +bool xTESTMXTSFIAllowLongSignals = xTESTXTSFIAllowLongSignals; +bool xTESTMXTSFIAllowShortSignals = xTESTXTSFIAllowShortSignals; + +// +// XOBDLH ... +bool xTESTMXOBDLHEnableSignaller = false; // xTESTXOBDLHEnableSignaller; +bool xTESTMXOBDLHAllowLongSignals = false; // xTESTXOBDLHAllowLongSignals; +bool xTESTMXOBDLHAllowShortSignals = false; // xTESTXOBDLHAllowShortSignals; + +// +// XCHMACC ... +bool xTESTMXCHMACCEnableSignaller = xTESTXCHMACCEnableSignaller; +bool xTESTMXCHMACCAllowLongSignals = xTESTXCHMACCAllowLongSignals; +bool xTESTMXCHMACCAllowShortSignals = xTESTXCHMACCAllowShortSignals; + +// +// XCHMAMX ... +bool xTESTMXCHMAMXEnableSignaller = false; // xTESTXCHMAMXEnableSignaller; +bool xTESTMXCHMAMXAllowLongSignals = false; // xTESTXCHMAMXAllowLongSignals; +bool xTESTMXCHMAMXAllowShortSignals = false; // xTESTXCHMAMXAllowShortSignals; + +// +// XCHMAMN ... +bool xTESTMXCHMAMNEnableSignaller = false; // xTESTXCHMAMNEnableSignaller; +bool xTESTMXCHMAMNAllowLongSignals = false; // xTESTXCHMAMNAllowLongSignals; +bool xTESTMXCHMAMNAllowShortSignals = false; // xTESTXCHMAMNAllowShortSignals; + +// +XCProvider *xTESTProvider; + +// +// Validate Indicators Inputs ... +bool XTESTValidateIndicatorsInputs() +{ + // + bool result = false; + + // + // XTM ... + result = XTMValidateInputs(); + if (!result) + { + return result; + } + + // + // XAMA ... + result = XAMAValidateInputs(); + if (!result) + { + return result; + } + + // + // XTD ... + result = XTDValidateInputs(); + if (!result) + { + return result; + } + + // + // XFI ... + result = XFIValidateInputs(); + if (!result) + { + return result; + } + + // + // XTS ... + result = XTSValidateInputs(); + if (!result) + { + return result; + } + + // + // XOBD ... + result = XOBDValidateInputs(); + if (!result) + { + return result; + } + + // + // XLH ... + result = XLHValidateInputs(); + if (!result) + { + return result; + } + + // + // XRSI ... + result = XRSIValidateInputs(); + if (!result) + { + return result; + } + + // + // XCHLH ... + result = XCHLHValidateInputs(); + if (!result) + { + return result; + } + + // + // XCHMA ... + result = XCHMAValidateInputs(); + if (!result) + { + return result; + } + + // + // Make an Instance Of XCProvider Class for Use ... + xTESTProvider = new XCProvider( + // + // Commons ... + _Symbol, + _Period, + // + // Signallers ... + // + // XTD ... + xTESTMXTDEnableSignaller, + xTESTMXTDAllowLongSignals, + xTESTMXTDAllowShortSignals, + // + // XTAM ... + xTESTMXTAMEnableSignaller, + xTESTMXTAMAllowLongSignals, + xTESTMXTAMAllowShortSignals, + // + // XSI ... + xTESTMXSIEnableSignaller, + xTESTMXSIAllowLongSignals, + xTESTMXSIAllowShortSignals, + // + // XTSFI ... + xTESTMXTSFIEnableSignaller, + xTESTMXTSFIAllowLongSignals, + xTESTMXTSFIAllowShortSignals, + // + // XOBDLH ... + xTESTMXOBDLHEnableSignaller, + xTESTMXOBDLHAllowLongSignals, + xTESTMXOBDLHAllowShortSignals, + // + // XCHMACC ... + xTESTMXCHMACCEnableSignaller, + xTESTMXCHMACCAllowLongSignals, + xTESTMXCHMACCAllowShortSignals, + // + // XCHMAMX ... + xTESTMXCHMAMXEnableSignaller, + xTESTMXCHMAMXAllowLongSignals, + xTESTMXCHMAMXAllowShortSignals, + // + // XCHMAMN ... + xTESTMXCHMAMNEnableSignaller, + xTESTMXCHMAMNAllowLongSignals, + xTESTMXCHMAMNAllowShortSignals + // + ); + + // + result = true; + + // + return result; +} + +// +// Init Indicators ... +bool XTESTInitIndicators() +{ + // + bool result = false; + + // + // Make it Enable when we need to Log Market Conditions ... + xTESTIsTestMode = IsRunningOnTestMode(); + + // + // Check and Calculate Max Length in Inputs ... + // + + // + // XTM ... + xTESTMaxLengthOfInputs = MathMax( + xTMMaPeriod, + xTESTNumberOfItemsPerTick); + + // + // XAMA ... + xTESTMaxLengthOfInputs = MathMax( + xAMALength, + xTESTNumberOfItemsPerTick); + xTESTMaxLengthOfInputs = MathMax( + xAMAFastEMA, + xTESTNumberOfItemsPerTick); + xTESTMaxLengthOfInputs = MathMax( + xAMASlowEMA, + xTESTNumberOfItemsPerTick); + + // + // XLH ... + xTESTMaxLengthOfInputs = MathMax( + xLHLength, + xTESTNumberOfItemsPerTick); + + // + // XTD ... + xTESTMaxLengthOfInputs = MathMax( + xTDLength, + xTESTMaxLengthOfInputs); + + // + // XFI ... + xTESTMaxLengthOfInputs = MathMax( + xFILength, + xTESTMaxLengthOfInputs); + + // + // XRSI ... + xTESTMaxLengthOfInputs = MathMax( + xRSILength, + xTESTMaxLengthOfInputs); + + // + // XOBD ... + xTESTMaxLengthOfInputs = MathMax( + xOBDLength, + xTESTMaxLengthOfInputs); + + // + // XCHLH ... + xTESTMaxLengthOfInputs = MathMax( + xCHLHLcLength, + xTESTMaxLengthOfInputs); + xTESTMaxLengthOfInputs = MathMax( + xCHLHMcLength, + xTESTMaxLengthOfInputs); + xTESTMaxLengthOfInputs = MathMax( + xCHLHScLength, + xTESTMaxLengthOfInputs); + + // + // XCHMA ... + xTESTMaxLengthOfInputs = MathMax( + xCHMAScFastLength, + xTESTMaxLengthOfInputs); + xTESTMaxLengthOfInputs = MathMax( + xCHMAScSlowLength, + xTESTMaxLengthOfInputs); + xTESTMaxLengthOfInputs = MathMax( + xCHMAMcFastLength, + xTESTMaxLengthOfInputs); + xTESTMaxLengthOfInputs = MathMax( + xCHMAMcSlowLength, + xTESTMaxLengthOfInputs); + xTESTMaxLengthOfInputs = MathMax( + xCHMALcFastLength, + xTESTMaxLengthOfInputs); + xTESTMaxLengthOfInputs = MathMax( + xCHMALcSlowLength, + xTESTMaxLengthOfInputs); + + // + // Validate Indicators Inputs before Initialization ... + result = XTESTValidateIndicatorsInputs(); + if (!result) + { + return result; + } + + // + // Validate Signallers ... + + // + // XTD ... + bool isXTDEnable = + xTESTXTDEnableSignaller && + (xTESTXTDAllowLongSignals || + xTESTXTDAllowShortSignals); + + // + // XTAM ... + bool isXTAMEnable = + xTESTXTAMEnableSignaller && + (xTESTXTAMAllowLongSignals || + xTESTXTAMAllowShortSignals); + + // + // XSI ... + bool isXSIEnable = + xTESTXSIEnableSignaller && + (xTESTXSIAllowLongSignals || + xTESTXSIAllowShortSignals); + + // + // XTSFI ... + bool isXTSFIEnable = + xTESTXTSFIEnableSignaller && + (xTESTXTSFIAllowLongSignals || + xTESTXTSFIAllowShortSignals); + + // + // XOBDLH ... + bool isXOBDLHEnable = false; + // xTESTXOBDLHEnableSignaller && + // (xTESTXOBDLHAllowLongSignals || + // xTESTXOBDLHAllowShortSignals); + + // + // XCHMACC ... + bool isXCHMACCEnable = + xTESTXCHMACCEnableSignaller && + (xTESTXCHMACCAllowLongSignals || + xTESTXCHMACCAllowShortSignals); + + // + // XCHMAMX ... + bool isXCHMAMXEnable = false; + // xTESTXCHMAMXEnableSignaller && + // (xTESTXCHMAMXAllowLongSignals || + // xTESTXCHMAMXAllowShortSignals); + + // + // XCHMAMN ... + bool isXCHMAMNEnable = false; + // xTESTXCHMAMNEnableSignaller && + // (xTESTXCHMAMNAllowLongSignals || + // xTESTXCHMAMNAllowShortSignals); + + // + bool hasSignaller = + // + isXTDEnable || + isXTAMEnable || + isXSIEnable || + isXTSFIEnable || + isXOBDLHEnable || + isXCHMACCEnable || + isXCHMAMXEnable || + isXCHMAMNEnable + // + ; + result = hasSignaller; + if (!result) + { + // + LogMessage("XTEST doesn't enable any Signaller ..."); + + // + return result; + } + + // + // Initialize Indicator/Oscillator Handlers ... + ResetLastError(); + + // + // XTM Init ... + result = XTMInitHandlers(); + if (!result) + { + return result; + } + + // + // XAMA Init ... + result = XAMAInitHandlers(); + if (!result) + { + return result; + } + + // + // XLH Init ... + result = XLHInitHandlers(); + if (!result) + { + return result; + } + + // + // XTD Init ... + result = XTDInitHandlers(); + if (!result) + { + return result; + } + + // + // XFI Init ... + result = XFIInitHandlers(); + if (!result) + { + return result; + } + + // + // XTS Init ... + result = XTSInitHandlers(); + if (!result) + { + return result; + } + + // + // XRSI Init ... + result = XRSIInitHandlers(); + if (!result) + { + return result; + } + + // + // XOBD Init ... + result = XOBDInitHandlers(); + if (!result) + { + return result; + } + + // + // XCLH Init ... + result = XCHLHInitHandlers(); + if (!result) + { + return result; + } + + // + // XCHMA Init ... + result = XCHMAInitHandlers(); + if (!result) + { + return result; + } + + // + result = true; + + // + return result; +} + +// +// Release Indicators ... +void XTESTReleaseIndicators() +{ + // + // Release Handlers ... + XTMReleaseHandlers(); + XAMAReleaseHandlers(); + XLHReleaseHandlers(); + XTDReleaseHandlers(); + XFIReleaseHandlers(); + XTSReleaseHandlers(); + XRSIReleaseHandlers(); + XOBDReleaseHandlers(); + XCHMAReleaseHandlers(); + XCHLHReleaseHandlers(); +} + +// +// Handle Reading Buffers ... +void XTESTHandleReadingBuffers() +{ + // + // Reading Calculated Bars for a Simple Handler ... + xTESTCalculatedBars = BarsCalculated(xTMHandler); + + // + // Read Indicators Buffers ... + XTMReadBuffers(xTESTNumberOfItemsPerTick); + XAMAReadBuffers(xTESTNumberOfItemsPerTick); + XLHReadBuffers(xTESTNumberOfItemsPerTick); + XTDReadBuffers(xTESTNumberOfItemsPerTick); + XFIReadBuffers(xTESTNumberOfItemsPerTick); + XTSReadBuffers(xTESTNumberOfItemsPerTick); + XRSIReadBuffers(xTESTNumberOfItemsPerTick); + XOBDReadBuffers(xTESTNumberOfItemsPerTick); + XCHMAReadBuffers(xTESTNumberOfItemsPerTick); + XCHLHReadBuffers(xTESTNumberOfItemsPerTick); + + // + xTESTProvider.ReadConditions(); +} + +// +// +// START Combination Functions ... +// +// + +// +// Can Open Long Trade ... +// this is a Function will Check all market Conditions and get all +// Strategy requirement Verifications for Long Signals ... +bool XTESTCanOpenLongTrade( + XProvidedSignal &info // Retrieve Signal Additional Info on this Object +) +{ + // + bool result = false; + + // + info.tp = 0; + info.sl = 0; + ArrayResize( + info.signallers, + 0); + + // + bool hasSignal = XTESTHasLongSignal(info); + + // + result = + // + hasSignal + // + ; + + // + if (result) + { + xTESTProvider.ClearConditions(); + } + + // + return result; +} + +// +// Can Close Long Trade ... +// this is a Function will Check all market Conditions and get all +// Strategy requirement Verifications for Long Signals ... +bool XTESTCanCloseLongTrade() +{ + // + bool result = false; + + // + return result; +} + +// +// Can Open Short Trade ... +// this is a Function will Check all market Conditions and get all +// Strategy requirement Verifications for Short Signals ... +bool XTESTCanOpenShortTrade( + XProvidedSignal &info // Retrieve Signal Additional Info on this Object +) +{ + // + bool result = false; + + // + info.tp = 0; + info.sl = 0; + ArrayResize( + info.signallers, + 0); + + // + bool hasSignal = XTESTHasShortSignal(info); + + // + result = + // + hasSignal + // + ; + + // + if (result) + { + xTESTProvider.ClearConditions(); + } + + // + return result; +} + +// +// Can Close Short Trade ... +// this is a Function will Check all market Conditions and get all +// Strategy requirement Verifications for Short Signals ... +bool XTESTCanCloseShortTrade() +{ + // + bool result = false; + + // + return result; +} + +// +// +// END Combination Functions ... +// +// + +// +// +// START Combination Signaling ... +// +// + +// +// Check Market Conditions by Combination of Power of All tools for LONGs ... +bool XTESTHasLongSignal( + XProvidedSignal &info // Retrieve Signal Additional Info on this Object +) +{ + // + bool result = false; + + // + // XTD ... + bool isXTDHasSignal = XTESTXTDHasLongSignal(); + if (isXTDHasSignal) + { + // + Add( + EnumToString(XTD), + info.signallers); + } + + // + // XTAM ... + bool isXTAMHasSignal = XTESTXTAMHasLongSignal(); + if (isXTAMHasSignal) + { + // + Add( + EnumToString(XTAM), + info.signallers); + } + + // + // XSI ... + bool isXSIHasSignal = XTESTXSIHasLongSignal(); + if (isXSIHasSignal) + { + // + Add( + EnumToString(XSI), + info.signallers); + } + + // + // XTSFI ... + bool isXTSFIHasSignal = XTESTXTSFIHasLongSignal(); + if (isXTSFIHasSignal) + { + // + Add( + EnumToString(XTSFI), + info.signallers); + } + + // + // XOBD XLH ... + bool isXOBDLHHasSignal = XTESTXOBDLHHasLongSignal(); + if (isXOBDLHHasSignal) + { + // + Add( + EnumToString(XOBDLH), + info.signallers); + } + + // + // XCHMA Cycles Cross ... + bool isXCHMACCHasSignal = XTESTXCHMACCHasLongSignal(); + if (isXCHMACCHasSignal) + { + // + Add( + EnumToString(XCHMACC), + info.signallers); + } + + // + // XCHMA Cycles Min ... + bool isXCHMAMNHasSignal = XTESTXCHMAMNHasLongSignal(); + if (isXCHMAMNHasSignal) + { + // + Add( + EnumToString(XCHMAMN), + info.signallers); + } + + // + // XCHMA Cycles Max + bool isXCHMAMXHasSignal = XTESTXCHMAMXHasLongSignal(); + if (isXCHMAMXHasSignal) + { + // + Add( + EnumToString(XCHMAMX), + info.signallers); + } + + // + result = + // + isXTDHasSignal + // + || + // + isXTAMHasSignal + // + || + // + isXSIHasSignal + // + || + // + isXTSFIHasSignal + // + || + // + isXOBDLHHasSignal + // + || + // + isXCHMACCHasSignal + // + || + // + isXCHMAMNHasSignal + // + || + // + isXCHMAMXHasSignal + // + ; + + // + if (result) + { + // + // Only Log Signals Time Market Conditions if is in Testing Mode ... + if (xTESTIsTestMode || xTESTEnableSignalAlerts) + { + // + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + string message = xTESTProvider.GenerateConditionsString(mConditions); + + // + LogMessage( + "Long Signal Provided by: \n" + + info.signallers[ArraySize(info.signallers) - 1] + "\n" + + "Pusher: " + (string)ArraySize(info.signallers) + "\n" + + "Market Conditions: " + message); + } + } + + // + return result; +} + +// +// Check Market Conditions by Combination of Power of All tools for SHORTs ... +bool XTESTHasShortSignal( + XProvidedSignal &info // Retrieve Signal Additional Info on this Object +) +{ + // + bool result = false; + + // + // XTD ... + bool isXTDHasSignal = XTESTXTDHasShortSignal(); + if (isXTDHasSignal) + { + // + Add( + EnumToString(XTD), + info.signallers); + } + + // + // XTAM ... + bool isXTAMHasSignal = XTESTXTAMHasShortSignal(); + if (isXTAMHasSignal) + { + // + Add( + EnumToString(XTAM), + info.signallers); + } + + // + // XSI ... + bool isXSIHasSignal = XTESTXSIHasShortSignal(); + if (isXSIHasSignal) + { + // + Add( + EnumToString(XSI), + info.signallers); + } + + // + // XTSFI ... + bool isXTSFIHasSignal = XTESTXTSFIHasShortSignal(); + if (isXTSFIHasSignal) + { + // + Add( + EnumToString(XTSFI), + info.signallers); + } + + // + // XOBD XLH ... + bool isXOBDLHHasSignal = XTESTXOBDLHHasShortSignal(); + if (isXOBDLHHasSignal) + { + // + Add( + EnumToString(XOBDLH), + info.signallers); + } + + // + // XCHMA Cycles Cross ... + bool isXCHMACCHasSignal = XTESTXCHMACCHasShortSignal(); + if (isXCHMACCHasSignal) + { + // + Add( + EnumToString(XCHMACC), + info.signallers); + } + + // + // XCHMA Cycles Min ... + bool isXCHMAMNHasSignal = XTESTXCHMAMNHasShortSignal(); + if (isXCHMAMNHasSignal) + { + // + Add( + EnumToString(XCHMAMN), + info.signallers); + } + + // + // XCHMA Cycles Max + bool isXCHMAMXHasSignal = XTESTXCHMAMXHasShortSignal(); + if (isXCHMAMXHasSignal) + { + // + Add( + EnumToString(XCHMAMX), + info.signallers); + } + + // + result = + // + isXTDHasSignal + // + || + // + isXTAMHasSignal + // + || + // + isXSIHasSignal + // + || + // + isXTSFIHasSignal + // + || + // + isXOBDLHHasSignal + // + || + // + isXCHMACCHasSignal + // + || + // + isXCHMAMNHasSignal + // + || + // + isXCHMAMXHasSignal + // + ; + + // + if (result) + { + // + // Only Log Signals Time Market Conditions if is in Testing Mode ... + if (xTESTIsTestMode || xTESTEnableSignalAlerts) + { + // + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + string message = xTESTProvider.GenerateConditionsString(mConditions); + + // + LogMessage( + "Short Signal Provided by: \n" + + info.signallers[ArraySize(info.signallers) - 1] + "\n" + + "Pusher: " + (string)ArraySize(info.signallers) + "\n" + + "Market Conditions: " + message); + } + } + + // + return result; +} + +// +// +// END Combination Signaling ... +// +// + +// +// START Signal Providers ... +// + +// +// Disbale All Signallers Longs ... +void XTESTDisableLongSignallers() +{ + // + // XTD ... + if (xTESTMXTDEnableSignaller) + { + // + xTESTProvider.DisbaleXTDLongs(); + xTESTMXTDAllowLongSignals = false; + } + + // + // XTAM ... + if (xTESTMXTAMEnableSignaller) + { + // + xTESTProvider.DisbaleXTAMLongs(); + xTESTMXTAMAllowLongSignals = false; + } + + // + // XSI ... + if (xTESTMXSIEnableSignaller) + { + // + xTESTProvider.DisbaleXSILongs(); + xTESTMXSIAllowLongSignals = false; + } + + // + // XTSFI ... + if (xTESTMXTSFIEnableSignaller) + { + // + xTESTProvider.DisbaleXTSFILongs(); + xTESTMXTSFIAllowLongSignals = false; + } + + // + // XOBDLH ... + // if (xTESTMXOBDLHEnableSignaller) + // { + // // + // xTESTProvider.DisbaleXOBDLHLongs(); + // xTESTMXOBDLHAllowLongSignals = false; + // } + + // + // XCHMACC ... + if (xTESTMXCHMACCEnableSignaller) + { + // + xTESTProvider.DisbaleXCHMACCLongs(); + xTESTMXCHMACCAllowLongSignals = false; + } + + // + // XCHMAMX ... + // if (xTESTMXCHMAMXEnableSignaller) + // { + // // + // xTESTProvider.DisbaleXCHMAMXLongs(); + // xTESTMXCHMAMXAllowLongSignals = false; + // } + + // + // XCHMAMN ... + // if (xTESTMXCHMAMNEnableSignaller) + // { + // // + // xTESTProvider.DisbaleXCHMAMNLongs(); + // xTESTMXCHMAMNAllowLongSignals = false; + // } +} + +// +// Enable All Signallers Longs ... +// Only if they are Configured as Enable at Settings ... +void XTESTEnableLongSignallers() +{ + // + // XTD ... + if (xTESTMXTDEnableSignaller) + { + // + xTESTMXTDAllowLongSignals = + xTESTXTDAllowLongSignals + ? true + : xTESTMXTDAllowLongSignals; + + // + if (xTESTMXTDAllowLongSignals) + { + xTESTProvider.EnableXTDLongs(); + } + } + + // + // XTAM ... + if (xTESTMXTAMEnableSignaller) + { + // + xTESTMXTAMAllowLongSignals = + xTESTXTAMAllowLongSignals + ? true + : xTESTMXTAMAllowLongSignals; + + // + if (xTESTMXTAMAllowLongSignals) + { + xTESTProvider.EnableXTAMLongs(); + } + } + + // + // XSI ... + if (xTESTMXSIEnableSignaller) + { + // + xTESTMXSIAllowLongSignals = + xTESTXSIAllowLongSignals + ? true + : xTESTMXSIAllowLongSignals; + + // + if (xTESTMXSIAllowLongSignals) + { + xTESTProvider.EnableXSILongs(); + } + } + + // + // XTSFI ... + if (xTESTMXTSFIEnableSignaller) + { + // + xTESTMXTSFIAllowLongSignals = + xTESTXTSFIAllowLongSignals + ? true + : xTESTMXTSFIAllowLongSignals; + + // + if (xTESTMXTSFIAllowLongSignals) + { + xTESTProvider.EnableXTSFILongs(); + } + } + + // + // XOBDLH ... + // if (xTESTMXOBDLHEnableSignaller) + // { + // // + // xTESTMXOBDLHAllowLongSignals = + // xTESTXOBDLHAllowLongSignals + // ? true + // : xTESTMXOBDLHAllowLongSignals; + + // // + // if (xTESTMXOBDLHAllowLongSignals) + // { + // xTESTProvider.EnableXOBDLHLongs(); + // } + // } + + // + // XCHMACC ... + if (xTESTMXCHMACCEnableSignaller) + { + // + xTESTMXCHMACCAllowLongSignals = + xTESTXCHMACCAllowLongSignals + ? true + : xTESTMXCHMACCAllowLongSignals; + + // + if (xTESTMXCHMACCAllowLongSignals) + { + xTESTProvider.EnableXCHMACCLongs(); + } + } + + // + // XCHMAMX ... + // if (xTESTMXCHMAMXEnableSignaller) + // { + // // + // xTESTMXCHMAMXAllowLongSignals = + // xTESTXCHMAMXAllowLongSignals + // ? true + // : xTESTMXCHMAMXAllowLongSignals; + + // // + // if (xTESTMXCHMAMXAllowLongSignals) + // { + // xTESTProvider.EnableXCHMAMXLongs(); + // } + // } + + // + // XCHMAMN ... + // if (xTESTMXCHMAMNEnableSignaller) + // { + // // + // xTESTMXCHMAMNAllowLongSignals = + // xTESTXCHMAMNAllowLongSignals + // ? true + // : xTESTMXCHMAMNAllowLongSignals; + + // // + // if (xTESTMXCHMAMNAllowLongSignals) + // { + // xTESTProvider.EnableXCHMAMNLongs(); + // } + // } +} + +// +// Disable All Signallers Shorts ... +void XTESTDisableShortSignallers() +{ + // + // XTD ... + if (xTESTMXTDEnableSignaller) + { + // + xTESTProvider.DisableXTDShorts(); + xTESTMXTDAllowShortSignals = false; + } + + // + // XTAM ... + if (xTESTMXTAMEnableSignaller) + { + // + xTESTProvider.DisableXTAMShorts(); + xTESTMXTAMAllowShortSignals = false; + } + + // + // XSI ... + if (xTESTMXSIEnableSignaller) + { + // + xTESTProvider.DisableXSIShorts(); + xTESTMXSIAllowShortSignals = false; + } + + // + // XTSFI ... + if (xTESTMXTSFIEnableSignaller) + { + // + xTESTProvider.DisableXTSFIShorts(); + xTESTMXTSFIAllowShortSignals = false; + } + + // + // XOBDLH ... + // if (xTESTMXOBDLHEnableSignaller) + // { + // // + // xTESTProvider.DisableXOBDLHShorts(); + // xTESTMXOBDLHAllowShortSignals = false; + // } + + // + // XCHMACC ... + if (xTESTMXCHMACCEnableSignaller) + { + // + xTESTProvider.DisableXCHMACCShorts(); + xTESTMXCHMACCAllowShortSignals = false; + } + + // + // XCHMAMX ... + // if (xTESTMXCHMAMXEnableSignaller) + // { + // // + // xTESTProvider.DisableXCHMAMXShorts(); + // xTESTMXCHMAMXAllowShortSignals = false; + // } + + // + // XCHMAMN ... + // if (xTESTMXCHMAMNEnableSignaller) + // { + // // + // xTESTProvider.DisableXCHMAMNShorts(); + // xTESTMXCHMAMNAllowShortSignals = false; + // } +} + +// +// Enable All Signallers Shorts ... +// Only if they are Configured as Enable at Settings ... +void XTESTEnableShortSignallers() +{ + // + // XTD ... + if (xTESTMXTDEnableSignaller) + { + // + xTESTMXTDAllowShortSignals = + xTESTXTDAllowShortSignals + ? true + : xTESTMXTDAllowShortSignals; + + // + if (xTESTMXTDAllowShortSignals) + { + xTESTProvider.EnableXTDShorts(); + } + } + + // + // XTAM ... + if (xTESTMXTAMEnableSignaller) + { + // + xTESTMXTAMAllowShortSignals = + xTESTXTAMAllowShortSignals + ? true + : xTESTMXTAMAllowShortSignals; + + // + if (xTESTMXTAMAllowShortSignals) + { + xTESTProvider.EnableXTAMShorts(); + } + } + + // + // XSI ... + if (xTESTMXSIEnableSignaller) + { + // + xTESTMXSIAllowShortSignals = + xTESTXSIAllowShortSignals + ? true + : xTESTMXSIAllowShortSignals; + + // + if (xTESTMXSIAllowShortSignals) + { + xTESTProvider.EnableXSIShorts(); + } + } + + // + // XTSFI ... + if (xTESTMXTSFIEnableSignaller) + { + // + xTESTMXTSFIAllowShortSignals = + xTESTXTSFIAllowShortSignals + ? true + : xTESTMXTSFIAllowShortSignals; + + // + if (xTESTMXTSFIAllowShortSignals) + { + xTESTProvider.EnableXTSFIShorts(); + } + } + + // + // XOBDLH ... + // if (xTESTMXOBDLHEnableSignaller) + // { + // // + // xTESTMXOBDLHAllowShortSignals = + // xTESTXOBDLHAllowShortSignals + // ? true + // : xTESTMXOBDLHAllowShortSignals; + + // // + // if (xTESTMXOBDLHAllowShortSignals) + // { + // xTESTProvider.EnableXOBDLHShorts(); + // } + // } + + // + // XCHMACC ... + if (xTESTMXCHMACCEnableSignaller) + { + // + xTESTMXCHMACCAllowShortSignals = + xTESTXCHMACCAllowShortSignals + ? true + : xTESTMXCHMACCAllowShortSignals; + + // + if (xTESTMXCHMACCAllowShortSignals) + { + xTESTProvider.EnableXCHMACCShorts(); + } + } + + // + // XCHMAMX ... + // if (xTESTMXCHMAMXEnableSignaller) + // { + // // + // xTESTMXCHMAMXAllowShortSignals = + // xTESTXCHMAMXAllowShortSignals + // ? true + // : xTESTMXCHMAMXAllowShortSignals; + + // // + // if (xTESTMXCHMAMXAllowShortSignals) + // { + // xTESTProvider.EnableXCHMAMXShorts(); + // } + // } + + // + // XCHMAMN ... + // if (xTESTMXCHMAMNEnableSignaller) + // { + // // + // xTESTMXCHMAMNAllowShortSignals = + // xTESTXCHMAMNAllowShortSignals + // ? true + // : xTESTMXCHMAMNAllowShortSignals; + + // // + // if (xTESTMXCHMAMNAllowShortSignals) + // { + // xTESTProvider.EnableXCHMAMNShorts(); + // } + // } +} + +// +// +// + +// +// XTD Long Signal Checking ... +bool XTESTXTDHasLongSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXTDEnableSignaller || + !xTESTMXTDAllowLongSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XTDHasLongConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XTD Short Signal Checking ... +bool XTESTXTDHasShortSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXTDEnableSignaller || + !xTESTMXTDAllowShortSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XTDHasShortConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XTAM Long Signal Checking ... +bool XTESTXTAMHasLongSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXTAMEnableSignaller || + !xTESTMXTAMAllowLongSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XTAMHasLongConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XTAM Short Signal Checking ... +bool XTESTXTAMHasShortSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXTAMEnableSignaller || + !xTESTMXTAMAllowShortSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XTAMHasShortConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XSI Long Signal Checking ... +bool XTESTXSIHasLongSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXSIEnableSignaller || + !xTESTMXSIAllowLongSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XSIHasLongConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XSI Short Signal Checking ... +bool XTESTXSIHasShortSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXSIEnableSignaller || + !xTESTMXSIAllowShortSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XSIHasShortConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XTSFI Long Signal Checking ... +bool XTESTXTSFIHasLongSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXTSFIEnableSignaller || + !xTESTMXTSFIAllowLongSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XTSFIHasLongConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XTSFI Short Signal Checking ... +bool XTESTXTSFIHasShortSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXTSFIEnableSignaller || + !xTESTMXTSFIAllowShortSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XTSFIHasShortConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XOBDLH Long Signal Checking ... +bool XTESTXOBDLHHasLongSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXOBDLHEnableSignaller || + !xTESTMXOBDLHAllowLongSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XOBDLHHasLongConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XOBDLH Short Signal Checking ... +bool XTESTXOBDLHHasShortSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXOBDLHEnableSignaller || + !xTESTMXOBDLHAllowShortSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XOBDLHHasShortConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XCHMACC Long Signal Checking ... +bool XTESTXCHMACCHasLongSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXCHMACCEnableSignaller || + !xTESTMXCHMACCAllowLongSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XCHMACCHasLongConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XCHMACC Short Signal Checking ... +bool XTESTXCHMACCHasShortSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXCHMACCEnableSignaller || + !xTESTMXCHMACCAllowShortSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XCHMACCHasShortConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XCHMAMN Long Signal Checking ... +bool XTESTXCHMAMNHasLongSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXCHMAMNEnableSignaller || + !xTESTMXCHMAMNAllowLongSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XCHMAMNHasLongConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XCHMAMN Short Signal Checking ... +bool XTESTXCHMAMNHasShortSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXCHMAMNEnableSignaller || + !xTESTMXCHMAMNAllowShortSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XCHMAMNHasShortConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XCHMAMX Long Signal Checking ... +bool XTESTXCHMAMXHasLongSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXCHMAMXEnableSignaller || + !xTESTMXCHMAMXAllowLongSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XCHMAMXHasLongConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// XCHMAMX Short Signal Checking ... +bool XTESTXCHMAMXHasShortSignal() +{ + // + bool result = false; + + // + // Validate Args ... + if (!xTESTMXCHMAMXEnableSignaller || + !xTESTMXCHMAMXAllowShortSignals) + { + return result; + } + + // + // Retrieve Market Condition ... + XMarketConditions mConditions = xTESTProvider.GetLastMarketCondition(); + + // + // Start Analysing Market based On Conditions ... + result = + // + // Base Condition: + xTESTProvider.XCHMAMXHasShortConditions() + // + && + // + false + // + ; + + // + return result; +} + +// +// END Signal Providers ... +// diff --git a/Providers/x-saherelm.xtest.provider.inputs.lib.mq5 b/Providers/x-saherelm.xtest.provider.inputs.lib.mq5 new file mode 100644 index 00000000..85f28249 --- /dev/null +++ b/Providers/x-saherelm.xtest.provider.inputs.lib.mq5 @@ -0,0 +1,283 @@ +/////////////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 XTEST Signal Provider Library Inputs +// ----------------------------------------------------------- +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Include Logger ... +#include "../Libraries/x-saherelm.log.lib.mq5" + +// +// Include Classes ... +#include "../Classes/x-saherelm.class.lib.mq5" + +// +input group "XTEST Provider"; + +// +// Commonly Used Configurations ... +input group "XTEST Common"; +// +// Provider ... +input bool xTESTEnableProvider = true; // Enable Provider +input int xTESTNumberOfItemsPerTick = 30; // Number Of items Readed In Each Tick +// +// Alerts ... +input bool xTESTEnableAlerts = true; // Enable Events Alert +input bool xTESTEnableHourlyAlerts = false; // Send Alert on each new Hour +input bool xTESTEnableDailyAlerts = false; // Send Alert on each new Day +input bool xTESTEnableWeeklyAlerts = false; // Send Alert on each new Week +input bool xTESTEnableMonthlyAlerts = false; // Send Alert on each new Month +// +// Reports ... +input bool xTESTEnableDailyReports = false; // Send Report on each new Day +input bool xTESTEnableWeeklyReports = false; // Send Report on each new Week +input bool xTESTEnableMonthlyReports = false; // Send Report on each new Month + +// +// Trader and Expert Specific Configurations ... +input group "XTEST Trader"; +input int xTESTMagicNumber = 16940563; // Trader MagicNumber +input int xTESTSlippage = 10; // Trader Slippage + +// +// Trades Management Configurations ... +input group "XTEST Trade Management"; +input bool xTESTAllowLongTrades = true; // Allow Long Trades +input bool xTESTAllowShortTrades = true; // Allow Short Trades + +// +// Risk Management Configurations ... +input group "XTEST Risk Management"; +// +// Trade Count ... +input int xTESTMaxAllowedTrades = 10; // Max Allowed Trades at Same Time +input ENUM_X_CROSS_SIGNAL_METHOD xTESTCrossSignalsMethod = X_CROSS_SIGNAL_REGULAR; // Handle Cross Signals Method +// +// Max Allowed Trade Age ... +input int xTESTMaxAllowedTradeAge = 1500; // Detect Long Time Trades +input ENUM_X_GUARD_ACTIONS xTESTOldTradesAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_1; // What to do with Old Trades +// +// Trade Volume Specific Configurations ... +input double xTESTStaticVolumeFactor = 0.0001; // Static Volume baesd on Balance +input ENUM_STATIC_VOLUME_METHODS xTESTStaticVolumeMethod = X_STATIC_VOLUME_BASED_ON_BALANCE; // How to Calculate Static Volume +input double xTESTVolumeMultiplier = 0; // Volume Increase Multiplier +input double xTESTApplyVolumeMultiplierFactor = 0; // Apply Volume Multiplier Rate based on Balance +input double xTESTMaxSupportedVolumePerTradeFactor = 0; // Max Supported Volume Per Trade Factor based on Balance +input double xTESTIncreasedMaxSupportedVolumeRate = 0; // Increase Max Supported Volume based on Balance +// +// Trade Profits ... +input double xTESTMinRewardInPips = 60; // Minimum Reward Per Trade in Pips +input double xTESTRiskFreeStepInPips = 0; // Make Trades Risk Free Steps in Pips +input double xTESTRiskFreeRate = 0; // Volume Multiplier for Risk Free Trades +// +// Guard Riskable Money and Profits ... +input double xTESTCriticalDrawDownFactor = 0.30; // Critical Allowed Drawdown Factor based on Balance +input ENUM_X_GUARD_ACTIONS xTESTCriticalGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_1; // Specify Guard Action on Critical Drawdown +input double xTESTMaxAllowedDrawDownFactor = 0.40; // Max Allowed Drawdown Factor based on Balance +input ENUM_X_GUARD_ACTIONS xTESTMaxAllowedGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_5; // Specify Guard Action on Max Allowed Drawdown +input int xTESTGuardStopoutFiredAfterTouches = 5; // Guard Stopout all Trades if Max Allowed Drawdown touched + +// +// Account Conditions for Trading ... +input double xTESTBalanceFactorForOpenTrades = 0.5; // Minimum Balance for Open Trades +input double xTESTFreeMarginFactorForOpenTrades = 0.8; // Minimum Free Margin for Open Trades + +// +// May be Used Later as Input Params ... +bool xTESTUseVirtualTPSl = false; // Use Virtual TP SL +bool xTESTEnableSignalAlerts = false; // Send Signal Alert + +// +// Validate Inputs before Initialization ... +bool XTESTValidateInputs() +{ + // + bool result = false; + + // + // Implement Other Verifications ... + + // + // Check Trading Availability ... + bool isTradeAvailable = xTESTAllowLongTrades || xTESTAllowShortTrades; + if (!isTradeAvailable) + { + LogMessage("XTEST => Warning: Trading disabled ..."); + } + + // + // Chekc Number of reading items per tick ... + result = xTESTNumberOfItemsPerTick >= 5; + if (!result) + { + // + LogMessage("XTEST invalid Number of items Reading Per Tick ..."); + + // + return result; + } + + // + // Check Max Allowed Trades Count ... + result = isTradeAvailable && xTESTMaxAllowedTrades >= 1; + if (!result) + { + // + LogMessage("XTEST Number of Trades not valid ..."); + + // + return result; + } + + // + // Check Free Margin ... + result = + isTradeAvailable && + xTESTFreeMarginFactorForOpenTrades > 0 && + xTESTFreeMarginFactorForOpenTrades < 1; + if (!result) + { + // + LogMessage("XTEST Invalid Free Margin ..."); + + // + return result; + } + + // + // Check min Balance for Open Trades ... + result = + isTradeAvailable && + xTESTBalanceFactorForOpenTrades > 0 && + xTESTBalanceFactorForOpenTrades < 1; + if (!result) + { + // + LogMessage("XTEST Invalid Min Balance for Open Trades ..."); + + // + return result; + } + + // + // Check Min Reward Per Trade ... + result = xTESTMinRewardInPips > 0; + if (!result) + { + // + LogMessage("XTEST Invalid Min Reward Per Trade ..."); + + // + return result; + } + + // + // Check Trades Volume ... + result = xTESTStaticVolumeFactor > 0; + if (!result) + { + // + LogMessage("XTEST Invalid Static Volume ..."); + + // + return result; + } + + // + // Check Volume Multiplier ... + result = xTESTVolumeMultiplier >= 0; + if (!result) + { + // + LogMessage("XTEST Invalid Volume Multiplier ..."); + + // + return result; + } + + // + result = + xTESTCriticalDrawDownFactor == 0 || (xTESTCriticalDrawDownFactor > 0 && + xTESTCriticalDrawDownFactor < 1); + if (!result) + { + // + LogMessage("XTEST Invalid Critical DrawDown Factor ..."); + + // + return result; + } + + // + result = + xTESTMaxAllowedDrawDownFactor == 0 || (xTESTMaxAllowedDrawDownFactor > 0 && + xTESTMaxAllowedDrawDownFactor < 1); + if (!result) + { + // + LogMessage("XTEST Invalid Max Allowed DrawDown Factor ..."); + + // + return result; + } + + // + // Check Guard Actions ... + // + result = + xTESTCriticalDrawDownFactor > 0 && + xTESTCriticalDrawDownFactor < 1 && + xTESTMaxAllowedDrawDownFactor > 0 && + xTESTMaxAllowedDrawDownFactor < 1; + if (!result) + { + // + LogMessage("XTEST For Critical Drawdown, you have to Specify Max Drawdown also ..."); + + // + return result; + } + + // + result = xTESTCriticalDrawDownFactor > 0 && xTESTCriticalDrawDownFactor < xTESTMaxAllowedDrawDownFactor; + if (!result) + { + // + LogMessage("XTEST Critical Drawdown must Smaller than Max Drawdown ..."); + + // + return result; + } + + // + if (xTESTCriticalDrawDownFactor > 0 && xTESTCriticalGuardAction == X_GUARD_DO_NOTHING) + { + LogMessage("XTEST IMPORTANT you Specified Critical Drawdown, but there is no any Guard Action ..."); + } + + // + if (xTESTMaxAllowedDrawDownFactor > 0 && xTESTMaxAllowedGuardAction == X_GUARD_DO_NOTHING) + { + LogMessage("XTEST IMPORTANT you Specified Max Allowed Drawdown, but there is no any Guard Action ..."); + } + + // + result = true; + + // + return result; +} \ No newline at end of file diff --git a/Providers/x-saherelm.xbtus5.provider.lib.mq5 b/Providers/x-saherelm.xtest.provider.lib.mq5 similarity index 61% rename from Providers/x-saherelm.xbtus5.provider.lib.mq5 rename to Providers/x-saherelm.xtest.provider.lib.mq5 index f1d90450..862436c1 100644 --- a/Providers/x-saherelm.xbtus5.provider.lib.mq5 +++ b/Providers/x-saherelm.xtest.provider.lib.mq5 @@ -1,9 +1,9 @@ //////////////////////////////////////////////////////////// // -// SaherElm IT Center MQL5 XBTUS5 Signal Provider Library +// SaherElm IT Center MQL5 XTEST Signal Provider Library // -------------------------------------------------------- -// Name: XBTUS5SignalProvider -// Description: XBTUS5 based signal provider ... +// Name: XTESTSignalProvider +// Description: XTEST based signal provider ... // // // Maintainer: @@ -19,13 +19,13 @@ #property version "1.00" #property strict -#define XBTUS5ProviderName "XBTUS5" +#define XTESTProviderName "XTEST" // // START Inputs ... // -#include "x-saherelm.xbtus5.provider.inputs.lib.mq5"; +#include "x-saherelm.xtest.provider.inputs.lib.mq5"; // // END Inputs ... @@ -56,42 +56,42 @@ // // -XCGuard *xBTUS5Guard; -XCTrade *xBTUS5Trader; -XCReporter *xBTUS5Reporter; -XCCollector *xBTUS5Collector; -XCAccountInfo *xBTUS5AccountInfo; -XCVolumeManager *xBTUS5VolumeManager; +XCGuard *xTESTGuard; +XCTrade *xTESTTrader; +XCReporter *xTESTReporter; +XCCollector *xTESTCollector; +XCAccountInfo *xTESTAccountInfo; +XCVolumeManager *xTESTVolumeManager; // -#include "x-saherelm.xbtus5.provider.indicators.lib.mq5" +#include "x-saherelm.xtest.provider.indicators.lib.mq5" // // Controlling Variables ... -bool xBTUS5MEnableProvider = false; -bool xBTUS5MAllowLongTrades = false; -bool xBTUS5MAllowShortTrades = false; +bool xTESTMEnableProvider = false; +bool xTESTMAllowLongTrades = false; +bool xTESTMAllowShortTrades = false; // -double xBTUS5Deposit = 0; -double xBTUS5Balance = 0; -double xBTUS5MinReward = 0; -double xBTUS5FreeMargin = 0; -double xBTUS5BalanceForOpenTrades = 0; -double xBTUS5FreeMarginForOpenTrades = 0; +double xTESTDeposit = 0; +double xTESTBalance = 0; +double xTESTMinReward = 0; +double xTESTFreeMargin = 0; +double xTESTBalanceForOpenTrades = 0; +double xTESTFreeMarginForOpenTrades = 0; // // Guard ... -double xBTUS5CriticalDrawDown = 0; -double xBTUS5MaxAllowedDrawDown = 0; +double xTESTCriticalDrawDown = 0; +double xTESTMaxAllowedDrawDown = 0; // -double xBTUS5MaxDrawUp = 0; -double xBTUS5MaxDrawDown = 0; +double xTESTMaxDrawUp = 0; +double xTESTMaxDrawDown = 0; // int NOT_ENOUGH_MONEY_ERROR = 4756; -const string XBTUS5_SUPPORT_ID = "SP"; +const string XTEST_SUPPORT_ID = "SP"; // // END Global Definitions: Variables, Properties and etc ... @@ -103,26 +103,26 @@ const string XBTUS5_SUPPORT_ID = "SP"; // // Initial Library if required ... -bool XBTUS5InitSignalProviderLibrary() +bool XTESTInitSignalProviderLibrary() { // bool result = false; // - if (!xBTUS5EnableProvider) + if (!xTESTEnableProvider) { return result; } // // Controlling Variables ... - xBTUS5MEnableProvider = xBTUS5EnableProvider; - xBTUS5MAllowLongTrades = xBTUS5AllowLongTrades; - xBTUS5MAllowShortTrades = xBTUS5AllowShortTrades; + xTESTMEnableProvider = xTESTEnableProvider; + xTESTMAllowLongTrades = xTESTAllowLongTrades; + xTESTMAllowShortTrades = xTESTAllowShortTrades; // // Validate Inputs ... - result = XBTUS5ValidateInputs(); + result = XTESTValidateInputs(); if (!result) { return result; @@ -130,113 +130,113 @@ bool XBTUS5InitSignalProviderLibrary() // // Init Indicators ... - result = XBTUS5InitIndicators(); + result = XTESTInitIndicators(); if (!result) { return result; } // - xBTUS5Reporter = new XCReporter(); - xBTUS5Collector = new XCCollector(); - xBTUS5AccountInfo = new XCAccountInfo(); + xTESTReporter = new XCReporter(); + xTESTCollector = new XCCollector(); + xTESTAccountInfo = new XCAccountInfo(); // // Calculate Account Deposit ... - xBTUS5Deposit = xBTUS5AccountInfo.GetInitialBalance(); + xTESTDeposit = xTESTAccountInfo.GetInitialBalance(); // // Prepare Min Reward ... - if (xBTUS5MinRewardInPips > 0) + if (xTESTMinRewardInPips > 0) { - xBTUS5MinReward = PipsToPrice(xBTUS5MinRewardInPips); + xTESTMinReward = PipsToPrice(xTESTMinRewardInPips); } // // Calculate Min Balance for Trades ... - if (xBTUS5BalanceFactorForOpenTrades > 0) + if (xTESTBalanceFactorForOpenTrades > 0) { - xBTUS5BalanceForOpenTrades = xBTUS5BalanceFactorForOpenTrades * xBTUS5Deposit; + xTESTBalanceForOpenTrades = xTESTBalanceFactorForOpenTrades * xTESTDeposit; } // // Claculate Min Free Marging for Trades ... - if (xBTUS5FreeMarginFactorForOpenTrades > 0) + if (xTESTFreeMarginFactorForOpenTrades > 0) { - xBTUS5FreeMarginForOpenTrades = xBTUS5FreeMarginFactorForOpenTrades * xBTUS5Deposit; + xTESTFreeMarginForOpenTrades = xTESTFreeMarginFactorForOpenTrades * xTESTDeposit; } // // Calculate Init Time Critical DrawDown Value ... - if (xBTUS5CriticalDrawDownFactor > 0) + if (xTESTCriticalDrawDownFactor > 0) { - xBTUS5CriticalDrawDown = xBTUS5CriticalDrawDownFactor * xBTUS5Deposit; + xTESTCriticalDrawDown = xTESTCriticalDrawDownFactor * xTESTDeposit; } // // Calculate Init Time Max Allowed DrawDown Value ... - if (xBTUS5MaxAllowedDrawDownFactor > 0) + if (xTESTMaxAllowedDrawDownFactor > 0) { - xBTUS5MaxAllowedDrawDown = xBTUS5MaxAllowedDrawDownFactor * xBTUS5Deposit; + xTESTMaxAllowedDrawDown = xTESTMaxAllowedDrawDownFactor * xTESTDeposit; } // // Instant Volume Manager ... - xBTUS5VolumeManager = new XCVolumeManager( - xBTUS5StaticVolumeFactor, - xBTUS5StaticVolumeMethod, - xBTUS5VolumeMultiplier, - xBTUS5ApplyVolumeMultiplierFactor, - xBTUS5MaxSupportedVolumePerTradeFactor, - xBTUS5IncreasedMaxSupportedVolumeRate); + xTESTVolumeManager = new XCVolumeManager( + xTESTStaticVolumeFactor, + xTESTStaticVolumeMethod, + xTESTVolumeMultiplier, + xTESTApplyVolumeMultiplierFactor, + xTESTMaxSupportedVolumePerTradeFactor, + xTESTIncreasedMaxSupportedVolumeRate); // // Make XCTrader instance ... - xBTUS5Trader = new XCTrade( - XBTUS5ProviderName, + xTESTTrader = new XCTrade( + XTESTProviderName, _Symbol, - xBTUS5Slippage, - xBTUS5MagicNumber, - xBTUS5UseVirtualTPSl, - xBTUS5MaxAllowedTrades, - xBTUS5FreeMarginForOpenTrades, - xBTUS5BalanceForOpenTrades); + xTESTSlippage, + xTESTMagicNumber, + xTESTUseVirtualTPSl, + xTESTMaxAllowedTrades, + xTESTFreeMarginForOpenTrades, + xTESTBalanceForOpenTrades); // // Instantiate Account Guard ... - xBTUS5Guard = new XCGuard( + xTESTGuard = new XCGuard( // // Old Trades ... - xBTUS5MaxAllowedTradeAge, - xBTUS5OldTradesAction, + xTESTMaxAllowedTradeAge, + xTESTOldTradesAction, // // Critical DrawDown ... - xBTUS5CriticalDrawDownFactor, - xBTUS5CriticalGuardAction, + xTESTCriticalDrawDownFactor, + xTESTCriticalGuardAction, // // Max Allowed DrawDown ... - xBTUS5MaxAllowedDrawDownFactor, - xBTUS5MaxAllowedGuardAction, - xBTUS5GuardStopoutFiredAfterTouches, + xTESTMaxAllowedDrawDownFactor, + xTESTMaxAllowedGuardAction, + xTESTGuardStopoutFiredAfterTouches, // - // xBTUS5GuardSupportMethod + // xTESTGuardSupportMethod X_SUPPORT_DO_NOTHING // ); // // Reset Calculations Buffers and Variables ... - XBTUS5ResetCollectors(); + XTESTResetCollectors(); // - XBTUS5UpdateReports(); + XTESTUpdateReports(); // result = true; // // Logging State ... - XBTUS5IssueInitializationSucceedAlert(); + XTESTIssueInitializationSucceedAlert(); // return result; @@ -244,65 +244,65 @@ bool XBTUS5InitSignalProviderLibrary() // // DeInitial Library if required ... -void XBTUS5DeinitSignalProviderLibrary(const int reason) +void XTESTDeinitSignalProviderLibrary(const int reason) { // // Release Handlers ... - XBTUS5ReleaseIndicators(); + XTESTReleaseIndicators(); // // Logging State ... - XBTUS5IssueDeinitializationSucceedAlert(); + XTESTIssueDeinitializationSucceedAlert(); } // // this is a Globally Function which do all of // checkings and positions handling ... -void XBTUS5SignalProviderHandleTick() +void XTESTSignalProviderHandleTick() { // // Check Provider is Enable or Not ... - if (!xBTUS5MEnableProvider) + if (!xTESTMEnableProvider) { return; } // - XBTUS5SignalProviderDoControlState(); + XTESTSignalProviderDoControlState(); // // Reading Indicator Buffers ... - XBTUS5HandleReadingBuffers(); - if (xBTUS5CalculatedBars < xBTUS5MaxLengthOfInputs) + XTESTHandleReadingBuffers(); + if (xTESTCalculatedBars < xTESTMaxLengthOfInputs) { return; } // // Handle Open Trades ... - XBTUS5HandleOpenTrades(); + XTESTHandleOpenTrades(); // // Handle Close Trades ... - XBTUS5HandleCloseTrades(); + XTESTHandleCloseTrades(); // // DrawDown and DrawUp ... - XBTUS5HandleCalculateDrawDownUp(); + XTESTHandleCalculateDrawDownUp(); } // // Do Control Checks here ... -void XBTUS5SignalProviderDoControlState() +void XTESTSignalProviderDoControlState() { // // Update account Balance ... - xBTUS5Balance = xBTUS5AccountInfo.GetBalance(); - xBTUS5FreeMargin = xBTUS5AccountInfo.GetFreeMargin(); + xTESTBalance = xTESTAccountInfo.GetBalance(); + xTESTFreeMargin = xTESTAccountInfo.GetFreeMargin(); // // Check Provider is Enable or Not ... - if (!xBTUS5MEnableProvider) + if (!xTESTMEnableProvider) { return; } @@ -312,10 +312,10 @@ void XBTUS5SignalProviderDoControlState() // TODO: add Guard Result here ... string guardMessage = ""; XGuardHandlerResult guardHandlerResult; - bool isGuarded = xBTUS5Guard.Guard( + bool isGuarded = xTESTGuard.Guard( guardHandlerResult, guardMessage, - xBTUS5Trader, + xTESTTrader, _Period); if (isGuarded) { @@ -331,7 +331,7 @@ void XBTUS5SignalProviderDoControlState() XSignal iSignal = guardHandlerResult.criticals[i]; // - XBTUS5OnGuard( + XTESTOnGuard( iSignal, X_GUARDED_CRITICAL, guardMessage); @@ -350,7 +350,7 @@ void XBTUS5SignalProviderDoControlState() XSignal iSignal = guardHandlerResult.maxes[i]; // - XBTUS5OnGuard( + XTESTOnGuard( iSignal, X_GUARDED_MAX, guardMessage, @@ -370,7 +370,7 @@ void XBTUS5SignalProviderDoControlState() XSignal iSignal = guardHandlerResult.olds[i]; // - XBTUS5OnGuard( + XTESTOnGuard( iSignal, X_GUARDED_OLD, guardMessage); @@ -381,9 +381,9 @@ void XBTUS5SignalProviderDoControlState() // // Signal Protection ... XSignal protectSupports[]; - bool isSupported = xBTUS5Guard.ProtectSignals( + bool isSupported = xTESTGuard.ProtectSignals( protectSupports, - xBTUS5Trader); + xTESTTrader); if (isSupported) { // @@ -393,7 +393,7 @@ void XBTUS5SignalProviderDoControlState() // // Handling Signals ... XTraderHandlerResult signalHandlerResult; - xBTUS5Trader.HandleSignals( + xTESTTrader.HandleSignals( signalHandlerResult, false // Ignore Risk Free Trdaes ); @@ -408,7 +408,7 @@ void XBTUS5SignalProviderDoControlState() { // XSignal iSignal = signalHandlerResult.sl[i]; - XBTUS5OnSL(iSignal); + XTESTOnSL(iSignal); } } @@ -422,7 +422,7 @@ void XBTUS5SignalProviderDoControlState() { // XSignal iSignal = signalHandlerResult.tp[i]; - XBTUS5OnTP(iSignal); + XTESTOnTP(iSignal); } } @@ -436,18 +436,18 @@ void XBTUS5SignalProviderDoControlState() { // XSignal iSignal = signalHandlerResult.rf[i]; - XBTUS5OnRF(iSignal); + XTESTOnRF(iSignal); } } } // // Handle Trades when OnTrade Event Hnadler Calls ... -void XBTUS5SignalProviderHandleTrade() +void XTESTSignalProviderHandleTrade() { // // Check Provider Enabled ... - if (!xBTUS5MEnableProvider) + if (!xTESTMEnableProvider) { return; } @@ -455,7 +455,7 @@ void XBTUS5SignalProviderHandleTrade() // // Handle OnTrade Event ... XOnTradeHandlerResult result = {}; - xBTUS5Trader.HandleOnTradeEvent( + xTESTTrader.HandleOnTradeEvent( result); // @@ -463,27 +463,27 @@ void XBTUS5SignalProviderHandleTrade() if (result.hasNewDeal) { // - XDeal last = xBTUS5Trader.GetLastDeal(); + XDeal last = xTESTTrader.GetLastDeal(); // if (last.reason == DEAL_REASON_SL) { - xBTUS5Reporter.AddTradeSLInReports(); + xTESTReporter.AddTradeSLInReports(); } else if (last.reason == DEAL_REASON_TP) { - xBTUS5Reporter.AddTradeTPInReports(); + xTESTReporter.AddTradeTPInReports(); } } } // // Handle Open Trades ... -void XBTUS5HandleOpenTrades() +void XTESTHandleOpenTrades() { // // Check Can Trade ... - bool canTrade = xBTUS5MAllowLongTrades || xBTUS5MAllowShortTrades; + bool canTrade = xTESTMAllowLongTrades || xTESTMAllowShortTrades; if (!canTrade) { return; @@ -491,8 +491,8 @@ void XBTUS5HandleOpenTrades() // // Check Max Open Trades ... - int openSignals = xBTUS5Trader.Count(); - bool canOpenPositions = openSignals < xBTUS5MaxAllowedTrades; + int openSignals = xTESTTrader.Count(); + bool canOpenPositions = openSignals < xTESTMaxAllowedTrades; if (!canOpenPositions) { return; @@ -502,8 +502,8 @@ void XBTUS5HandleOpenTrades() // Check Signals Exists ... XProvidedSignal longSignalInfo; XProvidedSignal shortSignalInfo; - bool hasLongSignal = XBTUS5CanOpenLongTrade(longSignalInfo); - bool hasShortSignal = XBTUS5CanOpenShortTrade(shortSignalInfo); + bool hasLongSignal = XTESTCanOpenLongTrade(longSignalInfo); + bool hasShortSignal = XTESTCanOpenShortTrade(shortSignalInfo); if (!hasLongSignal && !hasShortSignal) { return; @@ -511,20 +511,20 @@ void XBTUS5HandleOpenTrades() // // Update Reports ... - XBTUS5UpdateReports(); + XTESTUpdateReports(); // - xBTUS5WaitUntilNextCandle = true; + xTESTWaitUntilNextCandle = true; // // Open Long Trades ... if ( // hasLongSignal && - xBTUS5MAllowLongTrades) + xTESTMAllowLongTrades) { // - bool isOpened = XBTUS5OpenLongPosition(longSignalInfo); + bool isOpened = XTESTOpenLongPosition(longSignalInfo); } // @@ -532,29 +532,29 @@ void XBTUS5HandleOpenTrades() if ( // hasShortSignal && - xBTUS5MAllowShortTrades) + xTESTMAllowShortTrades) { // - bool isOpened = XBTUS5OpenShortPosition(shortSignalInfo); + bool isOpened = XTESTOpenShortPosition(shortSignalInfo); } } // // Handle Close Trades ... -void XBTUS5HandleCloseTrades() +void XTESTHandleCloseTrades() { // // Force Close Long Trades ... bool isClosedLongTrades = false; - bool canCloseLongTrades = XBTUS5CanCloseLongTrade(); - if (xBTUS5MAllowLongTrades && canCloseLongTrades) + bool canCloseLongTrades = XTESTCanCloseLongTrade(); + if (xTESTMAllowLongTrades && canCloseLongTrades) { // ENUM_X_SIGNAL_TYPE type = X_SIGNAL_LONG; // XSignal closed[]; - xBTUS5Trader.CloseSignals( + xTESTTrader.CloseSignals( closed, type); @@ -568,7 +568,7 @@ void XBTUS5HandleCloseTrades() { // XSignal iSignal = closed[i]; - XBTUS5OnFC(iSignal); + XTESTOnFC(iSignal); } } } @@ -576,15 +576,15 @@ void XBTUS5HandleCloseTrades() // // Force Close Short Trades ... bool isClosedShortTrades = false; - bool canCloseShortTrades = XBTUS5CanCloseShortTrade(); - if (xBTUS5MAllowShortTrades && canCloseShortTrades) + bool canCloseShortTrades = XTESTCanCloseShortTrade(); + if (xTESTMAllowShortTrades && canCloseShortTrades) { // ENUM_X_SIGNAL_TYPE type = X_SIGNAL_SHORT; // XSignal closed[]; - xBTUS5Trader.CloseSignals( + xTESTTrader.CloseSignals( closed, type); @@ -598,7 +598,7 @@ void XBTUS5HandleCloseTrades() { // XSignal iSignal = closed[i]; - XBTUS5OnFC(iSignal); + XTESTOnFC(iSignal); } } } @@ -606,7 +606,7 @@ void XBTUS5HandleCloseTrades() // // Open Long Position ... -bool XBTUS5OpenLongPosition( +bool XTESTOpenLongPosition( XProvidedSignal &info // Retrieve Signal Additional Info on this Object ) { @@ -619,14 +619,14 @@ bool XBTUS5OpenLongPosition( double sl = info.sl > 0 ? info.sl : 0; // entry - (200 * _Point); // info.sl > 0 ? info.sl : 0; - double tp = info.tp > 0 ? info.tp : entry + xBTUS5MinReward; - double riskFreeRate = xBTUS5RiskFreeRate; - double riskFreeStep = xBTUS5RiskFreeStepInPips; - double volume = XBTUS5CalculateVolume(ArraySize(info.signallers)); + double tp = info.tp > 0 ? info.tp : entry + xTESTMinReward; + double riskFreeRate = xTESTRiskFreeRate; + double riskFreeStep = xTESTRiskFreeStepInPips; + double volume = XTESTCalculateVolume(ArraySize(info.signallers)); // XSignal signal = {}; - signal = xBTUS5Trader.GenerateSignal( + signal = xTESTTrader.GenerateSignal( X_SIGNAL_LONG, tp, sl, @@ -635,20 +635,20 @@ bool XBTUS5OpenLongPosition( riskFreeRate); bool isValidSignal = IsValid( signal, - xBTUS5MagicNumber); + xTESTMagicNumber); if (!isValidSignal) { return result; } // - int signalsCount = xBTUS5Trader.Count(); + int signalsCount = xTESTTrader.Count(); bool isCross = signalsCount >= 1; if (isCross) { // // Handle Cross Signals ... - XBTUS5HnadleCrossSignal(signal); + XTESTHnadleCrossSignal(signal); } // @@ -661,7 +661,7 @@ bool XBTUS5OpenLongPosition( ( // isCross && - xBTUS5CrossSignalsMethod != X_CROSS_SIGNAL_DO_NOTHING + xTESTCrossSignalsMethod != X_CROSS_SIGNAL_DO_NOTHING // ); if (!canExecuteSignal) @@ -671,7 +671,7 @@ bool XBTUS5OpenLongPosition( // // Execute Signal ... - ENUM_EXECUTION_SIGNAL_RESULT executionResult = xBTUS5Trader.ExecuteSignal( + ENUM_EXECUTION_SIGNAL_RESULT executionResult = xTESTTrader.ExecuteSignal( signal, false, // Ignore Number of Trades ... true // Check Account Conditions ... @@ -688,16 +688,16 @@ bool XBTUS5OpenLongPosition( ); // - XSignal tSignal = xBTUS5Trader.GetSignal(signal.ticket); + XSignal tSignal = xTESTTrader.GetSignal(signal.ticket); // - XBTUS5OnSignal( + XTESTOnSignal( tSignal, providers); } else { - XBTUS5IssueSignalExecutionError(executionResult); + XTESTIssueSignalExecutionError(executionResult); } // @@ -706,7 +706,7 @@ bool XBTUS5OpenLongPosition( // // Open Short Position ... -bool XBTUS5OpenShortPosition( +bool XTESTOpenShortPosition( XProvidedSignal &info // Retrieve Signal Additional Info on this Object ) { @@ -719,14 +719,14 @@ bool XBTUS5OpenShortPosition( double sl = info.sl > 0 ? info.sl : 0; // entry + (200 * _Point); // info.sl > 0 ? info.sl : 0; - double tp = info.tp > 0 ? info.tp : entry - xBTUS5MinReward; - double riskFreeRate = xBTUS5RiskFreeRate; - double riskFreeStep = xBTUS5RiskFreeStepInPips; - double volume = XBTUS5CalculateVolume(ArraySize(info.signallers)); + double tp = info.tp > 0 ? info.tp : entry - xTESTMinReward; + double riskFreeRate = xTESTRiskFreeRate; + double riskFreeStep = xTESTRiskFreeStepInPips; + double volume = XTESTCalculateVolume(ArraySize(info.signallers)); // XSignal signal = {}; - signal = xBTUS5Trader.GenerateSignal( + signal = xTESTTrader.GenerateSignal( X_SIGNAL_SHORT, tp, sl, @@ -735,20 +735,20 @@ bool XBTUS5OpenShortPosition( riskFreeRate); bool isValidSignal = IsValid( signal, - xBTUS5MagicNumber); + xTESTMagicNumber); if (!isValidSignal) { return result; } // - int signalsCount = xBTUS5Trader.Count(); + int signalsCount = xTESTTrader.Count(); bool isCross = signalsCount >= 1; if (isCross) { // // Handle Cross Signals ... - XBTUS5HnadleCrossSignal(signal); + XTESTHnadleCrossSignal(signal); } // @@ -761,7 +761,7 @@ bool XBTUS5OpenShortPosition( ( // isCross && - xBTUS5CrossSignalsMethod != X_CROSS_SIGNAL_DO_NOTHING + xTESTCrossSignalsMethod != X_CROSS_SIGNAL_DO_NOTHING // ); if (!canExecuteSignal) @@ -771,7 +771,7 @@ bool XBTUS5OpenShortPosition( // // Execute Signal ... - ENUM_EXECUTION_SIGNAL_RESULT executionResult = xBTUS5Trader.ExecuteSignal( + ENUM_EXECUTION_SIGNAL_RESULT executionResult = xTESTTrader.ExecuteSignal( signal, false, // Ignore Number of Trades ... true // Check Account Conditions ... @@ -786,16 +786,16 @@ bool XBTUS5OpenShortPosition( ); // - XSignal tSignal = xBTUS5Trader.GetSignal(signal.ticket); + XSignal tSignal = xTESTTrader.GetSignal(signal.ticket); // - XBTUS5OnSignal( + XTESTOnSignal( tSignal, providers); } else { - XBTUS5IssueSignalExecutionError(executionResult); + XTESTIssueSignalExecutionError(executionResult); } // @@ -804,20 +804,20 @@ bool XBTUS5OpenShortPosition( // // Apply Cross Signal Actions ... -void XBTUS5HnadleCrossSignal( +void XTESTHnadleCrossSignal( XSignal &signal // Specified Signal ... ) { // // Check Cross Signal Handling Enabled ... - if (xBTUS5CrossSignalsMethod == X_CROSS_SIGNAL_DO_NOTHING) + if (xTESTCrossSignalsMethod == X_CROSS_SIGNAL_DO_NOTHING) { return; } // // First We have to Change Cross Signals Comment ... - string comment = xBTUS5Trader.GenerateSignalComment( + string comment = xTESTTrader.GenerateSignalComment( signal, true); @@ -826,21 +826,21 @@ void XBTUS5HnadleCrossSignal( // // If Every thing is Regular, prevent any changes here ... - if (xBTUS5CrossSignalsMethod == X_CROSS_SIGNAL_REGULAR) + if (xTESTCrossSignalsMethod == X_CROSS_SIGNAL_REGULAR) { return; } // // Retrieve Max in Drawdown Signal ... - XSignal maxInDDSignal = xBTUS5Trader.GetMaxInDrawdownSignal(); + XSignal maxInDDSignal = xTESTTrader.GetMaxInDrawdownSignal(); // // Validate Signal ... bool isValidSignal = maxInDDSignal.ticket > 0 && maxInDDSignal.symbol == signal.symbol && - IsValid(maxInDDSignal, xBTUS5MagicNumber); + IsValid(maxInDDSignal, xTESTMagicNumber); if (!isValidSignal) { return; @@ -856,14 +856,14 @@ void XBTUS5HnadleCrossSignal( isDirectional ? ( // - xBTUS5CrossSignalsMethod == X_CROSS_SIGNAL_DIRECTION_REGULAR || - xBTUS5CrossSignalsMethod == X_CROSS_SIGNAL_DIRECTION_REGULAR_INDIRECTION_IMPORTANT + xTESTCrossSignalsMethod == X_CROSS_SIGNAL_DIRECTION_REGULAR || + xTESTCrossSignalsMethod == X_CROSS_SIGNAL_DIRECTION_REGULAR_INDIRECTION_IMPORTANT // ) : ( // - xBTUS5CrossSignalsMethod == X_CROSS_SIGNAL_INDIRECTION_REGULAR || - xBTUS5CrossSignalsMethod == X_CROSS_SIGNAL_DIRECTION_IMPORTANT_INDIRECTION_REGULAR + xTESTCrossSignalsMethod == X_CROSS_SIGNAL_INDIRECTION_REGULAR || + xTESTCrossSignalsMethod == X_CROSS_SIGNAL_DIRECTION_IMPORTANT_INDIRECTION_REGULAR // ); if (isRegular) @@ -882,11 +882,11 @@ void XBTUS5HnadleCrossSignal( // // Calculate Usefull data ... -void XBTUS5HandleCalculateDrawDownUp() +void XTESTHandleCalculateDrawDownUp() { // XSignal signals[]; - xBTUS5Trader.GetSignals(signals); + xTESTTrader.GetSignals(signals); int signalsCount = ArraySize(signals); if (signalsCount <= 0) { @@ -897,7 +897,7 @@ void XBTUS5HandleCalculateDrawDownUp() double profit = 0; double volume = 0; XCollector collector = {}; - double maxAllowedVolume = xBTUS5VolumeManager.GetMaxAllowedVolume(); + double maxAllowedVolume = xTESTVolumeManager.GetMaxAllowedVolume(); for (int i = 0; i < signalsCount; i++) { // @@ -918,11 +918,11 @@ void XBTUS5HandleCalculateDrawDownUp() if (profit < 0) { // - xBTUS5MaxDrawDown = - xBTUS5MaxDrawDown == 0 || - xBTUS5MaxDrawDown > MathAbs(profit) + xTESTMaxDrawDown = + xTESTMaxDrawDown == 0 || + xTESTMaxDrawDown > MathAbs(profit) ? MathAbs(profit) - : xBTUS5MaxDrawDown; + : xTESTMaxDrawDown; // // Update Buffers ... @@ -933,29 +933,29 @@ void XBTUS5HandleCalculateDrawDownUp() // collector.time = time; collector.volume = volume; - collector.maxDrawDown = xBTUS5MaxDrawDown; + collector.maxDrawDown = xTESTMaxDrawDown; collector.maxAllowedVolume = maxAllowedVolume; - collector.minBalanceForOpenTrade = xBTUS5Trader.GetMinBalanceForOpenTrades(); + collector.minBalanceForOpenTrade = xTESTTrader.GetMinBalanceForOpenTrades(); } else { // - xBTUS5MaxDrawUp = - xBTUS5MaxDrawUp == 0 || - xBTUS5MaxDrawUp < profit + xTESTMaxDrawUp = + xTESTMaxDrawUp == 0 || + xTESTMaxDrawUp < profit ? profit - : xBTUS5MaxDrawUp; + : xTESTMaxDrawUp; } // // Update Collector ... - xBTUS5Collector.Add(collector); + xTESTCollector.Add(collector); // // Update Reports ... - xBTUS5Reporter.UpdateMaxDrawUpInReports(xBTUS5MaxDrawUp); - xBTUS5Reporter.UpdateMaxDrawDownInReports(xBTUS5MaxDrawDown); - xBTUS5Reporter.UpdateMaxSameTimeTradesInReports(signalsCount); + xTESTReporter.UpdateMaxDrawUpInReports(xTESTMaxDrawUp); + xTESTReporter.UpdateMaxDrawDownInReports(xTESTMaxDrawDown); + xTESTReporter.UpdateMaxSameTimeTradesInReports(signalsCount); } // @@ -964,116 +964,116 @@ void XBTUS5HandleCalculateDrawDownUp() // // Runs When a Signal Successfully Executed ... -void XBTUS5OnSignal( +void XTESTOnSignal( XSignal &signal, // Specified Signal string &providers[] // Signal Providers ) { // // Issue Propper Alert ... - XBTUS5IssueSignalExecutionAlert( + XTESTIssueSignalExecutionAlert( signal, providers); // // Add Signal To Supports on Guard ... - xBTUS5Guard.AddSupport(signal); + xTESTGuard.AddSupport(signal); // // Update Reports ... - xBTUS5Reporter.AddSignalToReports( + xTESTReporter.AddSignalToReports( signal, providers); } // // Runs when a Position Got Take Profit ... -void XBTUS5OnTP( +void XTESTOnTP( XSignal &signal // Specified Signal ) { // // Issue Propper Alert ... - XBTUS5IssueTPAlert(signal); + XTESTIssueTPAlert(signal); // // Remove Signal From Guard Protector ... - xBTUS5Guard.Remove(signal.ticket); - xBTUS5Guard.RemoveSupport(signal.ticket); + xTESTGuard.Remove(signal.ticket); + xTESTGuard.RemoveSupport(signal.ticket); // // Update Reports ... - xBTUS5Reporter.AddTradeTPInReports(); - XBTUS5UpdateReports(); + xTESTReporter.AddTradeTPInReports(); + XTESTUpdateReports(); } // // Runs when a Position Got Stop Loss ... -void XBTUS5OnSL( +void XTESTOnSL( XSignal &signal // Specified Signal ) { // // Issue Propper Alert ... - XBTUS5IssueSLAlert(signal); + XTESTIssueSLAlert(signal); // // Remove Signal From Guard Protector ... - xBTUS5Guard.Remove(signal.ticket); - xBTUS5Guard.RemoveSupport(signal.ticket); + xTESTGuard.Remove(signal.ticket); + xTESTGuard.RemoveSupport(signal.ticket); // // Update Reports ... - xBTUS5Reporter.AddTradeSLInReports(); - XBTUS5UpdateReports(); + xTESTReporter.AddTradeSLInReports(); + XTESTUpdateReports(); } // // Runs when a Position Risk Free ... -void XBTUS5OnRF( +void XTESTOnRF( XSignal &signal // Specified Signal ) { // // Issue Propper Alert ... - XBTUS5IssueRFAlert(signal); + XTESTIssueRFAlert(signal); // // Remove Signal From Guard Protector ... // since RiskFree Signals has SL ... - xBTUS5Guard.Remove(signal.ticket); - xBTUS5Guard.RemoveSupport(signal.ticket); + xTESTGuard.Remove(signal.ticket); + xTESTGuard.RemoveSupport(signal.ticket); // // Update Reports ... - xBTUS5Reporter.AddTradeSLInReports(); - XBTUS5UpdateReports(); + xTESTReporter.AddTradeSLInReports(); + XTESTUpdateReports(); } // // Runs when a Position Force Closed ... -void XBTUS5OnFC( +void XTESTOnFC( XSignal &signal // Specified Signal ) { // // Issue Propper Alert ... - XBTUS5IssueFCAlert(signal); + XTESTIssueFCAlert(signal); // // Remove Signal From Guard Protector ... - xBTUS5Guard.Remove(signal.ticket); - xBTUS5Guard.RemoveSupport(signal.ticket); + xTESTGuard.Remove(signal.ticket); + xTESTGuard.RemoveSupport(signal.ticket); // // Update Reports ... - xBTUS5Reporter.AddTradeSLInReports(); - XBTUS5UpdateReports(); + xTESTReporter.AddTradeSLInReports(); + XTESTUpdateReports(); } // // Runs when a Position Guarded ... -void XBTUS5OnGuard( +void XTESTOnGuard( XSignal &signal, // Specified Signal ENUM_X_GUARD_REASONS reason, // Reason of Guard Applied string message, // Guard Returned Message @@ -1088,17 +1088,17 @@ void XBTUS5OnGuard( LogMessage(message); // - xBTUS5MEnableProvider = false; + xTESTMEnableProvider = false; } // // Issue Propper Alert ... - XBTUS5IssueGuardAlert(signal, reason, isStopOut); + XTESTIssueGuardAlert(signal, reason, isStopOut); // // Update Reports ... - xBTUS5Reporter.AddTradeSLInReports(); - XBTUS5UpdateReports(); + xTESTReporter.AddTradeSLInReports(); + XTESTUpdateReports(); } // @@ -1119,16 +1119,16 @@ void XBTUS5OnGuard( // // Calculating Volume for Tradings ... -double XBTUS5CalculateVolume( +double XTESTCalculateVolume( double forceMultiplier = 0 // some times we get more than one signal at the same time, here we increase volume using this ... ) { // // Check Open Trades ... - int openSignals = xBTUS5Trader.Count(); + int openSignals = xTESTTrader.Count(); // - double result = xBTUS5VolumeManager.CalculateVolume( + double result = xTESTVolumeManager.CalculateVolume( openSignals, _Symbol); @@ -1153,20 +1153,20 @@ double XBTUS5CalculateVolume( // // Update Report Info ... -void XBTUS5UpdateReports() +void XTESTUpdateReports() { // - double staticVolume = xBTUS5VolumeManager.GetStaticVolume(); - string staticVolumeCalculationMethod = EnumToString(xBTUS5StaticVolumeMethod); - double maxAllowedVolume = xBTUS5VolumeManager.GetMaxAllowedVolume(); - double volumeIncreaseMultiplier = xBTUS5VolumeManager.GetVolumeMultiplier(); - double balanceGowingToApplyMultiplier = xBTUS5VolumeManager.GetIncreaseMultiplierBalance(); + double staticVolume = xTESTVolumeManager.GetStaticVolume(); + string staticVolumeCalculationMethod = EnumToString(xTESTStaticVolumeMethod); + double maxAllowedVolume = xTESTVolumeManager.GetMaxAllowedVolume(); + double volumeIncreaseMultiplier = xTESTVolumeManager.GetVolumeMultiplier(); + double balanceGowingToApplyMultiplier = xTESTVolumeManager.GetIncreaseMultiplierBalance(); - double balanceGrowingToIncreaseMaxAllowedVolume = xBTUS5VolumeManager.GetIncreaseMaxAllowedVolumeBalance(); + double balanceGrowingToIncreaseMaxAllowedVolume = xTESTVolumeManager.GetIncreaseMaxAllowedVolumeBalance(); // // Update Reports Volume Info ... - xBTUS5Reporter.UpdateReportsVolumeInfo( + xTESTReporter.UpdateReportsVolumeInfo( staticVolume, staticVolumeCalculationMethod, maxAllowedVolume, @@ -1176,24 +1176,24 @@ void XBTUS5UpdateReports() // // Calculate Max Allowed Drawdown ... - double minBalanceForTradeBasedOnBalance = xBTUS5Trader.GetMinBalanceForOpenTrades(); - xBTUS5Reporter.UpdateMinBalanceForOpenTradesInReports(minBalanceForTradeBasedOnBalance); + double minBalanceForTradeBasedOnBalance = xTESTTrader.GetMinBalanceForOpenTrades(); + xTESTReporter.UpdateMinBalanceForOpenTradesInReports(minBalanceForTradeBasedOnBalance); } // -// Reset XBTUS5 Info Buffers ... -void XBTUS5ResetCollectors() +// Reset XTEST Info Buffers ... +void XTESTResetCollectors() { // // Reset Calculations Buffers and Variables ... - xBTUS5MaxDrawUp = 0; - xBTUS5MaxDrawDown = 0; + xTESTMaxDrawUp = 0; + xTESTMaxDrawDown = 0; // - xBTUS5Trader.Reset(); - xBTUS5Reporter.Reset(); - xBTUS5Collector.Reset(); - xBTUS5VolumeManager.ResetForceVolumeMultiplier(); + xTESTTrader.Reset(); + xTESTReporter.Reset(); + xTESTCollector.Reset(); + xTESTVolumeManager.ResetForceVolumeMultiplier(); } // @@ -1206,7 +1206,7 @@ void XBTUS5ResetCollectors() // // Send Alert ... -void XBTUS5IssueAlert(string message) +void XTESTIssueAlert(string message) { // // Validate Args ... @@ -1216,7 +1216,7 @@ void XBTUS5IssueAlert(string message) } // - if (xBTUS5EnableAlerts) + if (xTESTEnableAlerts) { SendAlert(message); } @@ -1228,7 +1228,7 @@ void XBTUS5IssueAlert(string message) // // Send Take Profit Alert on Specific Signal ... -void XBTUS5IssueTPAlert( +void XTESTIssueTPAlert( XSignal &signal // Specified Signal ) { @@ -1236,15 +1236,15 @@ void XBTUS5IssueTPAlert( string message = ""; // - message = xBTUS5Trader.GenerateSignalTPComment(signal); + message = xTESTTrader.GenerateSignalTPComment(signal); // - XBTUS5IssueAlert(message); + XTESTIssueAlert(message); } // // Send Stop Loss Alert on Specific Signal ... -void XBTUS5IssueSLAlert( +void XTESTIssueSLAlert( XSignal &signal // Specified Signal ) { @@ -1252,15 +1252,15 @@ void XBTUS5IssueSLAlert( string message = ""; // - message = xBTUS5Trader.GenerateSignalSLComment(signal); + message = xTESTTrader.GenerateSignalSLComment(signal); // - XBTUS5IssueAlert(message); + XTESTIssueAlert(message); } // // Send Force Close Alert on Specific Signal ... -void XBTUS5IssueFCAlert( +void XTESTIssueFCAlert( XSignal &signal // Specified Signal ) { @@ -1268,15 +1268,15 @@ void XBTUS5IssueFCAlert( string message = ""; // - message = xBTUS5Trader.GenerateSignalForceCloseComment(signal); + message = xTESTTrader.GenerateSignalForceCloseComment(signal); // - XBTUS5IssueAlert(message); + XTESTIssueAlert(message); } // // Send Risk Free Alert on Specific Signal ... -void XBTUS5IssueRFAlert( +void XTESTIssueRFAlert( XSignal &signal // Specified Signal ) { @@ -1284,15 +1284,15 @@ void XBTUS5IssueRFAlert( string message = ""; // - message = xBTUS5Trader.GenerateSignalRFComment(signal, 0); + message = xTESTTrader.GenerateSignalRFComment(signal, 0); // - XBTUS5IssueAlert(message); + XTESTIssueAlert(message); } // // Send Guard Alert on Specific Signal ... -void XBTUS5IssueGuardAlert( +void XTESTIssueGuardAlert( XSignal &signal, // Specified Signal ENUM_X_GUARD_REASONS reason, // Specified Guard Reason bool isStopOut = false // Specified StopOut Fired or not @@ -1302,41 +1302,41 @@ void XBTUS5IssueGuardAlert( string message = ""; // - message = xBTUS5Guard.GenerateGuardedSignalComment( + message = xTESTGuard.GenerateGuardedSignalComment( signal, reason); // - XBTUS5IssueAlert(message); + XTESTIssueAlert(message); } // // Send Initialization Succeed Alert ... -void XBTUS5IssueInitializationSucceedAlert() +void XTESTIssueInitializationSucceedAlert() { // - string message = "Initializion of (" + XBTUS5ProviderName + " Provider" + " _ " + _Symbol + " _ " + EnumToString(_Period) + ") Succeeded ..."; - XBTUS5IssueAlert(message); + string message = "Initializion of (" + XTESTProviderName + " Provider" + " _ " + _Symbol + " _ " + EnumToString(_Period) + ") Succeeded ..."; + XTESTIssueAlert(message); } // // Send De Initialization Succeed Alert ... -void XBTUS5IssueDeinitializationSucceedAlert() +void XTESTIssueDeinitializationSucceedAlert() { // - string message = "De Initializion of (" + XBTUS5ProviderName + " Provider" + ") Succeeded ..."; - XBTUS5IssueAlert(message); + string message = "De Initializion of (" + XTESTProviderName + " Provider" + ") Succeeded ..."; + XTESTIssueAlert(message); } // // Send Signal Successfully Execution Alert ... -void XBTUS5IssueSignalExecutionAlert( +void XTESTIssueSignalExecutionAlert( XSignal &signal, // Specified Signal string &providers[] // Signal Providers ) { // - string message = xBTUS5Trader.ToString(signal); + string message = xTESTTrader.ToString(signal); // string providersMsg = ToString(providers); @@ -1346,12 +1346,12 @@ void XBTUS5IssueSignalExecutionAlert( } // - XBTUS5IssueAlert(message); + XTESTIssueAlert(message); } // // Send Signal Execution Alert ... -void XBTUS5IssueSignalExecutionError(int error) +void XTESTIssueSignalExecutionError(int error) { // string message = GetSignalExecutionError(error); @@ -1361,7 +1361,7 @@ void XBTUS5IssueSignalExecutionError(int error) } // - XBTUS5IssueAlert(message); + XTESTIssueAlert(message); } //