last works on create X121Setup ...
This commit is contained in:
@@ -46,4 +46,34 @@ protected:
|
||||
private:
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
template <typename T>
|
||||
string GenerateSpecifiedCommonSummary(
|
||||
T &mItem,
|
||||
string separator = "\n",
|
||||
bool includeScores = true,
|
||||
bool setLabel = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
(!setLabel
|
||||
? ""
|
||||
: "Commons:" + separator) +
|
||||
"---------------" + separator +
|
||||
"Symbol: " + mItem.symbol + separator +
|
||||
"Period: " + ToString(mItem.period) + separator +
|
||||
"Time: " + ToString(mItem.time) + separator +
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -249,6 +249,243 @@ struct XBuffer
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
class XSCBaseBufferClass : public XSCBaseAlert
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Virtual ...
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
virtual bool IsValid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculations ...
|
||||
virtual void Calculate() {}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Indicators Buffers ...
|
||||
XBuffer mBuffers[];
|
||||
|
||||
//
|
||||
// Buffer Management ...
|
||||
|
||||
//
|
||||
// Count Registered Buffers ...
|
||||
int CountBuffers()
|
||||
{
|
||||
return ArraySize(mBuffers);
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Specified Buffer Index ...
|
||||
int GetBufferIndex(
|
||||
string title // Specified Buffer Title
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
if (!IsSpecifiedValid(title))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int buffersCount = CountBuffers();
|
||||
if (!IsValidSize(buffersCount))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < buffersCount; i++)
|
||||
{
|
||||
//
|
||||
XBuffer iBuffer = mBuffers[i];
|
||||
|
||||
//
|
||||
bool isOwn = iBuffer.IsOwn(title);
|
||||
if (isOwn)
|
||||
{
|
||||
//
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Contains Specific Buffer or not ...
|
||||
bool HasBuffer(
|
||||
string title // Specified Buffer Title
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
int bufferIndex = GetBufferIndex(title);
|
||||
result = bufferIndex >= 0;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Specified Buffer ...
|
||||
bool GetBuffer(
|
||||
string title, // Specified Buffer Title
|
||||
XBuffer &buffer // Hold Result
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
int idx = GetBufferIndex(title);
|
||||
result = idx >= 0;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
buffer = mBuffers[idx];
|
||||
|
||||
//
|
||||
result = buffer.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Register Specified Buffer ...
|
||||
bool SetBuffer(
|
||||
XBuffer &buffer // Specified Buffer for Registration
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate buffer ...
|
||||
result = buffer.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Buffer Doesn't Exists before ...
|
||||
int idx = GetBufferIndex(buffer.title);
|
||||
result = idx == -1;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
AddRef(
|
||||
buffer,
|
||||
mBuffers //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double GetBufferValue(
|
||||
string mTitle, // Required Buffer Title
|
||||
int index // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = EMPTY_VALUE;
|
||||
|
||||
//
|
||||
// Validate State ...
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int bufferIDX = GetBufferIndex(mTitle);
|
||||
if (bufferIDX < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
result = mBuffers[bufferIDX].Get(index);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int CopyBufferValue(
|
||||
string mTitle,
|
||||
double &buffer[],
|
||||
int start,
|
||||
int count //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int sourceIDX = GetBufferIndex(mTitle);
|
||||
if (sourceIDX < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
result = ArrayCopy(
|
||||
buffer,
|
||||
mBuffers[sourceIDX].values,
|
||||
start,
|
||||
start,
|
||||
count //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Base Indicator Class ...
|
||||
class XSCBaseInd : public XSCBaseAlert
|
||||
@@ -650,3 +887,5 @@ private:
|
||||
//
|
||||
// Props ...
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user