last works ...

This commit is contained in:
2024-05-22 13:15:20 +03:30
parent 23c989f083
commit 4a69e7edf8
17 changed files with 6815 additions and 78 deletions
+150 -35
View File
@@ -2,7 +2,7 @@
//
// SaherElm IT Center MQL5 Class Library
// ----------------------------------------------
// Name: XSCBaseX5Provider
// Name: XSCX5Provider
// Description: provides all Base Provider
// requirements For X5 ...
//
@@ -547,6 +547,7 @@ public:
bool isXCHMALCFastCrossedUnderSlow;
//
// Tools ...
//
// Conditions ...
@@ -1757,6 +1758,41 @@ public:
//
string result = NULL;
//
result = GenerateSummaryBody(
onlySummary,
multiplier,
separator,
ignoreFalseConditions
//
);
//
// Generating Full Result by Combining parts ...
result =
//
"[" + GetToken() + "]" + separator +
"-----------------------------" + separator +
result +
""
//
;
//
return result;
}
//
string GenerateSummaryBody(
const bool onlySummary = false, // Only Generate Conditions Summary
double multiplier = 1, // Score Multiplier
const string separator = "\n", // Separator
const bool ignoreFalseConditions = true // Ignore False Conditions
)
{
//
string result = NULL;
//
double bullScore = 0;
double bearScore = 0;
@@ -2007,8 +2043,6 @@ public:
// Generating Full Result by Combining parts ...
result =
//
"[" + GetToken() + "]" + separator +
"-----------------------------" + separator +
commonStr +
(onlySummary
? ""
@@ -2031,6 +2065,43 @@ public:
return result;
}
//
string GenerateSummary(
string provided, // Additional Info about Type, Provider and Symbol
const bool onlySummary = false, // Only Generate Conditions Summary
double multiplier = 1, // Score Multiplier
const string separator = "\n", // Separator
const bool ignoreFalseConditions = true // Ignore False Conditions
)
{
//
string result = NULL;
//
result = GenerateSummaryBody(
onlySummary,
multiplier,
separator,
ignoreFalseConditions
//
);
//
// Generating Full Result by Combining parts ...
result =
//
"[" + GetToken() + "]" + separator +
provided + separator +
"-----------------------------" + separator +
result +
""
//
;
//
return result;
}
//
// For Data Collector ...
string GetToken()
@@ -2109,11 +2180,33 @@ public:
// Properties Gettr(s) / Setter(s) ...
//
// Inheritance ...
// Overrides ...
//
// DeInit all Requirements ...
void DeInit() override
{
//
delete tsHelper;
delete fiHelper;
delete tdHelper;
delete lhHelper;
delete tmHelper;
delete ccHelper;
delete ctHelper;
delete obdHelper;
delete rsiHelper;
delete amaHelper;
delete chmaHelper;
delete chlhHelper;
}
//
// Functions ...
//
// Init all Requirements ...
virtual bool Init(X5ProviderInputs &inputs)
bool Init(X5ProviderInputs &inputs)
{
//
bool result = false;
@@ -2289,28 +2382,6 @@ public:
return result;
}
//
// DeInit all Requirements ...
virtual void DeInit()
{
//
delete tsHelper;
delete fiHelper;
delete tdHelper;
delete lhHelper;
delete tmHelper;
delete ccHelper;
delete ctHelper;
delete obdHelper;
delete rsiHelper;
delete amaHelper;
delete chmaHelper;
delete chlhHelper;
}
//
// Functions ...
//
// Set Default Position's Type ...
// Enable / Disable Long (Buy), Short (Sell) ...
@@ -2783,16 +2854,59 @@ public:
if (result)
{
//
mWaitsUntilNewBar = true;
// Here We Have to Prepare Signal ...
//
string mConditionsStr = mConditions.GenerateSummary(true);
// TODO: Make this Configurable ...
string symbol = GetSymbol();
ENUM_TIMEFRAMES period = GetPeriod();
double tpPoint = 30;
double volume = 0.01;
double tpPrice = PointToPrice(
tpPoint,
symbol //
);
ENUM_POSITION_TYPE type = hasLong
? POSITION_TYPE_BUY
: POSITION_TYPE_SELL;
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
double entry = GetEntry(
symbol,
type //
);
double tp = hasLong
? entry + tpPrice
: entry - tpPrice;
double sl = 0;
ENUM_X_SIGNAL_MANAGING_ACTIONS action = X_SIGNAL_USE_NOTHING;
//
string providerTypeStr = GetSymbol() + ", " + provider + "(" + (hasLong ? "Long" : "Short") + ")";
mConditionsStr = providerTypeStr + "\n" + mConditionsStr;
mConditionsCollector.Add(mConditionsStr);
Print(mConditionsStr);
result = mSignal.Prepare(
symbol,
provider,
period,
type,
mode,
entry,
volume,
action,
sl,
tp
//
);
//
if (result)
{
//
mWaitsUntilNewBar = true;
//
string providerTypeStr = GetSymbol() + ", " + provider + "(" + (hasLong ? "Long" : "Short") + ")";
string mConditionsStr = mConditions.GenerateSummary(providerTypeStr, true);
mConditionsCollector.Add(mConditionsStr);
Print(mConditionsStr);
}
}
//
@@ -95066,7 +95180,7 @@ struct X5ProviderDescriptor
//
ENUM_X5_SIGNAL_PROVIDERS tmp[];
Copy(
mSignallers,
mSignallers,
tmp //
);
Copy(
@@ -95171,7 +95285,8 @@ struct X5ProviderDescriptor
result = provider.HasSignal(
barIndex,
signal,
conditions);
conditions //
);
//
return result;