last works on XFIMA ...
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
//
|
||||
// Includes ...
|
||||
#include "../Classes/x-saherelm.base.class.mq5"
|
||||
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
@@ -125,6 +126,25 @@ class XCBaseHelper : public XCBase
|
||||
//
|
||||
// Functions ...
|
||||
|
||||
/**
|
||||
* Validate Handler Exists ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsXValid(mSymbol) &&
|
||||
IsXValid(mPeriod) &&
|
||||
mHandler != INVALID_HANDLE;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract Validated Zones ...
|
||||
*
|
||||
@@ -511,6 +531,110 @@ class XCBaseHelper : public XCBase
|
||||
// Indicator Handler ...
|
||||
int mHandler;
|
||||
|
||||
/**
|
||||
* Read Value of Specified Buffer ...
|
||||
*
|
||||
* @param bufferIndex: int, which handler buffer to read value ...
|
||||
* @param barIndex: int, Specified Bar Index ...
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double ReadValue(
|
||||
int bufferIndex,
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = EMPTY_VALUE;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
int barsTotal = CountBars();
|
||||
barIndex = NormalizeInt(barIndex, 0, barsTotal - 1);
|
||||
bufferIndex = NormalizeInt(bufferIndex, 0);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double tmp[];
|
||||
int count = CopyBuffer(
|
||||
mHandler,
|
||||
bufferIndex,
|
||||
barIndex,
|
||||
1,
|
||||
tmp //
|
||||
);
|
||||
result = tmp[0];
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read Values of Specified Buffer ...
|
||||
*
|
||||
* @param buffer: double, reference collection to holds result ...
|
||||
* @param bufferIndex: int, which handler buffer to read value ...
|
||||
* @param barIndex: int, Specified Bar Index ...
|
||||
* @param count: int, number of items to read, 0 for WHOLE_ARRAY ...
|
||||
* @param asSeries: bool, set As Series Buffer or not ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int ReadValues(
|
||||
double &buffer[],
|
||||
int bufferIndex,
|
||||
int barIndex = 0,
|
||||
int count = 0,
|
||||
bool asSeries = true //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
XClean(buffer);
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
int barsTotal = CountBars();
|
||||
count = NormalizeInt(count, 0);
|
||||
bufferIndex = NormalizeInt(bufferIndex, 0);
|
||||
barIndex = NormalizeInt(barIndex, 0, barsTotal - 1);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = CopyBuffer(
|
||||
mHandler,
|
||||
bufferIndex,
|
||||
barIndex,
|
||||
count,
|
||||
buffer //
|
||||
);
|
||||
|
||||
//
|
||||
// Set As Series Flag ...
|
||||
ArraySetAsSeries(buffer, asSeries);
|
||||
|
||||
//
|
||||
result = ArraySize(buffer);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user