complete all indicator/oscillator(s) helper classes ...
This commit is contained in:
@@ -30,7 +30,9 @@
|
||||
//
|
||||
enum ENUM_XLH_BUFFERS
|
||||
{
|
||||
XLH_MAIN_LINE = 0
|
||||
XLH_HH_LINE = 0,
|
||||
XLH_LL_LINE = 1,
|
||||
XLH_SIGNAL_LINE = 2,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -39,7 +41,9 @@ struct XXLHInputs
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
string tmp;
|
||||
int length; // Length
|
||||
ENUM_SERIESMODE hhMode; // Highest High Calculation Method
|
||||
ENUM_SERIESMODE llMode; // Lowest Low Calculation Method
|
||||
|
||||
//
|
||||
// Constructor(s) ...
|
||||
@@ -57,6 +61,9 @@ struct XXLHInputs
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
length = 0;
|
||||
hhMode = MODE_HIGH;
|
||||
llMode = MODE_LOW;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -64,6 +71,9 @@ struct XXLHInputs
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
length = 14;
|
||||
hhMode = MODE_HIGH;
|
||||
llMode = MODE_LOW;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -76,7 +86,7 @@ struct XXLHInputs
|
||||
//
|
||||
result =
|
||||
//
|
||||
false
|
||||
length >= 2
|
||||
//
|
||||
;
|
||||
|
||||
@@ -92,7 +102,7 @@ struct XXLHInputs
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
result = MathMax(0, 0);
|
||||
result = MathMax(result, length);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -124,7 +134,7 @@ public:
|
||||
bool Init(
|
||||
string symbol, // Trading Symbol
|
||||
ENUM_TIMEFRAMES period, // Trading Period
|
||||
XXLHInputs &inputs // Inputs
|
||||
XXLHInputs &inputs // Inputs
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -144,21 +154,28 @@ public:
|
||||
//
|
||||
mInputs = inputs;
|
||||
|
||||
// //
|
||||
// // ArraySetAsSeries(shortExit2Buffer, true);
|
||||
// mHandler = iCustom(
|
||||
// mSymbol,
|
||||
// mPeriod,
|
||||
// "x-saherelm.x",
|
||||
// //
|
||||
// // Inputs ...
|
||||
// //
|
||||
// );
|
||||
// result = mHandler != INVALID_HANDLE;
|
||||
// if (!result)
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
ArraySetAsSeries(hhBuffer, true);
|
||||
ArraySetAsSeries(llBuffer, true);
|
||||
ArraySetAsSeries(signalBuffer, true);
|
||||
|
||||
//
|
||||
mHandler = iCustom(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
"x-saherelm.xlh",
|
||||
//
|
||||
// Inputs ...
|
||||
mInputs.length, // Length
|
||||
mInputs.hhMode, // Highest High Calculation Method
|
||||
mInputs.llMode // Lowest Low Calculation Method
|
||||
//
|
||||
);
|
||||
result = mHandler != INVALID_HANDLE;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -190,55 +207,155 @@ public:
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
// //
|
||||
// double GetMain(
|
||||
// int barIndex // Bar Index
|
||||
// )
|
||||
// {
|
||||
// //
|
||||
// if (barIndex < 0)
|
||||
// {
|
||||
// barIndex = 0;
|
||||
// }
|
||||
//
|
||||
double GetHH(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
// //
|
||||
// Calculate();
|
||||
//
|
||||
Calculate();
|
||||
|
||||
// //
|
||||
// int count = ArraySize(mainBuffer);
|
||||
// if (barIndex >= count)
|
||||
// {
|
||||
// barIndex = count - 1;
|
||||
// }
|
||||
//
|
||||
int count = ArraySize(hhBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
// //
|
||||
// return mainBuffer[barIndex];
|
||||
// }
|
||||
//
|
||||
return hhBuffer[barIndex];
|
||||
}
|
||||
|
||||
// //
|
||||
// // 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();
|
||||
//
|
||||
// Copy Required Items ...
|
||||
int CopyHH(
|
||||
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,
|
||||
// longExit2Buffer,
|
||||
// buffer,
|
||||
// forceClean
|
||||
// //
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
hhBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetLL(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(llBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return llBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Required Items ...
|
||||
int CopyLL(
|
||||
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,
|
||||
llBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetSignal(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(signalBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return signalBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Required Items ...
|
||||
int CopySignal(
|
||||
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,
|
||||
signalBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
@@ -252,7 +369,9 @@ private:
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
// double longExit1Buffer[];
|
||||
double hhBuffer[];
|
||||
double llBuffer[];
|
||||
double signalBuffer[];
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
@@ -264,16 +383,38 @@ private:
|
||||
//
|
||||
int totalBars = CountBars();
|
||||
|
||||
// //
|
||||
// // Short Exit 2 ...
|
||||
// CopyBuffer(
|
||||
// mHandler,
|
||||
// X_CHE_SHORT_EXIT_2_LINE,
|
||||
// 0,
|
||||
// totalBars,
|
||||
// shortExit2Buffer
|
||||
// //
|
||||
// );
|
||||
//
|
||||
// HH ...
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XLH_HH_LINE,
|
||||
0,
|
||||
totalBars,
|
||||
hhBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
// LL ...
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XLH_LL_LINE,
|
||||
0,
|
||||
totalBars,
|
||||
llBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
// Signal ...
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XLH_SIGNAL_LINE,
|
||||
0,
|
||||
totalBars,
|
||||
signalBuffer
|
||||
//
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user