188 lines
4.0 KiB
Plaintext
188 lines
4.0 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Class Library
|
|
// ----------------------------------------------
|
|
// Name: X121Signaller
|
|
// Description: Signalling using X121 rules ...
|
|
//
|
|
//
|
|
// 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 "../Libraries/x-saherelm.xtrade.lib.mq5"
|
|
#include "../Classes/x-saherelm.x121.xmcycle.class.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
// Class ...
|
|
class X121Signaller : public XSignallerDescriptor
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
void X121Signaller()
|
|
{
|
|
name = X121;
|
|
Default();
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
void ~X121Signaller() {}
|
|
|
|
//
|
|
// Override(s) ...
|
|
|
|
//
|
|
bool HasLongConditions(
|
|
const X121MCycleConditions &conditions, // Market Conditions
|
|
double &sl, // Hold SL ...
|
|
double &tp // Hold TP ...
|
|
) override
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
sl = 0;
|
|
tp = 0;
|
|
|
|
//
|
|
result = enableLong;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
(conditions.isMRBFastCrossedOverSlow &&
|
|
(conditions.isCHEBullish &&
|
|
conditions.isTrendBullish &&
|
|
conditions.isMCFastOverSlow))
|
|
//
|
|
||
|
|
//
|
|
(conditions.isMRBSlowCrossedtOverVerifier &&
|
|
(conditions.isCHEBullish &&
|
|
conditions.isTrendBullish &&
|
|
conditions.isMCFastOverSlow &&
|
|
conditions.isMRBFastOverSlow))
|
|
//
|
|
||
|
|
//
|
|
(conditions.isCHESwitchedToBullish &&
|
|
(conditions.isTrendBullish &&
|
|
conditions.isMCFastOverSlow &&
|
|
conditions.isMRBFastOverSlow))
|
|
//
|
|
;
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
sl = conditions.mrbSlows[1];
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool HasShortConditions(
|
|
const X121MCycleConditions &conditions, // Market Conditions
|
|
double &sl, // Hold SL ...
|
|
double &tp // Hold TP ...
|
|
) override
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
sl = 0;
|
|
tp = 0;
|
|
|
|
//
|
|
result = enableShort;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
(conditions.isSMHKSwitchedToBearish &&
|
|
(conditions.isTDBearish &&
|
|
conditions.isCHEBearish &&
|
|
conditions.isTrendBearish))
|
|
//
|
|
||
|
|
//
|
|
(conditions.isTDSwitchedToBearish &&
|
|
(conditions.isSMHKBearish &&
|
|
conditions.isCHEBearish &&
|
|
conditions.isTrendBearish))
|
|
//
|
|
||
|
|
//
|
|
(conditions.isCHESwitchedToBearish &&
|
|
(conditions.isTDBearish &&
|
|
conditions.isSMHKBearish &&
|
|
conditions.isTrendBearish))
|
|
//
|
|
||
|
|
//
|
|
(conditions.isTrendSwitchedToBearish &&
|
|
(conditions.isTDBearish &&
|
|
conditions.isCHEBearish &&
|
|
conditions.isSMHKBearish))
|
|
//
|
|
;
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
sl = conditions.mrbFasts[1];
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
void Default()
|
|
{
|
|
//
|
|
enableLong = true;
|
|
enableShort = true;
|
|
|
|
//
|
|
r2r = 1;
|
|
|
|
//
|
|
staticVolumeLong = 0.01;
|
|
staticVolumeShort = 0.01;
|
|
}
|
|
}; |