complete all indicator/oscillator(s) helper classes ...
This commit is contained in:
@@ -39,7 +39,35 @@ struct XXRSIInputs
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
string tmp;
|
||||
|
||||
//
|
||||
// Market ...
|
||||
int length; // Market Length
|
||||
ENUM_APPLIED_PRICE appliedTo; // Applied To
|
||||
|
||||
//
|
||||
// Short Entry ...
|
||||
double shortEntryValue; // Short Entry Level
|
||||
color shortEntryColor; // Short Entry Level Color
|
||||
ENUM_LINE_STYLE shortEntryLineStyle; // Short Entry Style
|
||||
|
||||
//
|
||||
// Short Exit ...
|
||||
double shortExitValue; // Short Exit Level
|
||||
color shortExitColor; // Short Exit Level Color
|
||||
ENUM_LINE_STYLE shortExitLineStyle; // Short Exit Style
|
||||
|
||||
//
|
||||
// Long Entry ...
|
||||
double longEntryValue; // Long Entry Level
|
||||
color longEntryColor; // Long Entry Level Color
|
||||
ENUM_LINE_STYLE longEntryLineStyle; // Long Entry Style
|
||||
|
||||
//
|
||||
// Long Exit ...
|
||||
double longExitValue; // Long Exit Level
|
||||
color longExitColor; // Long Exit Level Color
|
||||
ENUM_LINE_STYLE longExitLineStyle; // Long Exit Style
|
||||
|
||||
//
|
||||
// Constructor(s) ...
|
||||
@@ -57,6 +85,33 @@ struct XXRSIInputs
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Market ...
|
||||
length = 0;
|
||||
appliedTo = PRICE_CLOSE;
|
||||
|
||||
//
|
||||
// Short Entry ...
|
||||
shortEntryValue = 0;
|
||||
shortEntryColor = CLR_NONE;
|
||||
shortEntryLineStyle = STYLE_DOT;
|
||||
|
||||
//
|
||||
// Short Exit ...
|
||||
shortExitValue = 0;
|
||||
shortExitColor = CLR_NONE;
|
||||
shortExitLineStyle = STYLE_DOT;
|
||||
|
||||
//
|
||||
// Long Entry ...
|
||||
longEntryValue = 0;
|
||||
longEntryColor = CLR_NONE;
|
||||
longEntryLineStyle = STYLE_DOT;
|
||||
|
||||
//
|
||||
// Long Exit ...
|
||||
longExitValue = 0;
|
||||
longExitColor = CLR_NONE;
|
||||
longExitLineStyle = STYLE_DOT;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -64,6 +119,33 @@ struct XXRSIInputs
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
// Market ...
|
||||
length = 14;
|
||||
appliedTo = PRICE_CLOSE;
|
||||
|
||||
//
|
||||
// Short Entry ...
|
||||
shortEntryValue = 70;
|
||||
shortEntryColor = CLR_NONE;
|
||||
shortEntryLineStyle = STYLE_DOT;
|
||||
|
||||
//
|
||||
// Short Exit ...
|
||||
shortExitValue = 40;
|
||||
shortExitColor = CLR_NONE;
|
||||
shortExitLineStyle = STYLE_DOT;
|
||||
|
||||
//
|
||||
// Long Entry ...
|
||||
longEntryValue = 30;
|
||||
longEntryColor = CLR_NONE;
|
||||
longEntryLineStyle = STYLE_DOT;
|
||||
|
||||
//
|
||||
// Long Exit ...
|
||||
longExitValue = 60;
|
||||
longExitColor = CLR_NONE;
|
||||
longExitLineStyle = STYLE_DOT;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -76,7 +158,7 @@ struct XXRSIInputs
|
||||
//
|
||||
result =
|
||||
//
|
||||
false
|
||||
length >= 2
|
||||
//
|
||||
;
|
||||
|
||||
@@ -92,7 +174,7 @@ struct XXRSIInputs
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
result = MathMax(0, 0);
|
||||
result = MathMax(result, length);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -144,21 +226,50 @@ 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.xrsi",
|
||||
//
|
||||
// Inputs ...
|
||||
//
|
||||
// Market ...
|
||||
"",
|
||||
mInputs.length, // Market Length
|
||||
mInputs.appliedTo, // Applied To
|
||||
//
|
||||
// Short Entry ...
|
||||
"",
|
||||
mInputs.shortEntryValue, // Short Entry Level
|
||||
mInputs.shortEntryColor, // Short Entry Level Color
|
||||
mInputs.shortEntryLineStyle, // Short Entry Style
|
||||
//
|
||||
// Short Exit ...
|
||||
"",
|
||||
mInputs.shortExitValue, // Short Exit Level
|
||||
mInputs.shortExitColor, // Short Exit Level Color
|
||||
mInputs.shortExitLineStyle, // Short Exit Style
|
||||
//
|
||||
// Long Entry ...
|
||||
"",
|
||||
mInputs.longEntryValue, // Long Entry Level
|
||||
mInputs.longEntryColor, // Long Entry Level Color
|
||||
mInputs.longEntryLineStyle, // Long Entry Style
|
||||
//
|
||||
// Long Exit ...
|
||||
"",
|
||||
mInputs.longExitValue, // Long Exit Level
|
||||
mInputs.longExitColor, // Long Exit Level Color
|
||||
mInputs.longExitLineStyle // Long Exit Style
|
||||
//
|
||||
);
|
||||
result = mHandler != INVALID_HANDLE;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -190,55 +301,55 @@ public:
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
// //
|
||||
// double GetMain(
|
||||
// int barIndex // Bar Index
|
||||
// )
|
||||
// {
|
||||
// //
|
||||
// if (barIndex < 0)
|
||||
// {
|
||||
// barIndex = 0;
|
||||
// }
|
||||
//
|
||||
double GetMain(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
// //
|
||||
// Calculate();
|
||||
//
|
||||
Calculate();
|
||||
|
||||
// //
|
||||
// int count = ArraySize(mainBuffer);
|
||||
// if (barIndex >= count)
|
||||
// {
|
||||
// barIndex = count - 1;
|
||||
// }
|
||||
//
|
||||
int count = ArraySize(mainBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
// //
|
||||
// return mainBuffer[barIndex];
|
||||
// }
|
||||
//
|
||||
return mainBuffer[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 CopyMain(
|
||||
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,
|
||||
mainBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
@@ -252,7 +363,7 @@ private:
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
// double longExit1Buffer[];
|
||||
double mainBuffer[];
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
@@ -264,16 +375,16 @@ private:
|
||||
//
|
||||
int totalBars = CountBars();
|
||||
|
||||
// //
|
||||
// // Short Exit 2 ...
|
||||
// CopyBuffer(
|
||||
// mHandler,
|
||||
// X_CHE_SHORT_EXIT_2_LINE,
|
||||
// 0,
|
||||
// totalBars,
|
||||
// shortExit2Buffer
|
||||
// //
|
||||
// );
|
||||
//
|
||||
// Main ...
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XRSI_MAIN_LINE,
|
||||
0,
|
||||
totalBars,
|
||||
mainBuffer
|
||||
//
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user