///////////////////////////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 XOBD Oscillator Helper for Signal Providers // -------------------------------------------------------------------------- // // 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 // // Includes ... #include "..\Libraries\x-saherelm.log.lib.mq5" #include "..\Libraries\x-saherelm.common.lib.mq5" // // START Enum Definitions ... // // // XOBD Oscillator Buffer Lines ... enum ENUM_X_XOBD_BUFFER_LINES { X_XOBD_SWING_HIGH_LINE = 0, X_XOBD_SWING_LOW_LINE = 1, X_XOBD_SIGNAL_LINE = 2, }; // // END Enum Definitions ... // // // START Inputs ... // input group "XOBD Oscillator"; input int xOBDLength = 72; // Market Length // // END Inputs ... // // // START Definitions ... // int xOBDHandler = INVALID_HANDLE; double xOBDSwingHighBuffer[]; double xOBDSwingLowBuffer[]; double xOBDSignalBuffer[]; // // END Definitions ... // // // START Handler Functions ... // // // Init Oscillators ... bool XOBDInitHandlers() { // bool result = false; // // Initialize Indicator/Oscillator Handlers ... ResetLastError(); // // XOBD Handler ... ArraySetAsSeries(xOBDSwingHighBuffer, true); ArraySetAsSeries(xOBDSwingLowBuffer, true); ArraySetAsSeries(xOBDSignalBuffer, true); xOBDHandler = iCustom( _Symbol, _Period, "x-saherelm.xobd.oscillator", // // Inputs ... xOBDLength // ); if (xOBDHandler == INVALID_HANDLE) { // LogMessage("failed to Initialize XOBD Oscillator: " + (string)GetLastError()); return result; } // result = true; // return result; } // // Release Oscillators ... void XOBDReleaseHandlers() { IndicatorRelease(xOBDHandler); } // // Handle Reading Buffers ... void XOBDReadBuffers( int xOBDItemsPerTick // Number Of Reading Buffer Items Per Tick ) { // XOBD Swing High ... CopyBuffer( xOBDHandler, X_XOBD_SWING_HIGH_LINE, 0, xOBDItemsPerTick, xOBDSwingHighBuffer); // // XOBD Swing Low ... CopyBuffer( xOBDHandler, X_XOBD_SWING_LOW_LINE, 0, xOBDItemsPerTick, xOBDSwingLowBuffer); // // XOBD Signal ... CopyBuffer( xOBDHandler, X_XOBD_SIGNAL_LINE, 0, xOBDItemsPerTick, xOBDSignalBuffer); } // // END Handler Funcions ... // // // START Signal Related Conditions ... // // // XOBD Long Conditions ... bool XOBDHasLongConditions( int xOBDItemsPerTick // Number Of Reading Buffer Items Per Tick ) { // bool result = false; // bool isVale = XOBDIsVale(); bool isInPeak = IsInPeak( xOBDItemsPerTick, xOBDSignalBuffer); // result = // isVale // && // !isInPeak // ; // return result; } // // XOBD Short Conditions ... bool XOBDHasShortConditions( int xOBDItemsPerTick // Number Of Reading Buffer Items Per Tick ) { // bool result = false; // return result; } // // END Signal Related Conditions ... // // // START XOBD Custom Functions ... // // // Check all Buffers has valid Size ... bool XOBDIsValidBuffersSize( int size // the size of buffers which min size for requirements ) { // bool result = false; // if ( size <= 0 || // ArraySize(xOBDSignalBuffer) < size || ArraySize(xOBDSwingLowBuffer) < size || ArraySize(xOBDSwingHighBuffer) < size // ) { result = false; } else { result = true; } // return result; } // // Check SC is Peak ... bool XOBDIsPeak() { // bool result = false; // bool isIncreasing = IsIncreasing( 10, 3, xOBDSignalBuffer); // bool isDecreasing = IsDecreasing( 3, 1, xOBDSignalBuffer); // // Generating Result ... result = // isIncreasing // && // isDecreasing // ; // return result; } // // Check SC is Vale ... bool XOBDIsVale() { // bool result = false; // bool isIncreasing = IsIncreasing( 5, 1, xOBDSignalBuffer); // bool isDecreasing = IsDecreasing( 20, 5, xOBDSignalBuffer); // // Generating Result ... result = // isIncreasing // && // isDecreasing // ; // return result; } // // Check Signal Crossed Over Swing High ... bool XOBDIsSignalCrossedOverSwingHigh( int bar_index // Specified Index ... ) { // bool result = false; // if ( bar_index <= 0 || !XOBDIsValidBuffersSize(bar_index + 2)) { return result; } // result = IsCrossOver( xOBDSignalBuffer, xOBDSwingHighBuffer, bar_index); // return result; } // // Check Signal Over Swing High ... bool XOBDIsSignalOverSwingHigh( int bar_index // Specified Index ... ) { // bool result = false; // if ( bar_index <= 0 || !XOBDIsValidBuffersSize(bar_index + 2)) { return result; } // result = IsOver( xOBDSignalBuffer, xOBDSwingHighBuffer, bar_index); // return result; } // // Check Signal Crossed Under Swing High ... bool XOBDIsSignalCrossedUnderSwingHigh( int bar_index // Specified Index ... ) { // bool result = false; // if ( bar_index <= 0 || !XOBDIsValidBuffersSize(bar_index + 2)) { return result; } // result = IsCrossUnder( xOBDSignalBuffer, xOBDSwingHighBuffer, bar_index); // return result; } // // Check Signal Under Swing High ... bool XOBDIsSignalUnderSwingHigh( int bar_index // Specified Index ... ) { // bool result = false; // if ( bar_index <= 0 || !XOBDIsValidBuffersSize(bar_index + 2)) { return result; } // result = IsUnder( xOBDSignalBuffer, xOBDSwingHighBuffer, bar_index); // return result; } // // END XOBD Custom Functions ... //