Files
MQL5Data/Signallers/x-saherelm.x786.signaller.class.mq5
T

213 lines
4.6 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class Library
// ----------------------------------------------
// Name: X786Signaller
// Description: Signalling using X786 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 X786Signaller : public XSignallerDescriptor
{
//
// Public ...
public:
//
// Props ...
//
// Constructor(s) ...
void X786Signaller()
{
//
name = X786;
Default();
}
//
// Deconstructor ...
void ~X786Signaller() {}
//
// Override(s) ...
//
virtual bool HasLongConditions(
const X121MCycleConditions &conditions, // Market Conditions
double &sl, // Hold SL ...
double &tp // Hold TP ...
)
{
//
bool result = false;
//
sl = 0;
tp = 0;
//
result = allowLong;
if (!result)
{
return result;
}
//
result =
//
(conditions.isSMHKSwitchedToBullish &&
(conditions.isTDBullish &&
conditions.isCHEBullish &&
conditions.isTrendBullish))
//
||
//
(conditions.isTDSwitchedToBullish &&
(conditions.isSMHKBullish &&
conditions.isCHEBullish &&
conditions.isTrendBullish))
//
||
//
(conditions.isCHESwitchedToBullish &&
(conditions.isTDBullish &&
conditions.isSMHKBullish &&
conditions.isTrendBullish))
//
||
//
(conditions.isTrendSwitchedToBullish &&
(conditions.isTDBullish &&
conditions.isCHEBullish &&
conditions.isSMHKBullish))
//
;
//
if (result)
{
sl = conditions.donLowerHs[1];
}
//
return result;
}
//
virtual bool HasShortConditions(
const X121MCycleConditions &conditions, // Market Conditions
double &sl, // Hold SL ...
double &tp // Hold TP ...
)
{
//
bool result = false;
//
result = allowShort;
if (!result)
{
return result;
}
//
tp = 0;
sl = 0;
//
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.donUpperLs[1];
}
//
return result;
}
//
// Tools ...
void Default()
{
//
allowLong = true;
allowShort = true;
//
r2r = 1;
//
maxAllowedLong = 3;
maxAllowedShort = 3;
//
staticVolumeLong = 0.01;
staticVolumeShort = 0.01;
//
maxAllowedOpenPositionAge = 576; // Two Days on 5 Min
delayBetweenTwoSameTypeSignals = 12; // 1 Hour on 5 Min
//
// Set 10 $ Per each Trade on 0.01 Volume
// is Enough for Hedging ...
minRequiredProfitPerTrade = 10;
minRequiredProfitPerTradeVolumeFactor = 0.01;
//
openNextPositionOnProfit = true;
ignoreProfitForOppositeSignals = true;
}
};