167 lines
3.3 KiB
Plaintext
167 lines
3.3 KiB
Plaintext
///////////////////////////////////////////////////////////////////
|
|
//
|
|
// 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";
|
|
|
|
//
|
|
// Imports all Indicators Helper here ...
|
|
input group "XTEST Provider Indicators";
|
|
//
|
|
#include "x-saherelm.xtm.indicator.helper.lib.mq5";
|
|
|
|
//
|
|
int xTESTMaxLengthOfInputs = 0;
|
|
int xTESTCalculatedBars = 0;
|
|
|
|
//
|
|
// Init Indicators ...
|
|
bool XTESTInitIndicators()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Check and Calculate Max Length in Inputs ...
|
|
xTESTMaxLengthOfInputs = MathMax(
|
|
xTMMaPeriod,
|
|
xTESTMaxLengthOfInputs);
|
|
xTESTMaxLengthOfInputs = MathMax(
|
|
xTESTNumberOfItemsPerTick,
|
|
xTESTMaxLengthOfInputs);
|
|
|
|
//
|
|
// Initialize Indicator/Oscillator Handlers ...
|
|
ResetLastError();
|
|
|
|
//
|
|
// XTM Init ...
|
|
result = XTMInitHandlers();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = true;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Release Indicators ...
|
|
void XTESTReleaseIndicators()
|
|
{
|
|
//
|
|
// Release Handlers ...
|
|
XTMReleaseHandlers();
|
|
}
|
|
|
|
//
|
|
// Handle Reading Buffers ...
|
|
void XTESTHandleReadingBuffers()
|
|
{
|
|
//
|
|
// Reading Calculated Bars for a Simple Handler ...
|
|
xTESTCalculatedBars = BarsCalculated(xTMHandler);
|
|
|
|
//
|
|
// Read Indicators Buffers ...
|
|
XTMReadBuffers(xTESTNumberOfItemsPerTick);
|
|
}
|
|
|
|
//
|
|
//
|
|
// 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()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = XTMHasLongConditions(xTESTNumberOfItemsPerTick);
|
|
|
|
//
|
|
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;
|
|
|
|
//
|
|
// TODO: Check Market Conditions for Close Long Trades ...
|
|
// result = XTESTHasLongCloseConditions(xTESTNumberOfItemsPerTick);
|
|
|
|
//
|
|
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()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = XTMHasShortConditions(xTESTNumberOfItemsPerTick);
|
|
|
|
//
|
|
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;
|
|
|
|
//
|
|
// TODO: Check Market Conditions for Close Short Trades ...
|
|
// result = XTESTHasShortCloseConditions(xTESTNumberOfItemsPerTick);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
//
|
|
// END Combination Functions ...
|
|
//
|
|
//
|