/////////////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 XMAP Signal Provider Library Inputs // ----------------------------------------------------------- // Name: XMAPSignalProvider // Description: XMAP based signal provider ... // // // Maintainer: // ------------ // Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) // ////////////////////////////////////////////////////// // // Global Properties ... #property library #property copyright "Copyright 2023, SaherElm IT Center" #property link "https://www.saherelm.ir" #property version "1.00" #property strict // // Imports all Indicators Helper here ... input group "XMAP Provider Indicators"; #include "x-saherelm.xmap.provider.xtm.indicator.helper.lib.mq5"; #include "x-saherelm.xmap.provider.xtd.oscillator.helper.lib.mq5"; #include "x-saherelm.xmap.provider.xobd.indicator.helper.lib.mq5"; #include "x-saherelm.xmap.provider.xchma.oscillator.helper.lib.mq5"; #include "x-saherelm.xmap.provider.xchlh.oscillator.helper.lib.mq5"; // int xMAPMaxLengthOfInputs = 0; int xMAPCalculatedBars = 0; // // Init Indicators ... bool XMAPInitIndicators() { // bool result = false; // // Check and Calculate Max Length in Inputs ... xMAPMaxLengthOfInputs = MathMax( xCHLHScLength, xCHLHMcLength); xMAPMaxLengthOfInputs = MathMax( xMAPMaxLengthOfInputs, xCHLHLcLength); xMAPMaxLengthOfInputs = MathMax( xMAPMaxLengthOfInputs, xTDLength); xMAPMaxLengthOfInputs = MathMax( xMAPMaxLengthOfInputs, xCHMALcFastLength); xMAPMaxLengthOfInputs = MathMax( xMAPMaxLengthOfInputs, xCHMALcSlowLength); xMAPMaxLengthOfInputs = MathMax( xMAPMaxLengthOfInputs, xCHMAMcFastLength); xMAPMaxLengthOfInputs = MathMax( xMAPMaxLengthOfInputs, xCHMAMcSlowLength); xMAPMaxLengthOfInputs = MathMax( xMAPMaxLengthOfInputs, xCHMAScFastLength); xMAPMaxLengthOfInputs = MathMax( xMAPMaxLengthOfInputs, xCHMAScSlowLength); // // Initialize Indicator/Oscillator Handlers ... ResetLastError(); // // XCHMA Init ... result = XCHMAInitHandlers(); if (!result) { return result; } // // XCHLH Init ... result = XCHLHInitHandlers(); if (!result) { return result; } // // XTD Init ... result = XTDInitHandlers(); if (!result) { return result; } // // XOBD Init ... result = XOBDInitHandlers(); if (!result) { return result; } // // XTM Init ... result = XTMInitHandlers(); if (!result) { return result; } // result = true; // return result; } // // Release Indicators ... void XMAPReleaseIndicators() { // // Release Handlers ... XTDReleaseHandlers(); XTMReleaseHandlers(); XOBDReleaseHandlers(); XCHMAReleaseHandlers(); XCHLHReleaseHandlers(); } // // Handle Reading Buffers ... void XMAPHandleReadingBuffers() { // // Reading Calculated Bars for a Simple Handler ... xMAPCalculatedBars = BarsCalculated(xCHMAHandler); // // Read Indicators Buffers ... XTMReadBuffers(); XTDReadBuffers(); XOBDReadBuffers(); XCHMAReadBuffers(); XCHLHReadBuffers(); } // // // START Combination Functions ... // // // // // // XTD Based Long Conditions ... // bool XTDHasLongConditions() // { // // // XOHCL c1 = GetCandle(1); // XOHCL c2 = GetCandle(2); // XOHCL c3 = GetCandle(3); // XOHCL c4 = GetCandle(4); // XOHCL c5 = GetCandle(5); // // // double ask = GetAsk(); // double bid = GetBid(); // double entry = GetEntry(); // // // // XTD Detect Bullish Crossed Over Bearish ... // bool isXTDBullishCrossedOverBearish = // // // xTDBullishBuffer[1] > xTDBearishBuffer[1] && // !(xTDBullishBuffer[2] > xTDBearishBuffer[2]); // // // // XTD Detect Bullish Power Up ... // bool isXTDBullishTrendUp = // // // xTDBullishBuffer[1] > xTDBullishBuffer[2] && // xTDBullishBuffer[1] > xTDBullishBuffer[3] && // xTDBullishBuffer[1] > xTDBullishBuffer[4] && // xTDBullishBuffer[1] > xTDBullishBuffer[5] && // xTDBullishBuffer[1] > xTDBullishBuffer[6]; // // // // XTD Passed ... // bool result = // isXTDBullishTrendUp && // isXTDBullishCrossedOverBearish; // // // return result; // } // // // // XCHMA Based Long Conditions ... // bool XCHMAHasLongCondition() // { // // // bool result = false; // // // // We have to Find Peaks and Vales ... // // each indicator has specific way to find it ... // // // // Method 7 ... // // Find all Vales for Starting Long Position ... // bool isMethod7HasSignal = // // // XTMHasLongConditions() // // // ; // // // result = // // // // Method 7 ... // isMethod7HasSignal // // // ; // // // return result; // } // // // // XCHMA Based Check Can Close Long Trades ... // bool XCHMACanCloseLongTrades() // { // // // bool result = false; // // // double xCHMAMinValue1 = XCHMAGetMinValue(1); // double xCHMAMinValue2 = XCHMAGetMinValue(2); // // // bool isSCFastUnderSlow = // xCHMAScFastBuffer[1] < xCHMAScSlowBuffer[1] && // xCHMAScFastBuffer[2] < xCHMAScSlowBuffer[2]; // // // bool isSCFastCrossedUnderMin = // xCHMAScFastBuffer[1] <= xCHMAMinValue1 && xCHMAScFastBuffer[2] > xCHMAMinValue2; // // // result = // isSCFastUnderSlow && // isSCFastCrossedUnderMin; // // // return result; // } // // // // XCHLH Based Check Can Close Long Trades ... // bool XCHLHCanCloseLongTrades() // { // // // bool result = false; // // // // MC LL and SC LL same for Loopback Length ... // // and SC LL [1] < 2 < 3 < 4 < 5 // // and SC HH < MC HH // // and SC HH[1] < 2 < 3 < 4 < 5 // // // bool isMCSCLLSameForLoopback = XCHLHIsSameMCSCLL(1); // bool isSCLLLessThanLoopback = true; // bool isSCHHLessThanMCHH = xCHLHScHHBuffer[1] < xCHLHMcHHBuffer[1]; // bool isSCHHLessThanLoopback = true; // for (int i = 2; i < xCHLHScLength + 1; i++) // { // // // bool isSameLL = XCHLHIsSameMCSCLL(i); // isMCSCLLSameForLoopback = isMCSCLLSameForLoopback && isSameLL; // // // bool isScLLLess = xCHLHScLLBuffer[1] < xCHLHScLLBuffer[i]; // isSCLLLessThanLoopback = isSCLLLessThanLoopback || isScLLLess; // // // bool isSCHHLessThanMC = xCHLHScHHBuffer[i] < xCHLHMcHHBuffer[i]; // isSCHHLessThanMCHH = isSCHHLessThanMCHH && isSCHHLessThanMC; // // // bool isSCHHLess = xCHLHScHHBuffer[1] < xCHLHScHHBuffer[i]; // isSCHHLessThanLoopback = isSCHHLessThanLoopback || isSCHHLess; // } // // // result = // // // isMCSCLLSameForLoopback && // // // isSCLLLessThanLoopback && // // // isSCHHLessThanMCHH && // // // isSCHHLessThanLoopback // // // ; // // // return result; // } // // // END Combination Functions ... // //