last ...
This commit is contained in:
@@ -26,7 +26,10 @@
|
||||
// Imports ...
|
||||
#include "../Helpers/x-saherelm.xct.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.xcc.helper.mq5"
|
||||
|
||||
//
|
||||
#include "../Strategies/x-saherelm.xsrbr.strategy.mq5"
|
||||
#include "../Strategies/x-saherelm.xemrng.strategy.mq5"
|
||||
|
||||
//
|
||||
// Inputs ...
|
||||
@@ -177,15 +180,30 @@ bool InitialEA()
|
||||
//
|
||||
bool drawAreas = false;
|
||||
|
||||
//
|
||||
bool useEURUSD = true;
|
||||
bool useUSDCHF = false;
|
||||
bool useUSDJPY = false;
|
||||
bool useGBPUSD = false;
|
||||
bool useXAUUSD = false;
|
||||
|
||||
//
|
||||
bool useXSRBR = false;
|
||||
bool useXEMRNG = true;
|
||||
|
||||
//
|
||||
// EURUSD ...
|
||||
string eurusdSymbol = "EURUSDb"; // symbolParser.GetEURUSDSymbol();
|
||||
if (IsValid(eurusdSymbol))
|
||||
if (useEURUSD && IsValid(eurusdSymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = mMagicNumber + 1;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *eurusdM5SRBRStrategy;
|
||||
@@ -237,15 +255,48 @@ bool InitialEA()
|
||||
RegisterStrategy(eurusdM15SRBRStrategy);
|
||||
}
|
||||
|
||||
//
|
||||
// XEMRNG ...
|
||||
if (useXEMRNG)
|
||||
{
|
||||
//
|
||||
XSCXEMRNGStrategy *eurusdM5EMRNGStrategy;
|
||||
eurusdM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||
eurusdSymbol,
|
||||
PERIOD_M5,
|
||||
eaVolume,
|
||||
1.5, // R2R ...
|
||||
mSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
200, // TP
|
||||
100, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
0, // Max Longs
|
||||
0, // Max Shorts
|
||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||
);
|
||||
eurusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
eurusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(eurusdM5EMRNGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// USDCHF ...
|
||||
string usdchfSymbol = "USDCHFb";
|
||||
if (IsValid(usdchfSymbol))
|
||||
if (useUSDCHF && IsValid(usdchfSymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = mMagicNumber + 2;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *usdchfM5SRBRStrategy;
|
||||
@@ -272,6 +323,239 @@ bool InitialEA()
|
||||
RegisterStrategy(usdchfM5SRBRStrategy);
|
||||
}
|
||||
|
||||
//
|
||||
// XEMRNG ...
|
||||
if (useXEMRNG)
|
||||
{
|
||||
//
|
||||
XSCXEMRNGStrategy *usdchfM5EMRNGStrategy;
|
||||
usdchfM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||
usdchfSymbol,
|
||||
PERIOD_M5,
|
||||
eaVolume,
|
||||
1.5, // R2R ...
|
||||
mSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
200, // TP
|
||||
100, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
0, // Max Longs
|
||||
0, // Max Shorts
|
||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||
);
|
||||
usdchfM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
usdchfM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(usdchfM5EMRNGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// USDJPY ...
|
||||
string usdjpySymbol = "USDJPYb";
|
||||
if (useUSDJPY && IsValid(usdjpySymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = mMagicNumber + 3;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *usdjpyM5SRBRStrategy;
|
||||
usdjpyM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||
usdjpySymbol,
|
||||
PERIOD_M5,
|
||||
PERIOD_M30,
|
||||
eaVolume,
|
||||
1.5, // R2R ...
|
||||
mSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
200, // TP
|
||||
100, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
0, // Max Longs
|
||||
0, // Max Shorts
|
||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||
);
|
||||
usdjpyM5SRBRStrategy.SetAlertLogAlerts(true);
|
||||
usdjpyM5SRBRStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(usdjpyM5SRBRStrategy);
|
||||
}
|
||||
|
||||
//
|
||||
// XEMRNG ...
|
||||
if (useXEMRNG)
|
||||
{
|
||||
//
|
||||
XSCXEMRNGStrategy *usdjpyM5EMRNGStrategy;
|
||||
usdjpyM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||
usdjpySymbol,
|
||||
PERIOD_M5,
|
||||
eaVolume,
|
||||
1.5, // R2R ...
|
||||
mSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
200, // TP
|
||||
100, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
0, // Max Longs
|
||||
0, // Max Shorts
|
||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||
);
|
||||
usdjpyM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
usdjpyM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(usdjpyM5EMRNGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GBPUSD ...
|
||||
string gbpusdSymbol = "GBPUSDb";
|
||||
if (useGBPUSD && IsValid(gbpusdSymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = mMagicNumber + 4;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *gbpusdM5SRBRStrategy;
|
||||
gbpusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||
gbpusdSymbol,
|
||||
PERIOD_M5,
|
||||
PERIOD_H1,
|
||||
eaVolume,
|
||||
1.5, // R2R ...
|
||||
mSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
200, // TP
|
||||
100, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
0, // Max Longs
|
||||
0, // Max Shorts
|
||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||
);
|
||||
gbpusdM5SRBRStrategy.SetAlertLogAlerts(true);
|
||||
gbpusdM5SRBRStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(gbpusdM5SRBRStrategy);
|
||||
}
|
||||
|
||||
//
|
||||
// XEMRNG ...
|
||||
if (useXEMRNG)
|
||||
{
|
||||
//
|
||||
XSCXEMRNGStrategy *gbpusdM5EMRNGStrategy;
|
||||
gbpusdM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||
gbpusdSymbol,
|
||||
PERIOD_M5,
|
||||
eaVolume,
|
||||
1.5, // R2R ...
|
||||
mSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
200, // TP
|
||||
100, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
0, // Max Longs
|
||||
0, // Max Shorts
|
||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||
);
|
||||
gbpusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
gbpusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(gbpusdM5EMRNGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// XAUUSD ...
|
||||
string xauusdSymbol = "XAUUSDb";
|
||||
if (useXAUUSD && IsValid(xauusdSymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = mMagicNumber + 5;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *xauusdM5SRBRStrategy;
|
||||
xauusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||
xauusdSymbol,
|
||||
PERIOD_M15,
|
||||
PERIOD_M30,
|
||||
eaVolume,
|
||||
1.5, // R2R ...
|
||||
mSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
200, // TP
|
||||
100, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
0, // Max Longs
|
||||
0, // Max Shorts
|
||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||
);
|
||||
xauusdM5SRBRStrategy.SetAlertLogAlerts(true);
|
||||
xauusdM5SRBRStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(xauusdM5SRBRStrategy);
|
||||
}
|
||||
|
||||
//
|
||||
// XEMRNG ...
|
||||
if (useXEMRNG)
|
||||
{
|
||||
//
|
||||
XSCXEMRNGStrategy *xauusdM5EMRNGStrategy;
|
||||
xauusdM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||
xauusdSymbol,
|
||||
PERIOD_M5,
|
||||
eaVolume,
|
||||
1.5, // R2R ...
|
||||
mSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
200, // TP
|
||||
100, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
0, // Max Longs
|
||||
0, // Max Shorts
|
||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||
);
|
||||
xauusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
xauusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(xauusdM5EMRNGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2265,6 +2265,72 @@ struct XOHCL
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Bullish Marubozu ...
|
||||
bool IsBullishMarubozu()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid() && Index() > 0;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = IsBullish();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
GetUp() == high &&
|
||||
GetDown() == low
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Marubozu ...
|
||||
bool IsBearishMarubozu()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid() && Index() > 0;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = IsBearish();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
GetUp() == high &&
|
||||
GetDown() == low
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Contextual Patterns ...
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// --------------------------------------
|
||||
// Name: XSCXEMRNGStrategy
|
||||
// Description: provides all based classes for use ...
|
||||
//
|
||||
//
|
||||
// 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 "../Helpers/x-saherelm.xtm.helper.mq5"
|
||||
#include "../Classes/x-saherelm.xstrategy.class.mq5"
|
||||
|
||||
//
|
||||
string XEMRNGStartegyToken = "XEMRNG";
|
||||
|
||||
//
|
||||
class XSCXEMRNGStrategy : public XSCBaseStrategy
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Constructor(s) ...
|
||||
void XSCXEMRNGStrategy(
|
||||
//
|
||||
// Base ...
|
||||
string _symbol, // Trading Symbol
|
||||
ENUM_TIMEFRAMES _period, // Trading TimeFrame
|
||||
double _volume, // Voluem
|
||||
double _r2r, // Risk/Reward Ratio
|
||||
int _slippage, // Trader Slippage
|
||||
long _magicNumber, // Trader Magic Number
|
||||
bool _useTPSLAsPoint = false, // Converts TP and SL by Provided Points
|
||||
bool _forceMaxTPSLAsPoint = false, // Force Max TP and SL by Provided Points
|
||||
double _tpPoint = 0, // TP As Point
|
||||
double _slPoint = 0, // SL As Point
|
||||
bool _allowLong = true,
|
||||
bool _allowShort = true,
|
||||
int _maxAllowedLongs = 0,
|
||||
int _maxAllowedShorts = 0,
|
||||
ENUM_X_SIGNALLING_DIRECTION _signallingDirection = X_SIGNALLING_TREND_DIRECTION // Signalling in Which Direction
|
||||
) : XSCBaseStrategy(_symbol,
|
||||
_period,
|
||||
_volume,
|
||||
_r2r,
|
||||
_slippage,
|
||||
_magicNumber,
|
||||
_useTPSLAsPoint,
|
||||
_forceMaxTPSLAsPoint,
|
||||
_tpPoint,
|
||||
_slPoint,
|
||||
_allowLong,
|
||||
_allowShort,
|
||||
_maxAllowedLongs,
|
||||
_maxAllowedShorts //
|
||||
)
|
||||
{
|
||||
//
|
||||
mSignallingDirection = _signallingDirection;
|
||||
|
||||
//
|
||||
ConfigureTMInputs();
|
||||
|
||||
//
|
||||
SetAlertPrefix(GetTag());
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XSCXEMRNGStrategy()
|
||||
{
|
||||
delete mTMHelper;
|
||||
}
|
||||
|
||||
//
|
||||
// Getter / Setter (s) ...
|
||||
|
||||
//
|
||||
ENUM_X_SIGNALLING_DIRECTION SignallingDirection()
|
||||
{
|
||||
return mSignallingDirection;
|
||||
}
|
||||
|
||||
//
|
||||
void SignallingDirection(ENUM_X_SIGNALLING_DIRECTION value)
|
||||
{
|
||||
mSignallingDirection = value;
|
||||
}
|
||||
|
||||
//
|
||||
// Overrides ...
|
||||
|
||||
//
|
||||
// Customize Strategy Identifier ...
|
||||
string GetTag() override
|
||||
{
|
||||
return XEMRNGStartegyToken;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Conditions For Signal ...
|
||||
bool HasSignal(
|
||||
XSignal &signal //
|
||||
) override
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
ENUM_X_SIGNALLING_DIRECTION mSignallingDirection; // Signalling Direction
|
||||
|
||||
//
|
||||
XTMInputs mTMInputs; // Tren Magic Inputs ...
|
||||
XSCXTMHelper *mTMHelper; // Trend Magic Helper Class ...
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
|
||||
//
|
||||
// Set Default TM Inputs ...
|
||||
void ConfigureTMInputs()
|
||||
{
|
||||
//
|
||||
mTMInputs.maShift = 0;
|
||||
mTMInputs.maPeriod = 100;
|
||||
mTMInputs.maMethod = MODE_EMA;
|
||||
mTMInputs.maAppliedTo = PRICE_CLOSE;
|
||||
|
||||
//
|
||||
mTMInputs.showLine = true;
|
||||
|
||||
//
|
||||
mTMHelper = new XSCXTMHelper();
|
||||
|
||||
//
|
||||
mTMHelper.Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
mTMInputs //
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
@@ -80,6 +80,18 @@ public:
|
||||
//
|
||||
// Getter / Setter (s) ...
|
||||
|
||||
//
|
||||
ENUM_X_SIGNALLING_DIRECTION SignallingDirection()
|
||||
{
|
||||
return mSignallingDirection;
|
||||
}
|
||||
|
||||
//
|
||||
void SignallingDirection(ENUM_X_SIGNALLING_DIRECTION value)
|
||||
{
|
||||
mSignallingDirection = value;
|
||||
}
|
||||
|
||||
//
|
||||
// Overrides ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user