prepare x5121 ...

This commit is contained in:
2024-05-23 08:37:53 +03:30
parent 25b027d2aa
commit a34e2351da
6 changed files with 658 additions and 186 deletions
+29 -116
View File
@@ -46,8 +46,8 @@
enum ENUM_X121_SIGNAL_PROVIDERS enum ENUM_X121_SIGNAL_PROVIDERS
{ {
// //
NONE, X121NONE,
XSP, X121XSP,
XTEST, XTEST,
X786, X786,
X121, X121,
@@ -518,11 +518,6 @@ class X121MarketConditions : public XSCBaseProviderMarketConditions
// //
// Public ... // Public ...
public: public:
//
string symbol; // Symbol
ENUM_TIMEFRAMES period; // Period
datetime time; // Time
// //
// XZG ... // XZG ...
double zigzags[]; double zigzags[];
@@ -1430,7 +1425,7 @@ public:
) )
{ {
// //
if (provider == NONE) if (provider == X121NONE)
{ {
return; return;
} }
@@ -1439,8 +1434,8 @@ public:
switch (provider) switch (provider)
{ {
// //
case XSP: case X121XSP:
mIsXSPSignalProviderEnable = state; mIsX121XSPSignalProviderEnable = state;
break; break;
// //
@@ -1743,7 +1738,7 @@ private:
bool mIsShortEnable; bool mIsShortEnable;
// //
bool mIsXSPSignalProviderEnable; bool mIsX121XSPSignalProviderEnable;
bool mIsX92SignalProviderEnable; bool mIsX92SignalProviderEnable;
bool mIsX786SignalProviderEnable; bool mIsX786SignalProviderEnable;
bool mIsX121SignalProviderEnable; bool mIsX121SignalProviderEnable;
@@ -1789,7 +1784,7 @@ private:
signalPusher = 0; signalPusher = 0;
// //
bool hasXSPSignal = false; bool hasX121XSPSignal = false;
bool hasXTESTSignal = false; bool hasXTESTSignal = false;
bool hasX786Signal = false; bool hasX786Signal = false;
bool hasX121Signal = false; bool hasX121Signal = false;
@@ -1798,20 +1793,20 @@ private:
// //
// XPS ... // XPS ...
if (mIsXSPSignalProviderEnable) if (mIsX121XSPSignalProviderEnable)
{ {
// //
hasXSPSignal = XSPHasSpecifiedLongSignal( hasX121XSPSignal = X121XSPHasSpecifiedLongSignal(
mConditions // mConditions //
); );
// //
if (hasXSPSignal) if (hasX121XSPSignal)
{ {
// //
if (!IsValid(provider)) if (!IsValid(provider))
{ {
provider = ToString(XSP); provider = ToString(X121XSP);
} }
// //
@@ -1937,7 +1932,7 @@ private:
// //
result = result =
// //
hasXSPSignal hasX121XSPSignal
// //
|| ||
// //
@@ -1979,7 +1974,7 @@ private:
signalPusher = 0; signalPusher = 0;
// //
bool hasXSPSignal = false; bool hasX121XSPSignal = false;
bool hasXTESTSignal = false; bool hasXTESTSignal = false;
bool hasX786Signal = false; bool hasX786Signal = false;
bool hasX121Signal = false; bool hasX121Signal = false;
@@ -1987,21 +1982,21 @@ private:
bool hasX92Signal = false; bool hasX92Signal = false;
// //
// XSP ... // X121XSP ...
if (mIsXSPSignalProviderEnable) if (mIsX121XSPSignalProviderEnable)
{ {
// //
hasXSPSignal = XSPHasSpecifiedShortSignal( hasX121XSPSignal = X121XSPHasSpecifiedShortSignal(
mConditions // mConditions //
); );
// //
if (hasXSPSignal) if (hasX121XSPSignal)
{ {
// //
if (!IsValid(provider)) if (!IsValid(provider))
{ {
provider = ToString(XSP); provider = ToString(X121XSP);
} }
// //
@@ -2127,7 +2122,7 @@ private:
// //
result = result =
// //
hasXSPSignal hasX121XSPSignal
// //
|| ||
// //
@@ -2896,10 +2891,10 @@ private:
// Signalling based On Signallers ... // Signalling based On Signallers ...
// //
// XSP ... // X121XSP ...
// //
bool XSPHasSpecifiedLongSignal( bool X121XSPHasSpecifiedLongSignal(
X121MarketConditions &mConditions // X121MarketConditions &mConditions //
) )
{ {
@@ -2930,38 +2925,6 @@ private:
// //
bool result = false; bool result = false;
//
double bullishScore = 0;
double bearishScore = 0;
//
mConditions.GenerateScore(
bullishScore,
bearishScore //
);
//
result =
//
mConditions.bars[1].low == mConditions.bars[2].low &&
mConditions.bars[1].low == mConditions.pvVales[1] &&
mConditions.bars[2].low == mConditions.pvVales[2]
//
;
if (result)
{
//
Print("bullishScore: " + ToString(bullishScore));
Print("bearishScore: " + ToString(bearishScore));
//
Print(mConditions.GenerateSummary());
//
Print(mConditions.pvVales[0]);
ArrayPrint(mConditions.pvVales);
}
// //
return result; return result;
} }
@@ -3003,7 +2966,7 @@ private:
} }
// //
bool XSPHasSpecifiedShortSignal( bool X121XSPHasSpecifiedShortSignal(
X121MarketConditions &mConditions // X121MarketConditions &mConditions //
) )
{ {
@@ -3034,56 +2997,6 @@ private:
// //
bool result = false; bool result = false;
// //
// double bullishScore = 0;
// double bearishScore = 0;
// //
// mConditions.GenerateScore(
// bullishScore,
// bearishScore //
// );
//
// result =
// //
// bullishScore < bearishScore &&
// mConditions.zigzags[prev] == mConditions.pvPeaks[prev]
// //
// ;
// //
// for (int i = 1; i < 6; i++)
// {
// //
// X121MarketConditions iConditions;
// GetMarketConditions(iConditions, i);
// //
// double iBullishScore = 0;
// double iBearishScore = 0;
// //
// iConditions.GenerateScore(
// iBullishScore,
// iBearishScore,
// 1);
// //
// bullishScore += iBullishScore;
// bearishScore += iBearishScore;
// }
// //
// result =
// //
// bearishScore > bullishScore &&
// (bullishScore < 0
// ? bearishScore > MathAbs(bullishScore)
// : bearishScore > bullishScore * 2)
// //
// ;
// //
return result; return result;
} }
@@ -3350,8 +3263,8 @@ void GetAllX121SignalProviders(ENUM_X121_SIGNAL_PROVIDERS &result[])
Clean(result); Clean(result);
// //
Add(NONE, result); Add(X121NONE, result);
Add(XSP, result); Add(X121XSP, result);
Add(XTEST, result); Add(XTEST, result);
Add(X786, result); Add(X786, result);
Add(X121, result); Add(X121, result);
@@ -3369,7 +3282,7 @@ string ToString(ENUM_X121_SIGNAL_PROVIDERS value)
ENUM_X121_SIGNAL_PROVIDERS ToX121SignalProvider(string content) ENUM_X121_SIGNAL_PROVIDERS ToX121SignalProvider(string content)
{ {
// //
ENUM_X121_SIGNAL_PROVIDERS result = NONE; ENUM_X121_SIGNAL_PROVIDERS result = X121NONE;
// //
if (!IsValid(content)) if (!IsValid(content))
@@ -3378,13 +3291,13 @@ ENUM_X121_SIGNAL_PROVIDERS ToX121SignalProvider(string content)
} }
// //
if (content == ToString(NONE)) if (content == ToString(X121NONE))
{ {
result = NONE; result = X121NONE;
} }
else if (content == ToString(XSP)) else if (content == ToString(X121XSP))
{ {
result = XSP; result = X121XSP;
} }
else if (content == ToString(XTEST)) else if (content == ToString(XTEST))
{ {
+2 -7
View File
@@ -319,14 +319,9 @@ public:
// //
// Common ... // Common ...
string prefix; // Cycle Prefix ... string prefix; // Cycle Prefix ...
string symbol; // Analysing Symbol ...
ENUM_TIMEFRAMES period; // Analysing Time Frame ...
ENUM_TIMEFRAMES hostPeriod; // Hosting Time Frame ... ENUM_TIMEFRAMES hostPeriod; // Hosting Time Frame ...
ENUM_X_MARKET_CYCLES cycle; // Init Cycle ... ENUM_X_MARKET_CYCLES cycle; // Init Cycle ...
//
datetime time; // Extracting Time ...
// //
// Candlestic Conditions ... // Candlestic Conditions ...
bool isLastBullish; bool isLastBullish;
@@ -1088,13 +1083,13 @@ public:
{ {
// //
bullScore++; bullScore++;
bearScore--: bearScore--;
} }
if (isTrendSwitchedToBearish) if (isTrendSwitchedToBearish)
{ {
// //
bullScore--; bullScore--;
bearScore++: bearScore++;
} }
// //
+43 -34
View File
@@ -48,10 +48,10 @@
enum ENUM_X5_SIGNAL_PROVIDERS enum ENUM_X5_SIGNAL_PROVIDERS
{ {
// //
NONE, X5NONE,
// //
// XSP Expert Support Mechanism ... // X5XSP Expert Support Mechanism ...
XSP, X5XSP,
// //
// XTD ... // XTD ...
XTD, XTD,
@@ -2411,7 +2411,7 @@ public:
) )
{ {
// //
if (provider == NONE) if (provider == X5NONE)
{ {
return; return;
} }
@@ -2420,8 +2420,8 @@ public:
switch (provider) switch (provider)
{ {
// //
case XSP: case X5XSP:
mIsXSPSignalProviderEnable = state; mIsX5XSPSignalProviderEnable = state;
break; break;
// //
@@ -2533,6 +2533,15 @@ public:
int curr = barIndex + 1; int curr = barIndex + 1;
int prev = curr + 1; int prev = curr + 1;
//
mConditions.symbol = GetSymbol();
mConditions.period = GetPeriod();
mConditions.time = iTime(
mConditions.symbol,
mConditions.period,
barIndex
);
// //
GetBars( GetBars(
mConditions.bars, mConditions.bars,
@@ -3880,7 +3889,7 @@ private:
bool mIsShortEnable; bool mIsShortEnable;
// //
bool mIsXSPSignalProviderEnable; bool mIsX5XSPSignalProviderEnable;
bool mIsXTDSignalProviderEnable; bool mIsXTDSignalProviderEnable;
bool mIsXTAMSignalProviderEnable; bool mIsXTAMSignalProviderEnable;
bool mIsXSISignalProviderEnable; bool mIsXSISignalProviderEnable;
@@ -4478,11 +4487,11 @@ private:
} }
// //
// XSP ... // X5XSP ...
// //
// Common Conditions ... // Common Conditions ...
bool XSPHasLongSignal( bool X5XSPHasLongSignal(
X5MarketConditions &mConditions // X5MarketConditions &mConditions //
) )
{ {
@@ -4495,7 +4504,7 @@ private:
// //
// Symbol and Type Specific Conditions ... // Symbol and Type Specific Conditions ...
bool XSPHasSpecifiedLongSignal( bool X5XSPHasSpecifiedLongSignal(
X5MarketConditions &mConditions // X5MarketConditions &mConditions //
) )
{ {
@@ -4504,7 +4513,7 @@ private:
// //
// Check Common Signal Conditions ... // Check Common Signal Conditions ...
result = XSPHasLongSignal(mConditions); result = X5XSPHasLongSignal(mConditions);
if (!result) if (!result)
{ {
return result; return result;
@@ -4577,11 +4586,11 @@ private:
} }
// //
// XSP ... // X5XSP ...
// //
// Common Conditions ... // Common Conditions ...
bool XSPHasShortSignal( bool X5XSPHasShortSignal(
X5MarketConditions &mConditions // X5MarketConditions &mConditions //
) )
{ {
@@ -4594,7 +4603,7 @@ private:
// //
// Symbol and Type Specific Conditions ... // Symbol and Type Specific Conditions ...
bool XSPHasSpecifiedShortSignal( bool X5XSPHasSpecifiedShortSignal(
X5MarketConditions &mConditions // X5MarketConditions &mConditions //
) )
{ {
@@ -4603,7 +4612,7 @@ private:
// //
// Check Common Signal Conditions ... // Check Common Signal Conditions ...
result = XSPHasShortSignal(mConditions); result = X5XSPHasShortSignal(mConditions);
if (!result) if (!result)
{ {
return result; return result;
@@ -94562,7 +94571,7 @@ private:
signalPusher = 0; signalPusher = 0;
// //
bool hasXSPSignal = false; bool hasX5XSPSignal = false;
bool hasXTDSignal = false; bool hasXTDSignal = false;
bool hasXTAMSignal = false; bool hasXTAMSignal = false;
bool hasXSISignal = false; bool hasXSISignal = false;
@@ -94574,20 +94583,20 @@ private:
// //
// XPS ... // XPS ...
if (mIsXSPSignalProviderEnable) if (mIsX5XSPSignalProviderEnable)
{ {
// //
hasXSPSignal = XSPHasSpecifiedLongSignal( hasX5XSPSignal = X5XSPHasSpecifiedLongSignal(
mConditions // mConditions //
); );
// //
if (hasXSPSignal) if (hasX5XSPSignal)
{ {
// //
if (!IsValid(provider)) if (!IsValid(provider))
{ {
provider = ToString(XSP); provider = ToString(X5XSP);
} }
// //
@@ -94782,7 +94791,7 @@ private:
// //
result = result =
// //
hasXSPSignal hasX5XSPSignal
// //
|| ||
// //
@@ -94836,7 +94845,7 @@ private:
signalPusher = 0; signalPusher = 0;
// //
bool hasXSPSignal = false; bool hasX5XSPSignal = false;
bool hasXTDSignal = false; bool hasXTDSignal = false;
bool hasXTAMSignal = false; bool hasXTAMSignal = false;
bool hasXSISignal = false; bool hasXSISignal = false;
@@ -94848,20 +94857,20 @@ private:
// //
// XPS ... // XPS ...
if (mIsXSPSignalProviderEnable) if (mIsX5XSPSignalProviderEnable)
{ {
// //
hasXSPSignal = XSPHasSpecifiedShortSignal( hasX5XSPSignal = X5XSPHasSpecifiedShortSignal(
mConditions // mConditions //
); );
// //
if (hasXSPSignal) if (hasX5XSPSignal)
{ {
// //
if (!IsValid(provider)) if (!IsValid(provider))
{ {
provider = ToString(XSP); provider = ToString(X5XSP);
} }
// //
@@ -95056,7 +95065,7 @@ private:
// //
result = result =
// //
hasXSPSignal hasX5XSPSignal
// //
|| ||
// //
@@ -95327,8 +95336,8 @@ void GetAllX5SignalProviders(ENUM_X5_SIGNAL_PROVIDERS &result[])
Clean(result); Clean(result);
// //
Add(NONE, result); Add(X5NONE, result);
Add(XSP, result); Add(X5XSP, result);
Add(XTD, result); Add(XTD, result);
Add(XTAM, result); Add(XTAM, result);
Add(XSI, result); Add(XSI, result);
@@ -95349,7 +95358,7 @@ string ToString(ENUM_X5_SIGNAL_PROVIDERS value)
ENUM_X5_SIGNAL_PROVIDERS ToX5SignalProvider(string content) ENUM_X5_SIGNAL_PROVIDERS ToX5SignalProvider(string content)
{ {
// //
ENUM_X5_SIGNAL_PROVIDERS result = NONE; ENUM_X5_SIGNAL_PROVIDERS result = X5NONE;
// //
if (!IsValid(content)) if (!IsValid(content))
@@ -95358,13 +95367,13 @@ ENUM_X5_SIGNAL_PROVIDERS ToX5SignalProvider(string content)
} }
// //
if (content == ToString(NONE)) if (content == ToString(X5NONE))
{ {
result = NONE; result = X5NONE;
} }
else if (content == ToString(XSP)) else if (content == ToString(X5XSP))
{ {
result = XSP; result = X5XSP;
} }
else if (content == ToString(XTD)) else if (content == ToString(XTD))
{ {
+5
View File
@@ -61,6 +61,11 @@ class XSCBaseProviderMarketConditions : public XSCBase
public: public:
// //
// Props ... // Props ...
string symbol; // Symbol
ENUM_TIMEFRAMES period; // Period
datetime time; // Time
//
XOHCL bars[]; // Number of Bars ... XOHCL bars[]; // Number of Bars ...
// //
@@ -284,3 +284,97 @@
// isPVMCSwitchedToBullish // isPVMCSwitchedToBullish
// isPVLCSwitchedToBullish // isPVLCSwitchedToBullish
// isPVHCSwitchedToBullish // isPVHCSwitchedToBullish
// //
// double bullishScore = 0;
// double bearishScore = 0;
// //
// mConditions.GenerateScore(
// bullishScore,
// bearishScore //
// );
//
// result =
// //
// bullishScore < bearishScore &&
// mConditions.zigzags[prev] == mConditions.pvPeaks[prev]
// //
// ;
// //
// for (int i = 1; i < 6; i++)
// {
// //
// X121MarketConditions iConditions;
// GetMarketConditions(iConditions, i);
// //
// double iBullishScore = 0;
// double iBearishScore = 0;
// //
// iConditions.GenerateScore(
// iBullishScore,
// iBearishScore,
// 1);
// //
// bullishScore += iBullishScore;
// bearishScore += iBearishScore;
// }
// //
// result =
// //
// bearishScore > bullishScore &&
// (bullishScore < 0
// ? bearishScore > MathAbs(bullishScore)
// : bearishScore > bullishScore * 2)
// //
// ;
//
double bullishScore = 0;
double bearishScore = 0;
//
mConditions.GenerateScore(
bullishScore,
bearishScore //
);
//
result =
//
mConditions.bars[1].low == mConditions.bars[2].low &&
mConditions.bars[1].low == mConditions.pvVales[1] &&
mConditions.bars[2].low == mConditions.pvVales[2]
//
;
if (result)
{
//
Print("bullishScore: " + ToString(bullishScore));
Print("bearishScore: " + ToString(bearishScore));
//
Print(mConditions.GenerateSummary());
//
Print(mConditions.pvVales[0]);
ArrayPrint(mConditions.pvVales);
}
+485 -29
View File
@@ -23,16 +23,288 @@
#define ShortName "X5121EA" #define ShortName "X5121EA"
// //
#include "../Classes/x-saherelm.x5.xea.class.mq5" #include "../Classes/x-saherelm.x5.provider.class.mq5"
#include "../Classes/x-saherelm.x121.provider.class.mq5"
//
// a Provider Descriptor which holds
// X5 and X121 Provider at the Same time ...
struct X5121ProviderDescriptor
{
//
string symbol; // Trading Symbol
ENUM_TIMEFRAMES period; // Trading Timeframe
bool allowLong; // Allow Long Signals
bool allowShort; // Allow Short Signals
ENUM_X5_SIGNAL_PROVIDERS signallers[]; // Allowed Signal Providers
//
X5ProviderInputs x5Inputs;
XSCX5Provider *x5Provider;
//
X121ProviderInputs x121Inputs;
XSCX121Provider *x121Provider;
//
XSignal signal;
X5MarketConditions x5Conditions;
X121MarketConditions x121Conditions;
//
// Tools ...
//
// Initial Provider ...
//
bool Init()
{
//
bool result = false;
//
result = this.Init(
this.symbol,
this.period,
this.signallers,
this.allowLong,
this.allowShort //
);
//
return result;
}
//
bool Init(
ENUM_X5_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers
bool mAllowLong = true, // Allow Long Signals
bool mAllowShort = true // Allow Short Signals
)
{
//
bool result = false;
//
result = this.Init(
this.symbol,
this.period,
mSignallers,
mAllowLong,
mAllowShort //
);
//
return result;
}
//
bool Init(
string mSymbol, // Trading Symbol
ENUM_TIMEFRAMES mPeriod, // Trading Timeframe
ENUM_X5_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers
bool mAllowLong = true, // Allow Long Signals
bool mAllowShort = true // Allow Short Signals
)
{
//
bool result = false;
//
result =
//
x5Inputs.IsValid() &&
IsValid(mSymbol) &&
IsValid(mPeriod) &&
(allowLong || allowShort) &&
ArraySize(mSignallers) > 0
//
;
if (!result)
{
return result;
}
//
this.symbol = mSymbol;
this.period = mPeriod;
this.allowLong = mAllowLong;
this.allowShort = mAllowShort;
//
ENUM_X5_SIGNAL_PROVIDERS tmp[];
Copy(
mSignallers,
tmp //
);
Copy(
tmp,
this.signallers //
);
//
// Instantiate Provider ...
x5Provider = new XSCX5Provider(
this.symbol,
this.period //
);
//
// Instantiate Provider ...
x121Provider = new XSCX121Provider(
this.symbol,
this.period //
);
//
// Set Long/Short State ...
//
x5Provider
.SetSignalTypeState(
POSITION_TYPE_BUY,
this.allowLong //
);
//
x5Provider
.SetSignalTypeState(
POSITION_TYPE_SELL,
this.allowShort //
);
//
x121Provider
.SetSignalTypeState(
POSITION_TYPE_BUY,
this.allowLong //
);
//
x121Provider
.SetSignalTypeState(
POSITION_TYPE_SELL,
this.allowShort //
);
//
// Enable Required Signallers ...
x5Provider
.SetSignalProviderStates(
this.signallers,
true //
);
//
// Now Must to Initialize Provider ...
result = x5Provider.Init(
this.x5Inputs //
);
if (result)
{
return result;
}
//
result = x121Provider.Init(
this.x121Inputs //
);
//
return result;
}
//
// Cleanup ...
void Clean()
{
//
signal.Clean();
x5Conditions.Clear();
x121Conditions.Clear();
}
//
// Validate ...
bool IsValid(bool validateInputs = true)
{
//
bool result = false;
//
result =
//
IsValid(symbol) &&
IsValid(period) &&
(validateInputs
? x5Inputs.IsValid() && x121Inputs.IsValid()
: true) &&
(allowLong || allowShort) &&
ArraySize(signallers) > 0
//
;
//
return result;
}
//
// Check Signal ...
bool HasSignal(int barIndex = 0)
{
//
bool result = false;
//
result = x5Inputs.IsValid();
if (!result)
{
return result;
}
//
result = x121Inputs.IsValid();
if (!result)
{
return result;
}
//
// Clear Signal and Conditions ...
Clean();
//
result = x5Provider
.HasSignal(
barIndex,
signal,
x5Conditions //
);
//
if (result)
{
//
x121Provider
.GetMarketConditions(
x121Conditions,
barIndex //
);
}
//
return result;
}
};
// //
// "EURUSDb,USDCHFb,USDJPYb,XAUUSDb" // "EURUSDb,USDCHFb,USDJPYb,XAUUSDb"
// //
// Inputs ... // Inputs ...
long x5EAMagicNumber = 78692110; // Magic Number long x5EAMagicNumber = 78692110; // Magic Number
int x5EASlippage = 10; // Slippgae int x5EASlippage = 10; // Slippgae
string x5EASymbols = "EURUSDb,USDCHFb,USDJPYb,XAUUSDb"; // Symbols string x5EASymbols = "EURUSDb"; // Symbols
// //
bool x5EAAllowLong = true; // Allow Long Trades bool x5EAAllowLong = true; // Allow Long Trades
bool x5EAAllowShort = true; // Allow Short Trades bool x5EAAllowShort = true; // Allow Short Trades
@@ -54,8 +326,8 @@ ENUM_TIMEFRAMES x5EAPeriod;
MqlTick x5EATick; MqlTick x5EATick;
// //
// X5121EA ... // Providers ...
XSCX5121EA *mX5121EA; X5121ProviderDescriptor x5121EAProviders[];
// //
// Event Handlers ... // Event Handlers ...
@@ -85,7 +357,7 @@ int OnInit()
// //
// Initial EA ... // Initial EA ...
if (!InitialX5EA()) if (!InitialEA())
{ {
return INIT_PARAMETERS_INCORRECT; return INIT_PARAMETERS_INCORRECT;
} }
@@ -130,7 +402,7 @@ void OnTick()
} }
// //
mX5121EA.OnTick(); // mX5121EA.OnTick();
} }
// //
@@ -157,7 +429,7 @@ bool X5121EAValidateInputs()
// //
// Initialize Specific Providers ... // Initialize Specific Providers ...
bool InitialX5EA() bool InitialEA()
{ {
// //
bool result = false; bool result = false;
@@ -193,19 +465,7 @@ bool InitialX5EA()
GetAllX5SignalProviders(signallers); GetAllX5SignalProviders(signallers);
// //
// Instantiate X5121EA Class ... Clean(x5121EAProviders);
mX5121EA = new XSCX5121EA(
x5EASlippage, // Slippgae
x5EAMagicNumber, // Magic Number
x5EAManageInterval, // Manager Check Intervals Seconds
x5EAMaxAllowedSpread, // Max Allowed Spred for Opening Trades
x5EAMaxAllowedPositions, // Max Allowed Positions
x5EAMaxAllowedDrawdownFactor, // Max Allowed Drawdown Factor
x5EAAllowLong, // Allow Long Trades
x5EAAllowShort, // Allow Short Trades
x5EAMinProfitPerTrade, // Min Profit Per Trade based On Volume Factor (Hedge)
x5EAMinProfitPerVolumeFactor // Min Volume Factor for Calculating Profit (Hedge)
);
// //
// Prepare Providers and Add them into mX5121EA class ... // Prepare Providers and Add them into mX5121EA class ...
@@ -213,7 +473,7 @@ bool InitialX5EA()
{ {
// //
// Define Structure ... // Define Structure ...
X5ProviderDescriptor iDescriptor; X5121ProviderDescriptor iDescriptor;
// //
iDescriptor.symbol = symbols[i]; iDescriptor.symbol = symbols[i];
@@ -226,24 +486,220 @@ bool InitialX5EA()
// //
// Set Inputs to Default ... // Set Inputs to Default ...
iDescriptor.inputs.Default(); iDescriptor.x5Inputs.Default();
iDescriptor.x121Inputs.Default();
//
// X121 Inputs ...
//
// Prepare Input Requirements ...
//
// XMC ...
iDescriptor.x121Inputs.mcInputs.showFastMa = false;
iDescriptor.x121Inputs.mcInputs.showSlowMa = false;
iDescriptor.x121Inputs.mcInputs.showVerifierMa = false;
//
// XICH ...
iDescriptor.x121Inputs.ichInputs.showKumo = false;
iDescriptor.x121Inputs.ichInputs.showKijunSen = false;
iDescriptor.x121Inputs.ichInputs.showTenkanSen = false;
iDescriptor.x121Inputs.ichInputs.showChikouSpan = false;
iDescriptor.x121Inputs.ichInputs.showSenkouSpanA = false;
iDescriptor.x121Inputs.ichInputs.showSenkouSpanB = false;
iDescriptor.x121Inputs.ichInputs.showKijunSenPlus = false;
iDescriptor.x121Inputs.ichInputs.showKijunSenNegative = false;
//
// XSTR ...
iDescriptor.x121Inputs.cheInputs.showLongExit1Line = false;
iDescriptor.x121Inputs.cheInputs.showShortExit1Line = false;
iDescriptor.x121Inputs.cheInputs.showLongExit2Line = false;
iDescriptor.x121Inputs.cheInputs.showShortExit2Line = false;
//
// XPV ...
iDescriptor.x121Inputs.pvInputs.showPeaksAndVales = true;
iDescriptor.x121Inputs.pvInputs.showLevels = false;
iDescriptor.x121Inputs.pvInputs.showConsolidations = false;
iDescriptor.x121Inputs.pvInputs.showFibo1Levels = false;
iDescriptor.x121Inputs.pvInputs.showFibo2Levels = false;
iDescriptor.x121Inputs.pvInputs.showFibo3Levels = true;
iDescriptor.x121Inputs.pvInputs.showFibo4Levels = false;
iDescriptor.x121Inputs.pvInputs.showFibo5Levels = false;
//
// XZG ...
iDescriptor.x121Inputs.zgInputs.showZigZag = false;
iDescriptor.x121Inputs.zgInputs.showPeaksAndVales = false;
//
// XDON ...
iDescriptor.x121Inputs.donInputs.showOpen = true;
iDescriptor.x121Inputs.donInputs.showHigh = true;
iDescriptor.x121Inputs.donInputs.showClose = true;
iDescriptor.x121Inputs.donInputs.showLow = true;
//
// XSTR ...
iDescriptor.x121Inputs.strInputs.showTrends = true;
iDescriptor.x121Inputs.strInputs.fillTrends = false;
//
iDescriptor.x121Inputs.symbol = iDescriptor.symbol;
iDescriptor.x121Inputs.period = iDescriptor.period;
//
// Short MArket ...
iDescriptor.x121Inputs.sMarketPeriod = NULL;
iDescriptor.x121Inputs.sMarketMethod = X_PERIOD_AUTO;
//
// Medium Market ...
iDescriptor.x121Inputs.mMarketPeriod = NULL;
iDescriptor.x121Inputs.mMarketMethod = X_PERIOD_AUTO;
//
// Long Market ...
iDescriptor.x121Inputs.lMarketPeriod = NULL;
iDescriptor.x121Inputs.lMarketMethod = X_PERIOD_AUTO;
//
int fontSize = 12;
double fontAngel = 90;
string fontName = "Arial";
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER;
//
// Hind Market ...
iDescriptor.x121Inputs.hMarketPeriod = NULL;
iDescriptor.x121Inputs.hMarketMethod = X_PERIOD_AUTO;
iDescriptor.x121Inputs.hMarketInputs.drawLabels = false;
iDescriptor.x121Inputs.hMarketInputs.drawCBar = true;
iDescriptor.x121Inputs.hMarketInputs.drawPBar = true;
iDescriptor.x121Inputs.hMarketInputs.drawCBarMid = true;
iDescriptor.x121Inputs.hMarketInputs.drawPBarMid = true;
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.Default();
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.Default();
//
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.openStyle.Label(
"C Hind Open",
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.openStyle.clr,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.highStyle.Label(
"C Hind High",
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.highStyle.clr,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.closeStyle.Label(
"C Hind Close",
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.closeStyle.clr,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.lowStyle.Label(
"C Hind Low",
iDescriptor.x121Inputs.hMarketInputs.cBarDrawSpecs.lowStyle.clr,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
//
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.openStyle.Label(
"P Hind Open",
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.openStyle.clr,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.highStyle.Label(
"P Hind High",
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.highStyle.clr,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.closeStyle.Label(
"P Hind Close",
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.closeStyle.clr,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.lowStyle.Label(
"P Hind Low",
iDescriptor.x121Inputs.hMarketInputs.pBarDrawSpecs.lowStyle.clr,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
iDescriptor.x121Inputs.hMarketInputs.cBarMidDrawSpecs.clr = clrYellow;
iDescriptor.x121Inputs.hMarketInputs.cBarMidDrawSpecs.Label(
"C Hind Mid",
clrYellow,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
iDescriptor.x121Inputs.hMarketInputs.pBarMidDrawSpecs.clr = clrYellow;
iDescriptor.x121Inputs.hMarketInputs.pBarMidDrawSpecs.Label(
"P Hind Mid",
clrYellow,
fontName,
fontSize,
fontAnchor,
fontAngel //
);
// //
// Validate Inputs ... // Validate Inputs ...
bool isInputsValid = iDescriptor.inputs.IsValid(); bool isX5InputsValid = iDescriptor.x5Inputs.IsValid();
if (!isInputsValid) if (!isX5InputsValid)
{ {
continue; continue;
} }
// //
result = mX5121EA.AddProvider(iDescriptor); // Initialize ...
if (!result)
//
bool isDescriptorInitialized = iDescriptor.Init();
if (!isDescriptorInitialized)
{ {
break; continue;
} }
//
AddRef(
iDescriptor,
x5121EAProviders //
);
//
} }
//
result = ArraySize(x5121EAProviders) == symbolsCount;
// //
return result; return result;
} }