add new node js files to manage publishing processes and also backup other Markets Parsers and Delete them for improve Speed of Compilation ...
This commit is contained in:
@@ -0,0 +1,573 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Strategy Parser Library
|
||||
// ------------------------------------------------
|
||||
// Name: XCHStartegyConditionsParser
|
||||
// Description: provide all conditions parsing
|
||||
// for XCH Strategy ...
|
||||
//
|
||||
//
|
||||
// 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 ...
|
||||
#include "../../Strategies/x-saherelm.xch.strategy.mq5"
|
||||
|
||||
//
|
||||
#include "./DowJones/x-saherelm.xch.errante.us30.long.parser.mq5"
|
||||
#include "./DowJones/x-saherelm.xch.errante.us30.short.parser.mq5"
|
||||
#include "./EURGBP/x-saherelm.xch.errante.eurgbp.long.parser.mq5"
|
||||
#include "./EURGBP/x-saherelm.xch.errante.eurgbp.short.parser.mq5"
|
||||
#include "./EURJPY/x-saherelm.xch.errante.eurjpy.long.parser.mq5"
|
||||
#include "./EURJPY/x-saherelm.xch.errante.eurjpy.short.parser.mq5"
|
||||
#include "./EURCHF/x-saherelm.xch.errante.eurchf.long.parser.mq5"
|
||||
#include "./EURCHF/x-saherelm.xch.errante.eurchf.short.parser.mq5"
|
||||
#include "./AUDUSD/x-saherelm.xch.errante.audusd.long.parser.mq5"
|
||||
#include "./AUDUSD/x-saherelm.xch.errante.audusd.short.parser.mq5"
|
||||
#include "./NZDUSD/x-saherelm.xch.errante.nzdusd.long.parser.mq5"
|
||||
#include "./NZDUSD/x-saherelm.xch.errante.nzdusd.short.parser.mq5"
|
||||
#include "./USDCAD/x-saherelm.xch.errante.usdcad.long.parser.mq5"
|
||||
#include "./USDCAD/x-saherelm.xch.errante.usdcad.short.parser.mq5"
|
||||
#include "./EURCAD/x-saherelm.xch.errante.eurcad.long.parser.mq5"
|
||||
#include "./EURCAD/x-saherelm.xch.errante.eurcad.short.parser.mq5"
|
||||
#include "./EURUSD/x-saherelm.xch.errante.eurusd.long.parser.mq5"
|
||||
#include "./EURUSD/x-saherelm.xch.errante.eurusd.short.parser.mq5"
|
||||
#include "./USDJPY/x-saherelm.xch.errante.usdjpy.long.parser.mq5"
|
||||
#include "./USDJPY/x-saherelm.xch.errante.usdjpy.short.parser.mq5"
|
||||
#include "./USDCHF/x-saherelm.xch.errante.usdchf.long.parser.mq5"
|
||||
#include "./USDCHF/x-saherelm.xch.errante.usdchf.short.parser.mq5"
|
||||
#include "./GBPUSD/x-saherelm.xch.errante.gbpusd.long.parser.mq5"
|
||||
#include "./GBPUSD/x-saherelm.xch.errante.gbpusd.short.parser.mq5"
|
||||
#include "./XAUUSD/x-saherelm.xch.errante.xauusd.long.parser.mq5"
|
||||
#include "./XAUUSD/x-saherelm.xch.errante.xauusd.short.parser.mq5"
|
||||
|
||||
//
|
||||
// Conditions Parser ...
|
||||
struct XCHStartegyErranteConditionsParser
|
||||
{
|
||||
//
|
||||
string _version;
|
||||
|
||||
//
|
||||
// Parsers ...
|
||||
XSymbolParser _symbolParser;
|
||||
|
||||
//
|
||||
// EURUSD ...
|
||||
XCHStartegyErranteEURUSDLongConditionsParser _eurusdLongParser;
|
||||
XCHStartegyErranteEURUSDShortConditionsParser _eurusdShortParser;
|
||||
|
||||
//
|
||||
// GBPUSD ...
|
||||
XCHStartegyErranteGBPUSDLongConditionsParser _gbpusdLongParser;
|
||||
XCHStartegyErranteGBPUSDShortConditionsParser _gbpusdShortParser;
|
||||
|
||||
//
|
||||
// EURGBP ...
|
||||
XCHStartegyErranteEURGBPLongConditionsParser _eurgbpLongParser;
|
||||
XCHStartegyErranteEURGBPShortConditionsParser _eurgbpShortParser;
|
||||
|
||||
//
|
||||
// USDJPY ...
|
||||
XCHStartegyErranteUSDJPYLongConditionsParser _usdjpyLongParser;
|
||||
XCHStartegyErranteUSDJPYShortConditionsParser _usdjpyShortParser;
|
||||
|
||||
//
|
||||
// EURJPY ...
|
||||
XCHStartegyErranteEURJPYLongConditionsParser _eurjpyLongParser;
|
||||
XCHStartegyErranteEURJPYShortConditionsParser _eurjpyShortParser;
|
||||
|
||||
//
|
||||
// USDCHF ...
|
||||
XCHStartegyErranteUSDCHFLongConditionsParser _usdchfLongParser;
|
||||
XCHStartegyErranteUSDCHFShortConditionsParser _usdchfShortParser;
|
||||
|
||||
//
|
||||
// EURCHF ...
|
||||
XCHStartegyErranteEURCHFLongConditionsParser _eurchfLongParser;
|
||||
XCHStartegyErranteEURCHFShortConditionsParser _eurchfShortParser;
|
||||
|
||||
//
|
||||
// XAUUSD ...
|
||||
XCHStartegyErranteXAUUSDLongConditionsParser _xauusdLongParser;
|
||||
XCHStartegyErranteXAUUSDShortConditionsParser _xauusdShortParser;
|
||||
|
||||
//
|
||||
// DOWJONES ...
|
||||
XCHStartegyErranteUS30LongConditionsParser _dowjonesLongParser;
|
||||
XCHStartegyErranteUS30ShortConditionsParser _dowjonesShortParser;
|
||||
|
||||
//
|
||||
// AUDUSD ...
|
||||
XCHStartegyErranteAUDUSDLongConditionsParser _audusdLongParser;
|
||||
XCHStartegyErranteAUDUSDShortConditionsParser _audusdShortParser;
|
||||
|
||||
//
|
||||
// NZDUSD ...
|
||||
XCHStartegyErranteNZDUSDLongConditionsParser _nzdusdLongParser;
|
||||
XCHStartegyErranteNZDUSDShortConditionsParser _nzdusdShortParser;
|
||||
|
||||
//
|
||||
// USDCAD ...
|
||||
XCHStartegyErranteUSDCADLongConditionsParser _usdcadLongParser;
|
||||
XCHStartegyErranteUSDCADShortConditionsParser _usdcadShortParser;
|
||||
|
||||
//
|
||||
// EURCAD ...
|
||||
XCHStartegyErranteEURCADLongConditionsParser _eurcadLongParser;
|
||||
XCHStartegyErranteEURCADShortConditionsParser _eurcadShortParser;
|
||||
|
||||
//
|
||||
bool IsFiltered(
|
||||
XSignal &signal, // Provided Signal
|
||||
XCHStrategyConditions &conditions, // Market Conditions
|
||||
bool force = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
if (!signal.IsValid() || !conditions.IsValid())
|
||||
{
|
||||
//
|
||||
result = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isLong = IsLong(signal.type);
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
isLong
|
||||
? IsLongFiltered(
|
||||
signal,
|
||||
conditions,
|
||||
force //
|
||||
)
|
||||
: IsShortFiltered(
|
||||
signal,
|
||||
conditions,
|
||||
force //
|
||||
)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Filter Long Signals ...
|
||||
bool IsLongFiltered(
|
||||
XSignal &signal,
|
||||
XCHStrategyConditions &conditions,
|
||||
bool force = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isEURUSD = _symbolParser.IsEURUSD(signal.symbol);
|
||||
bool isGBPUSD = _symbolParser.IsGBPUSD(signal.symbol);
|
||||
bool isEURGBP = _symbolParser.IsEURGBP(signal.symbol);
|
||||
bool isXAUUSD = _symbolParser.IsXAUUSD(signal.symbol);
|
||||
bool isUSDJPY = _symbolParser.IsUSDJPY(signal.symbol);
|
||||
bool isEURJPY = _symbolParser.IsEURJPY(signal.symbol);
|
||||
bool isUSDCHF = _symbolParser.IsUSDCHF(signal.symbol);
|
||||
bool isEURCHF = _symbolParser.IsEURCHF(signal.symbol);
|
||||
bool isAUDUSD = _symbolParser.IsAUDUSD(signal.symbol);
|
||||
bool isNZDUSD = _symbolParser.IsNZDUSD(signal.symbol);
|
||||
bool isUSDCAD = _symbolParser.IsUSDCAD(signal.symbol);
|
||||
bool isEURCAD = _symbolParser.IsEURCAD(signal.symbol);
|
||||
bool isDowJones = _symbolParser.IsDowJones(signal.symbol);
|
||||
|
||||
//
|
||||
bool isEURUSDFiltered = _eurusdLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isGBPUSDFiltered = _gbpusdLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isEURGBPFiltered = _eurgbpLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isUSDJPYFiltered = _usdjpyLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isEURJPYFiltered = _eurjpyLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isUSDCHFFiltered = _usdchfLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isEURCHFFiltered = _eurchfLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isXAUUSDFiltered = _xauusdLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isAUDUSDFiltered = _audusdLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isNZDUSDFiltered = _nzdusdLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isUSDCADFiltered = _usdcadLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isEURCADFiltered = _eurcadLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isDowJonesFiltered = _dowjonesLongParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
|
||||
//
|
||||
if (!force)
|
||||
{
|
||||
//
|
||||
if (isEURUSD)
|
||||
{
|
||||
result = isEURUSDFiltered;
|
||||
}
|
||||
else if (isGBPUSD)
|
||||
{
|
||||
result = isGBPUSDFiltered;
|
||||
}
|
||||
else if (isEURGBP)
|
||||
{
|
||||
result = isEURGBPFiltered;
|
||||
}
|
||||
else if (isUSDJPY)
|
||||
{
|
||||
result = isUSDJPYFiltered;
|
||||
}
|
||||
else if (isEURJPY)
|
||||
{
|
||||
result = isEURJPYFiltered;
|
||||
}
|
||||
else if (isUSDCHF)
|
||||
{
|
||||
result = isUSDCHFFiltered;
|
||||
}
|
||||
else if (isEURCHF)
|
||||
{
|
||||
result = isEURCHFFiltered;
|
||||
}
|
||||
else if (isXAUUSD)
|
||||
{
|
||||
result = isXAUUSDFiltered;
|
||||
}
|
||||
else if (isAUDUSD)
|
||||
{
|
||||
result = isAUDUSDFiltered;
|
||||
}
|
||||
else if (isNZDUSD)
|
||||
{
|
||||
result = isNZDUSDFiltered;
|
||||
}
|
||||
else if (isUSDCAD)
|
||||
{
|
||||
result = isUSDCADFiltered;
|
||||
}
|
||||
else if (isEURCAD)
|
||||
{
|
||||
result = isEURCADFiltered;
|
||||
}
|
||||
else if (isDowJones)
|
||||
{
|
||||
result = isDowJonesFiltered;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
result =
|
||||
//
|
||||
isEURUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isGBPUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isEURGBPFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isUSDJPYFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isEURJPYFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isUSDCHFFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isEURCHFFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isXAUUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isAUDUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isNZDUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isUSDCADFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isEURCADFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isDowJonesFiltered
|
||||
//
|
||||
;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Filter Short Signals ...
|
||||
bool IsShortFiltered(
|
||||
XSignal &signal,
|
||||
XCHStrategyConditions &conditions,
|
||||
bool force = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isEURUSD = _symbolParser.IsEURUSD(signal.symbol);
|
||||
bool isGBPUSD = _symbolParser.IsGBPUSD(signal.symbol);
|
||||
bool isEURGBP = _symbolParser.IsEURGBP(signal.symbol);
|
||||
bool isXAUUSD = _symbolParser.IsXAUUSD(signal.symbol);
|
||||
bool isUSDJPY = _symbolParser.IsUSDJPY(signal.symbol);
|
||||
bool isEURJPY = _symbolParser.IsEURJPY(signal.symbol);
|
||||
bool isUSDCHF = _symbolParser.IsUSDCHF(signal.symbol);
|
||||
bool isEURCHF = _symbolParser.IsEURCHF(signal.symbol);
|
||||
bool isAUDUSD = _symbolParser.IsAUDUSD(signal.symbol);
|
||||
bool isNZDUSD = _symbolParser.IsNZDUSD(signal.symbol);
|
||||
bool isUSDCAD = _symbolParser.IsUSDCAD(signal.symbol);
|
||||
bool isEURCAD = _symbolParser.IsEURCAD(signal.symbol);
|
||||
bool isDowJones = _symbolParser.IsDowJones(signal.symbol);
|
||||
|
||||
//
|
||||
bool isEURUSDFiltered = _eurusdShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isGBPUSDFiltered = _gbpusdShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isEURGBPFiltered = _eurgbpShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isUSDJPYFiltered = _usdjpyShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isEURJPYFiltered = _eurjpyShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isUSDCHFFiltered = _usdchfShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isEURCHFFiltered = _eurchfShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isXAUUSDFiltered = _xauusdShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isAUDUSDFiltered = _audusdShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isNZDUSDFiltered = _nzdusdShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isUSDCADFiltered = _usdcadShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isEURCADFiltered = _eurcadShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
bool isDowJonesFiltered = _dowjonesShortParser.IsFiltered(
|
||||
signal,
|
||||
conditions //
|
||||
);
|
||||
|
||||
//
|
||||
if (!force)
|
||||
{
|
||||
//
|
||||
if (isEURUSD)
|
||||
{
|
||||
result = isEURUSDFiltered;
|
||||
}
|
||||
else if (isGBPUSD)
|
||||
{
|
||||
result = isGBPUSDFiltered;
|
||||
}
|
||||
else if (isEURGBP)
|
||||
{
|
||||
result = isEURGBPFiltered;
|
||||
}
|
||||
else if (isUSDJPY)
|
||||
{
|
||||
result = isUSDJPYFiltered;
|
||||
}
|
||||
else if (isEURJPY)
|
||||
{
|
||||
result = isEURJPYFiltered;
|
||||
}
|
||||
else if (isUSDCHF)
|
||||
{
|
||||
result = isUSDCHFFiltered;
|
||||
}
|
||||
else if (isEURCHF)
|
||||
{
|
||||
result = isEURCHFFiltered;
|
||||
}
|
||||
else if (isXAUUSD)
|
||||
{
|
||||
result = isXAUUSDFiltered;
|
||||
}
|
||||
else if (isAUDUSD)
|
||||
{
|
||||
result = isAUDUSDFiltered;
|
||||
}
|
||||
else if (isNZDUSD)
|
||||
{
|
||||
result = isNZDUSDFiltered;
|
||||
}
|
||||
else if (isUSDCAD)
|
||||
{
|
||||
result = isUSDCADFiltered;
|
||||
}
|
||||
else if (isEURCAD)
|
||||
{
|
||||
result = isEURCADFiltered;
|
||||
}
|
||||
else if (isDowJones)
|
||||
{
|
||||
result = isDowJonesFiltered;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
result =
|
||||
//
|
||||
isEURUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isGBPUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isEURGBPFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isUSDJPYFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isEURJPYFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isUSDCHFFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isEURCHFFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isXAUUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isAUDUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isNZDUSDFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isUSDCADFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isEURCADFiltered
|
||||
//
|
||||
||
|
||||
//
|
||||
isDowJonesFiltered
|
||||
//
|
||||
;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user