add conditions collector and also complete generate summary ...
need to test ...
This commit is contained in:
@@ -3418,7 +3418,7 @@ MqlDateTime GetBarTimeStruct(
|
||||
//
|
||||
template <typename T>
|
||||
bool IsSame(
|
||||
T &buffer[], // Search Buffer
|
||||
T &buffer[], // Search Buffer
|
||||
int count = 5 // Number of Searchs
|
||||
)
|
||||
{
|
||||
@@ -3428,28 +3428,33 @@ bool IsSame(
|
||||
//
|
||||
int bufferSize = ArraySize(buffer);
|
||||
result = bufferSize > 0;
|
||||
if (!result) {
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Count ...
|
||||
result = count < bufferSize;
|
||||
if (!result) {
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
T iTem = buffer[0];
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
if (iTem != buffer[i]) {
|
||||
if (iTem != buffer[i])
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
if (!result) {
|
||||
if (!result)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -3665,21 +3670,24 @@ bool IsDecreasing(
|
||||
//
|
||||
bool IsTrendingUp(
|
||||
const double &buffer1[], // First Buffer
|
||||
const double &buffer2[] // Seccend Buffer
|
||||
) {
|
||||
const double &buffer2[] // Seccend Buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
int buffer1Count = ArraySize(buffer1);
|
||||
int buffer2Count = ArraySize(buffer2);
|
||||
if (buffer1Count <= 0 || buffer2Count <= 0) {
|
||||
if (buffer1Count <= 0 || buffer2Count <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = MathMin(buffer1Count, buffer2Count);
|
||||
if (count <= 1) {
|
||||
if (count <= 1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3687,17 +3695,20 @@ bool IsTrendingUp(
|
||||
int upCounts = 0;
|
||||
int downCounts = 0;
|
||||
double value = MathAbs(buffer1[0] - buffer2[0]);
|
||||
for (int i = 1; i < count; i++) {
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
//
|
||||
double iValue = MathAbs(buffer1[i] - buffer2[i]);
|
||||
|
||||
//
|
||||
if (value > iValue) {
|
||||
if (value > iValue)
|
||||
{
|
||||
upCounts++;
|
||||
}
|
||||
|
||||
//
|
||||
if (value < iValue) {
|
||||
if (value < iValue)
|
||||
{
|
||||
downCounts++;
|
||||
}
|
||||
}
|
||||
@@ -3712,21 +3723,24 @@ bool IsTrendingUp(
|
||||
//
|
||||
bool IsTrendingDown(
|
||||
const double &buffer1[], // First Buffer
|
||||
const double &buffer2[] // Seccend Buffer
|
||||
) {
|
||||
const double &buffer2[] // Seccend Buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
int buffer1Count = ArraySize(buffer1);
|
||||
int buffer2Count = ArraySize(buffer2);
|
||||
if (buffer1Count <= 0 || buffer2Count <= 0) {
|
||||
if (buffer1Count <= 0 || buffer2Count <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = MathMin(buffer1Count, buffer2Count);
|
||||
if (count <= 1) {
|
||||
if (count <= 1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3734,17 +3748,20 @@ bool IsTrendingDown(
|
||||
int upCounts = 0;
|
||||
int downCounts = 0;
|
||||
double value = MathAbs(buffer1[0] - buffer2[0]);
|
||||
for (int i = 1; i < count; i++) {
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
//
|
||||
double iValue = MathAbs(buffer1[i] - buffer2[i]);
|
||||
|
||||
//
|
||||
if (value > iValue) {
|
||||
if (value > iValue)
|
||||
{
|
||||
upCounts++;
|
||||
}
|
||||
|
||||
//
|
||||
if (value < iValue) {
|
||||
if (value < iValue)
|
||||
{
|
||||
downCounts++;
|
||||
}
|
||||
}
|
||||
@@ -4822,6 +4839,31 @@ string ToString(T value)
|
||||
return (string)value;
|
||||
}
|
||||
|
||||
//
|
||||
// Used In Report or Summary Generators ...
|
||||
string ToString(
|
||||
string prefix, // Title
|
||||
bool value, // Value
|
||||
bool ignoreFalseConditions = true, // Ignore False Conditions
|
||||
string prefixSeparator = ":", // Title Separator
|
||||
string lineSeparator = "\n" // Line Separator
|
||||
)
|
||||
{
|
||||
//
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
result = (value || !ignoreFalseConditions)
|
||||
? prefix +
|
||||
prefixSeparator + " " +
|
||||
ToString(value) +
|
||||
lineSeparator
|
||||
: "";
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Converts a Buffer to String Representation ...
|
||||
template <typename T>
|
||||
|
||||
Reference in New Issue
Block a user