complete all indicator/oscillator(s) helper classes ...

This commit is contained in:
2024-05-18 06:12:14 +03:30
parent fb0b6fe38f
commit 8c81f649dc
9 changed files with 2367 additions and 630 deletions
+90 -75
View File
@@ -39,7 +39,10 @@ struct XXTMInputs
{
//
// Props ...
string tmp;
int maPeriod; // Period
int maShift; // Shift
ENUM_MA_METHOD maMethod; // Method
ENUM_APPLIED_PRICE maAppliedTo; // Applied To
//
// Constructor(s) ...
@@ -57,6 +60,10 @@ struct XXTMInputs
void Clean()
{
//
maShift = 0;
maPeriod = 0;
maMethod = MODE_SMA;
maAppliedTo = PRICE_CLOSE;
}
//
@@ -64,6 +71,10 @@ struct XXTMInputs
void Default()
{
//
maShift = 0;
maPeriod = 14;
maMethod = MODE_SMA;
maAppliedTo = PRICE_CLOSE;
}
//
@@ -76,7 +87,7 @@ struct XXTMInputs
//
result =
//
false
maPeriod >= 2
//
;
@@ -92,7 +103,7 @@ struct XXTMInputs
int result = 0;
//
result = MathMax(0, 0);
result = MathMax(result, maPeriod);
//
return result;
@@ -124,7 +135,7 @@ public:
bool Init(
string symbol, // Trading Symbol
ENUM_TIMEFRAMES period, // Trading Period
XXTMInputs &inputs // Inputs
XXTMInputs &inputs // Inputs
)
{
//
@@ -144,21 +155,25 @@ 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.xtm",
//
// Inputs ...
mInputs.maPeriod, // Period
mInputs.maShift, // Shift
mInputs.maMethod, // Method
mInputs.maAppliedTo // Applied To
//
);
result = mHandler != INVALID_HANDLE;
if (!result)
{
return result;
}
//
return result;
@@ -189,56 +204,56 @@ public:
//
// Buffers ...
// //
// double GetMain(
// int barIndex // Bar Index
// )
// {
// //
// if (barIndex < 0)
// {
// barIndex = 0;
// }
// //
// Calculate();
//
double GetMain(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
// //
// int count = ArraySize(mainBuffer);
// if (barIndex >= count)
// {
// barIndex = count - 1;
// }
//
Calculate();
// //
// return mainBuffer[barIndex];
// }
//
int count = ArraySize(mainBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
// //
// // 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();
//
return mainBuffer[barIndex];
}
// //
// // Copy Items ...
// return Copy(
// start,
// count,
// longExit2Buffer,
// buffer,
// forceClean
// //
// );
// }
//
// 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 ...
@@ -252,7 +267,7 @@ private:
//
// Buffers ...
// double longExit1Buffer[];
double mainBuffer[];
//
// Tools ...
@@ -264,16 +279,16 @@ private:
//
int totalBars = CountBars();
// //
// // Short Exit 2 ...
// CopyBuffer(
// mHandler,
// X_CHE_SHORT_EXIT_2_LINE,
// 0,
// totalBars,
// shortExit2Buffer
// //
// );
//
// Main Buffer ...
CopyBuffer(
mHandler,
XTM_MAIN_LINE,
0,
totalBars,
mainBuffer
//
);
}
}