170 lines
4.0 KiB
Plaintext
170 lines
4.0 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// 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 //
|
|
);
|
|
}
|
|
};
|
|
|
|
// |