prepare workspace by eu5, add some scripts and node modules on Documents folder, extends compile script and also node module to automate usefull most commonly used compilation tasks and also create required npm scripts and vscode debug lunch tasks based on them ...
This commit is contained in:
@@ -0,0 +1,358 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 XFI 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 ...
|
||||
//
|
||||
|
||||
//
|
||||
// END Enum Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Inputs ...
|
||||
//
|
||||
|
||||
// input group "XFI Oscillator";
|
||||
|
||||
// //
|
||||
// input int xFILength = 18; // Market Length
|
||||
// input ENUM_MA_METHOD xFIMethod = MODE_SMA; // MA Method
|
||||
// input ENUM_APPLIED_VOLUME xFIAppliedTo = VOLUME_TICK; // Applied To
|
||||
|
||||
//
|
||||
// Configurations ...
|
||||
int xFILength = 18; // Market Length
|
||||
ENUM_MA_METHOD xFIMethod = MODE_SMA; // MA Method
|
||||
ENUM_APPLIED_VOLUME xFIAppliedTo = VOLUME_TICK; // Applied To
|
||||
|
||||
//
|
||||
// END Inputs ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Definitions ...
|
||||
//
|
||||
|
||||
int xFIHandler = INVALID_HANDLE;
|
||||
double xFIBuffer[];
|
||||
|
||||
//
|
||||
// END Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Validate Inputs ...
|
||||
bool XFIValidateInputs()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = xFILength > 2;
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XFI Oscillator Inputs Validation Failed ...");
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Init Oscillators ...
|
||||
bool XFIInitHandlers()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Initialize Indicator/Oscillator Handlers ...
|
||||
ResetLastError();
|
||||
|
||||
//
|
||||
// XFI Handler ...
|
||||
ArraySetAsSeries(xFIBuffer, true);
|
||||
xFIHandler = iCustom(
|
||||
_Symbol,
|
||||
_Period,
|
||||
"x-saherelm.xfi.oscillator",
|
||||
//
|
||||
// Inputs ...
|
||||
xFILength,
|
||||
xFIMethod,
|
||||
xFIAppliedTo
|
||||
//
|
||||
);
|
||||
if (xFIHandler == INVALID_HANDLE)
|
||||
{
|
||||
//
|
||||
LogMessage("failed to Initialize XFI Oscillator: " + (string)GetLastError());
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = true;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Release Oscillators ...
|
||||
void XFIReleaseHandlers()
|
||||
{
|
||||
IndicatorRelease(xFIHandler);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Reading Buffers ...
|
||||
void XFIReadBuffers(
|
||||
int xFIItemsPerTick // Number Of Reading Buffer Items Per Tick
|
||||
)
|
||||
{
|
||||
//
|
||||
// XFI Signal ...
|
||||
CopyBuffer(
|
||||
xFIHandler,
|
||||
0,
|
||||
0,
|
||||
xFIItemsPerTick,
|
||||
xFIBuffer);
|
||||
}
|
||||
|
||||
//
|
||||
// END Handler Funcions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START XFI Custom Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Check SC is Peak ...
|
||||
bool XFIIsPeak(
|
||||
int bar_index, // Specified Index ...
|
||||
int length = 10 // Specified Length ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (
|
||||
length <= 0 ||
|
||||
bar_index <= 0 ||
|
||||
!XFIIsValidBuffersSize(bar_index + length + 1))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Must Decreasing ...
|
||||
bool isIncreasing = IsIncreasing(
|
||||
bar_index + length,
|
||||
bar_index,
|
||||
xFIBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check SC is Vale ...
|
||||
bool XFIIsVale(
|
||||
int bar_index, // Specified Index ...
|
||||
int length = 10 // Specified Length ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (
|
||||
length <= 0 ||
|
||||
bar_index <= 0 ||
|
||||
!XFIIsValidBuffersSize(bar_index + length + 1))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = IsDecreasing(
|
||||
bar_index + length,
|
||||
bar_index,
|
||||
xFIBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect XFI Crossed Over Zero ...
|
||||
bool XFIIsCrossedOverZero(
|
||||
int bar_index // Specified Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
if (
|
||||
bar_index < 0 ||
|
||||
!XFIIsValidBuffersSize(bar_index + 2))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
xFIBuffer[bar_index] > 0 &&
|
||||
xFIBuffer[bar_index + 1] <= 0;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect XFI Over Zero ...
|
||||
bool XFIIsOverZero(
|
||||
int bar_index // Specified Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
if (
|
||||
bar_index < 0 ||
|
||||
!XFIIsValidBuffersSize(bar_index + 1))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
xFIBuffer[bar_index] > 0;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect XFI Crossed Under Zero ...
|
||||
bool XFIIsCrossedUnderZero(
|
||||
int bar_index // Specified Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
if (
|
||||
bar_index < 0 ||
|
||||
!XFIIsValidBuffersSize(bar_index + 2))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
xFIBuffer[bar_index] < 0 &&
|
||||
xFIBuffer[bar_index + 1] >= 0;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect XFI Under Zero ...
|
||||
bool XFIIsUnderZero(
|
||||
int bar_index // Specified Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
if (
|
||||
bar_index < 0 ||
|
||||
!XFIIsValidBuffersSize(bar_index + 1))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
xFIBuffer[bar_index] < 0;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check all Buffers has valid Size ...
|
||||
bool XFIIsValidBuffersSize(
|
||||
int size // the size of buffers which min size for requirements
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (
|
||||
size <= 0 ||
|
||||
//
|
||||
ArraySize(xFIBuffer) < size
|
||||
//
|
||||
)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// END XFI Custom Functions ...
|
||||
//
|
||||
Reference in New Issue
Block a user