prepare signaller's class ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,97 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor ...
|
||||||
|
void ~X121Signaller() {}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Override(s) ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasLongConditions(
|
||||||
|
const X121MCycleConditions &conditions, // Market Conditions
|
||||||
|
double &sl, // Hold SL ...
|
||||||
|
double &tp // Hold TP ...
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasShortConditions(
|
||||||
|
const X121MCycleConditions &conditions, // Market Conditions
|
||||||
|
double &sl, // Hold SL ...
|
||||||
|
double &tp // Hold TP ...
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
void Default()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
enableLong = true;
|
||||||
|
enableShort = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
r2r = 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
staticVolumeLong = 0.01;
|
||||||
|
staticVolumeShort = 0.01;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 = enableLong;
|
||||||
|
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 = enableShort;
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
enableLong = true;
|
||||||
|
enableShort = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
r2r = 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
staticVolumeLong = 0.01;
|
||||||
|
staticVolumeShort = 0.01;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -208,7 +208,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
XGuard iGuards[];
|
XGuard iGuards[];
|
||||||
bool iHasGuard = iDescriptor.provider.HasGuard(iGuards);
|
bool iHasGuard = iDescriptor.HasGuard(iGuards);
|
||||||
if (iHasGuard)
|
if (iHasGuard)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "../Helpers/x-saherelm.xich.helper.mq5"
|
#include "../Helpers/x-saherelm.xich.helper.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
#include "../Libraries/x-saherelm.xtrade.lib.mq5"
|
||||||
#include "../Classes/x-saherelm.xalert.class.mq5"
|
#include "../Classes/x-saherelm.xalert.class.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2383,7 +2384,6 @@ public:
|
|||||||
// Constructor ...
|
// Constructor ...
|
||||||
void XSignallerDescriptor()
|
void XSignallerDescriptor()
|
||||||
{
|
{
|
||||||
Clean();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2607,6 +2607,10 @@ public:
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2726,62 +2730,6 @@ public:
|
|||||||
return Init(inputs);
|
return Init(inputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
bool AddSignaller(
|
|
||||||
XSignallerDescriptor &signaller //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Validate Signaller ...
|
|
||||||
result = signaller.IsValid();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
signaller,
|
|
||||||
mSignallers //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int AddSignallers(
|
|
||||||
XSignallerDescriptor &signallers[] //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = ArraySize(signallers);
|
|
||||||
if (!IsValidSize(count))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool isAdded = AddSignaller(signallers[i]);
|
|
||||||
if (isAdded)
|
|
||||||
{
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
@@ -4380,279 +4328,6 @@ public:
|
|||||||
conditions.isHCLLSwitchedToBeraish = isHCLLSwitchedToBeraish;
|
conditions.isHCLLSwitchedToBeraish = isHCLLSwitchedToBeraish;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Market Parse Conditions ...
|
|
||||||
bool HasConditions(
|
|
||||||
XSignal &signal, // If Any Signal provided, Filled here ...
|
|
||||||
bool &hasLong,
|
|
||||||
int &longPusher,
|
|
||||||
bool &hasShort,
|
|
||||||
int &shortPusher //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
longPusher = 0;
|
|
||||||
shortPusher = 0;
|
|
||||||
hasLong = false;
|
|
||||||
hasShort = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = CountSignallers();
|
|
||||||
if (!IsValidSize(count))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
X121MCycleConditions conditions;
|
|
||||||
GetMarketConditions(conditions);
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool iHasLong = false;
|
|
||||||
bool iHasShort = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
double iTP = 0;
|
|
||||||
double iTPProvided = 0;
|
|
||||||
double iSL = 0;
|
|
||||||
double iSLProvided = 0;
|
|
||||||
double iEntry = 0;
|
|
||||||
ENUM_POSITION_TYPE iType;
|
|
||||||
string iSymbol = GetSymbol();
|
|
||||||
double iR2R = mSignallers[i].r2r;
|
|
||||||
ENUM_TIMEFRAMES iPeriod = GetPeriod();
|
|
||||||
string iProvider = mSignallers[i].GetName();
|
|
||||||
|
|
||||||
//
|
|
||||||
bool iHasSignal = mSignallers[i].HasConditions(
|
|
||||||
conditions,
|
|
||||||
iHasLong,
|
|
||||||
iHasShort,
|
|
||||||
iTPProvided,
|
|
||||||
iSLProvided //
|
|
||||||
);
|
|
||||||
if (iHasSignal)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Filling Pusher(s) ...
|
|
||||||
if (iHasLong)
|
|
||||||
{
|
|
||||||
longPusher++;
|
|
||||||
}
|
|
||||||
else if (iHasShort)
|
|
||||||
{
|
|
||||||
shortPusher++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (iHasLong && !hasLong)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
hasLong = iHasLong;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Filling Signal ...
|
|
||||||
iType = POSITION_TYPE_BUY;
|
|
||||||
|
|
||||||
//
|
|
||||||
iEntry = GetEntry(
|
|
||||||
iSymbol,
|
|
||||||
iType //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CalculateTPSL(
|
|
||||||
iSL,
|
|
||||||
iTP,
|
|
||||||
iType,
|
|
||||||
iEntry,
|
|
||||||
iR2R,
|
|
||||||
iSLProvided,
|
|
||||||
iTPProvided //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill Signal Here ...
|
|
||||||
bool isSignalGenerated = mSignallers[i].GenerateMarketSignal(
|
|
||||||
signal,
|
|
||||||
iSymbol,
|
|
||||||
iPeriod,
|
|
||||||
iType,
|
|
||||||
iEntry,
|
|
||||||
iSL,
|
|
||||||
iTP //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (iHasShort && !hasShort)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
hasShort = iHasShort;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill Signal Here ...
|
|
||||||
iType = POSITION_TYPE_SELL;
|
|
||||||
|
|
||||||
//
|
|
||||||
iEntry = GetEntry(
|
|
||||||
iSymbol,
|
|
||||||
iType //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CalculateTPSL(
|
|
||||||
iSL,
|
|
||||||
iTP,
|
|
||||||
iType,
|
|
||||||
iEntry,
|
|
||||||
iR2R,
|
|
||||||
iSLProvided,
|
|
||||||
iTPProvided //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill Signal Here ...
|
|
||||||
bool isSignalGenerated = mSignallers[i].GenerateMarketSignal(
|
|
||||||
signal,
|
|
||||||
iSymbol,
|
|
||||||
iPeriod,
|
|
||||||
iType,
|
|
||||||
iEntry,
|
|
||||||
iSL,
|
|
||||||
iTP //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = hasLong || hasShort;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// X786 Long ...
|
|
||||||
bool HasX786LongConditions()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
X121MCycleConditions conditions;
|
|
||||||
GetMarketConditions(conditions);
|
|
||||||
|
|
||||||
//
|
|
||||||
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))
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// X786 Short ...
|
|
||||||
bool HasX786ShortConditions()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
X121MCycleConditions conditions;
|
|
||||||
GetMarketConditions(conditions);
|
|
||||||
|
|
||||||
//
|
|
||||||
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))
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// X121 Long ...
|
|
||||||
bool HasX121LongConditions()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// X121 Short ...
|
|
||||||
bool HasX121ShortConditions()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initial Market Cycle ...
|
// Initial Market Cycle ...
|
||||||
bool Init(
|
bool Init(
|
||||||
@@ -5193,76 +4868,6 @@ private:
|
|||||||
//
|
//
|
||||||
X121MCycleInputs mInputs;
|
X121MCycleInputs mInputs;
|
||||||
|
|
||||||
//
|
|
||||||
// Signallers ...
|
|
||||||
|
|
||||||
//
|
|
||||||
XSignallerDescriptor mSignallers[];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Count Signallers ...
|
|
||||||
int CountSignallers()
|
|
||||||
{
|
|
||||||
return ArraySize(mSignallers);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Find Signaller Index ...
|
|
||||||
int FindSignallerIndex(ENUM_XSIGNAL_PROVIDERS signaller)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = -1;
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = CountSignallers();
|
|
||||||
if (!IsValidSize(count))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XSignallerDescriptor iSignaller = mSignallers[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
if (iSignaller.name == signaller)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
int FindSignallerIndex(string signaller)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = -1;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!IsValid(signaller))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_XSIGNAL_PROVIDERS mSignaller = ToXSignalProvider(signaller);
|
|
||||||
if (mSignaller == PROVIDER_NONE)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = FindSignallerIndex(mSignaller);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
@@ -5519,9 +5124,6 @@ struct X121MarketCycleDescriptor
|
|||||||
//
|
//
|
||||||
XSCX121Market *market; // Market
|
XSCX121Market *market; // Market
|
||||||
|
|
||||||
//
|
|
||||||
X121MCycleConditions conditions; // Market Conditions
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ public:
|
|||||||
// Constructor ...
|
// Constructor ...
|
||||||
XSCBaseProvider(
|
XSCBaseProvider(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period // Trading Period
|
||||||
double staticVolume // Static Volume for Positions
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -57,9 +56,6 @@ public:
|
|||||||
"HOST Period"
|
"HOST Period"
|
||||||
//
|
//
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
mStaticVolume = staticVolume;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -91,12 +87,6 @@ public:
|
|||||||
return mCycle.hostPeriod;
|
return mCycle.hostPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
double GetStaticVolume()
|
|
||||||
{
|
|
||||||
return mStaticVolume;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Count Bars ...
|
// Count Bars ...
|
||||||
int CountBars()
|
int CountBars()
|
||||||
@@ -115,21 +105,6 @@ public:
|
|||||||
.IsNewBar();
|
.IsNewBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Protected ...
|
|
||||||
protected:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
double mStaticVolume; // Static Volume for Positions
|
|
||||||
|
|
||||||
//
|
|
||||||
XMarketCycle mCycle;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool mWaitsUntilNewBar;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Can Ignore Process ...
|
// Can Ignore Process ...
|
||||||
bool CanIgnoreProcess()
|
bool CanIgnoreProcess()
|
||||||
@@ -146,6 +121,12 @@ protected:
|
|||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
mWaitsUntilNewBar = false;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -157,6 +138,24 @@ protected:
|
|||||||
mWaitsUntilNewBar = !mWaitsUntilNewBar;
|
mWaitsUntilNewBar = !mWaitsUntilNewBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void SetWaitsUntilNewBar(bool value)
|
||||||
|
{
|
||||||
|
mWaitsUntilNewBar = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XMarketCycle mCycle;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mWaitsUntilNewBar;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
|
|||||||
+21
-17
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
#include "../Classes/x-saherelm.x121.xea.class.mq5"
|
#include "../Classes/x-saherelm.x121.xea.class.mq5"
|
||||||
|
#include "../Classes/x-saherelm.x121.x786.provider.class.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// "EURUSDb,USDCHFb,USDJPYb,XAUUSDb"
|
// "EURUSDb,USDCHFb,USDJPYb,XAUUSDb"
|
||||||
@@ -191,17 +192,6 @@ bool InitialEA()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Define Signallers ...
|
|
||||||
ENUM_XSIGNAL_PROVIDERS signallers[];
|
|
||||||
Add(X786, signallers);
|
|
||||||
// Add(X121, signallers);
|
|
||||||
// Add(X121, signallers);
|
|
||||||
// Add(X128, signallers);
|
|
||||||
// Add(X92, signallers);
|
|
||||||
// Add(XTEST, signallers);
|
|
||||||
// GetAllX121SignalProviders(signallers);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Instantiate X121EA Class ...
|
// Instantiate X121EA Class ...
|
||||||
mX121EA = new XSCX121EA(
|
mX121EA = new XSCX121EA(
|
||||||
@@ -237,12 +227,26 @@ bool InitialEA()
|
|||||||
//
|
//
|
||||||
iDescriptor.symbol = iSymbol;
|
iDescriptor.symbol = iSymbol;
|
||||||
iDescriptor.period = iPeriod;
|
iDescriptor.period = iPeriod;
|
||||||
iDescriptor.staticVolume = x121EAVolume;
|
|
||||||
iDescriptor.allowLong = x121EAAllowLong;
|
//
|
||||||
iDescriptor.allowShort = false; // x121EAAllowShort;
|
// Prepare Signallers ...
|
||||||
Copy(
|
Clean(iDescriptor.signallers);
|
||||||
signallers,
|
|
||||||
iDescriptor.signallers);
|
//
|
||||||
|
ArrayResize(iDescriptor.signallers, 1);
|
||||||
|
|
||||||
|
//
|
||||||
|
X786Signaller *x786Signaller = new X786Signaller();
|
||||||
|
x786Signaller.Default();
|
||||||
|
|
||||||
|
//
|
||||||
|
iDescriptor.signallers[0] = x786Signaller;
|
||||||
|
|
||||||
|
// int signallersCount = ArraySize(signallers);
|
||||||
|
// for (int j = 0; j < signallersCount; j++)
|
||||||
|
// {
|
||||||
|
// iDescriptor.signallers[j] = signallers[j];
|
||||||
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set Inputs to Default ...
|
// Set Inputs to Default ...
|
||||||
|
|||||||
@@ -3833,6 +3833,23 @@ bool IsValidSize(int size)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool IsValidSize(T &buffer[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
IsValidSize(ArraySize(buffer))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Normalize Index Based On Specified Buffer ...
|
// Normalize Index Based On Specified Buffer ...
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
Reference in New Issue
Block a user