complete some sort of new indicators helpers classes ...

This commit is contained in:
2024-05-18 16:55:28 +03:30
parent fb4445c1d7
commit e69dc85eea
11 changed files with 4874 additions and 187 deletions
+148
View File
@@ -353,6 +353,86 @@ struct XOHCL
return result;
}
//
bool Init(
string mSymbol = NULL, // Trading Symbol
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Period
double mOpen = 0, // Open
double mHigh = 0, // High
double mClose = 0, // Close
double mLow = 0, // Low
int barIndex = 0 // Bar Index
)
{
//
mSymbol = NormalizeSymbol(mSymbol);
mPeriod = NormalizePeriod(mPeriod);
//
symbol = mSymbol;
period = mPeriod;
//
time = iTime(
mSymbol,
mPeriod,
barIndex
//
);
//
open = mOpen;
high = mHigh;
close = mClose;
low = mLow;
//
return IsValid();
}
//
bool Init(
string mSymbol = NULL, // Trading Symbol
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Period
double mOpen = 0, // Open
double mHigh = 0, // High
double mClose = 0, // Close
double mLow = 0, // Low
datetime mTime = NULL // Bar Time
)
{
//
mSymbol = NormalizeSymbol(mSymbol);
mPeriod = NormalizePeriod(mPeriod);
//
symbol = mSymbol;
period = mPeriod;
//
int barIndex = iBarShift(
symbol,
period,
mTime);
//
time = iTime(
mSymbol,
mPeriod,
barIndex
//
);
//
open = mOpen;
high = mHigh;
close = mClose;
low = mLow;
//
return IsValid();
}
//
// Tools ...
@@ -3593,6 +3673,74 @@ int Copy(
return result;
}
//
// Copy Items from a Buffer ...
template <typename T>
int CopyRef(
int start, // Start
int count, // Number of Items for read
T &source[], // Source Buffer
T &dest[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
int result = 0;
//
if (forceClean)
{
Clean(dest);
}
//
if (start < 0)
{
start = 0;
}
//
if (start >= ArraySize(source))
{
start = ArraySize(source) - 1;
}
//
int beforeSize = ArraySize(dest);
//
bool asSeriesDest = ArrayGetAsSeries(dest);
bool asSeriesSource = ArrayGetAsSeries(source);
//
ArraySetAsSeries(dest, true);
ArraySetAsSeries(source, true);
//
for (int i = start; i < start + count; i++)
{
//
AddRef(
source[i],
dest
//
);
}
//
int afterSize = ArraySize(dest);
//
result = afterSize - beforeSize;
//
ArraySetAsSeries(dest, asSeriesDest);
ArraySetAsSeries(source, asSeriesSource);
//
return result;
}
//
// Retrive Last Item of Specified Buffer ...
template <typename T>