last works on helpers classes ...
This commit is contained in:
@@ -39,7 +39,11 @@ struct XXAMAInputs
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
string tmp;
|
||||
int length; // Period
|
||||
int fastEMA; // Fast EMA Period
|
||||
int slowEMA; // Slow EMA Period
|
||||
int maShift; // Shift
|
||||
ENUM_APPLIED_PRICE appliedTo; // Applied To
|
||||
|
||||
//
|
||||
// Constructor(s) ...
|
||||
@@ -57,6 +61,11 @@ struct XXAMAInputs
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
length = 0;
|
||||
fastEMA = 0;
|
||||
slowEMA = 0;
|
||||
maShift = 0;
|
||||
appliedTo = PRICE_CLOSE;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -64,6 +73,11 @@ struct XXAMAInputs
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
length = 18;
|
||||
fastEMA = 2;
|
||||
slowEMA = 30;
|
||||
maShift = 0;
|
||||
appliedTo = PRICE_CLOSE;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -76,7 +90,10 @@ struct XXAMAInputs
|
||||
//
|
||||
result =
|
||||
//
|
||||
false
|
||||
length > 0 &&
|
||||
fastEMA > 0 &&
|
||||
slowEMA > 0 &&
|
||||
slowEMA > fastEMA
|
||||
//
|
||||
;
|
||||
|
||||
@@ -92,7 +109,7 @@ struct XXAMAInputs
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
result = MathMax(0, 0);
|
||||
result = MathMax(length, length);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -144,21 +161,26 @@ public:
|
||||
//
|
||||
mInputs = inputs;
|
||||
|
||||
// //
|
||||
// // ArraySetAsSeries(shortExit2Buffer, true);
|
||||
// mHandler = iCustom(
|
||||
// mSymbol,
|
||||
// mPeriod,
|
||||
// "x-saherelm.x",
|
||||
// //
|
||||
// // Inputs ...
|
||||
// //
|
||||
// );
|
||||
// result = mHandler != INVALID_HANDLE;
|
||||
// if (!result)
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
ArraySetAsSeries(mainBuffer, true);
|
||||
mHandler = iCustom(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
"x-saherelm.xama",
|
||||
//
|
||||
// Inputs ...
|
||||
mInputs.length, // Period
|
||||
mInputs.fastEMA, // Fast EMA Period
|
||||
mInputs.slowEMA, // Slow EMA Period
|
||||
mInputs.maShift, // Shift
|
||||
mInputs.appliedTo // Applied To
|
||||
//
|
||||
);
|
||||
result = mHandler != INVALID_HANDLE;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -190,30 +212,55 @@ public:
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
// //
|
||||
// // Copy Required Long Exits 2 ...
|
||||
// int CopyLongExit2(
|
||||
// int start, // Start
|
||||
// int count, // Number of Items for read
|
||||
// double &buffer[], // Dest Buffer
|
||||
// bool forceClean = true // Force To Clean buffer
|
||||
// )
|
||||
// {
|
||||
// //
|
||||
// // Update Calculations ...
|
||||
// Calculate();
|
||||
//
|
||||
double GetMain(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
// //
|
||||
// // Copy Items ...
|
||||
// return Copy(
|
||||
// start,
|
||||
// count,
|
||||
// longExit2Buffer,
|
||||
// buffer,
|
||||
// forceClean
|
||||
// //
|
||||
// );
|
||||
// }
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(mainBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return mainBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Required Main Buffer ...
|
||||
int CopyMainBuffer(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate();
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
mainBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
@@ -227,7 +274,7 @@ private:
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
// double longExit1Buffer[];
|
||||
double mainBuffer[];
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
@@ -239,16 +286,16 @@ private:
|
||||
//
|
||||
int totalBars = CountBars();
|
||||
|
||||
// //
|
||||
// // Short Exit 2 ...
|
||||
// CopyBuffer(
|
||||
// mHandler,
|
||||
// X_CHE_SHORT_EXIT_2_LINE,
|
||||
// 0,
|
||||
// totalBars,
|
||||
// shortExit2Buffer
|
||||
// //
|
||||
// );
|
||||
//
|
||||
// Main Buffer ...
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XAMA_MAIN_LINE,
|
||||
0,
|
||||
totalBars,
|
||||
mainBuffer
|
||||
//
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user