960 lines
20 KiB
Plaintext
960 lines
20 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XSCXCHMAHelper
|
|
// Description: provides all Indicator
|
|
// Helper requirements ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property library
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://www.saherelm.ir"
|
|
#property version "1.00"
|
|
#property strict
|
|
|
|
//
|
|
// Imports ...
|
|
#include "../Classes/x-saherelm.xhelper.class.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
enum ENUM_XCHMA_BUFFERS
|
|
{
|
|
//
|
|
// LC ...
|
|
XCHMA_LC_FAST_LINE = 0,
|
|
XCHMA_LC_SLOW_LINE = 1,
|
|
//
|
|
// MC ...
|
|
XCHMA_MC_FAST_LINE = 2,
|
|
XCHMA_MC_SLOW_LINE = 3,
|
|
//
|
|
// SC ...
|
|
XCHMA_SC_FAST_LINE = 4,
|
|
XCHMA_SC_SLOW_LINE = 5,
|
|
//
|
|
XCHMA_HOT_STATE_LINE = 6,
|
|
};
|
|
|
|
//
|
|
// Input Models ...
|
|
struct XCHMAInputs
|
|
{
|
|
//
|
|
// Props ...
|
|
//
|
|
// Hot Areas ...
|
|
bool drawHotAreas; // Draw Hot Areas Symbol
|
|
uchar hotBullishArrowCode; // Hot Bullish Arrow Code
|
|
color hotBullishArrowColor; // Hot Bullish Arrow Color
|
|
uchar hotBearishArrowCode; // Hot Bearish Arrow Code
|
|
color hotBearishArrowColor; // Hot Bearish Arrow Color
|
|
|
|
//
|
|
// Long Cycle ...
|
|
// LC Market ...
|
|
int lcFastLength; // Fast Length
|
|
int lcSlowLength; // Slow Length
|
|
ENUM_MA_METHOD lcMethod; // Calculation Method
|
|
ENUM_APPLIED_PRICE lcAppliedTo; // Applied To
|
|
// LC Style ...
|
|
int lcDrawWidth; // Draw Width
|
|
ENUM_DRAW_TYPE lcDrawType; // Draw Type
|
|
ENUM_LINE_STYLE lcDrawStyle; // Draw Style
|
|
color lcFastColor; // Fast Color
|
|
color lcSlowColor; // Slow Color
|
|
// LC Drawings ...
|
|
bool lcDrawFast; // Draw Fast
|
|
bool lcDrawSlow; // Draw Slow
|
|
bool lcDrawCrosses; // Draw Cross Lines
|
|
|
|
//
|
|
// Medium Cycle ...
|
|
// MC Market ...
|
|
int mcFastLength; // Fast Length
|
|
int mcSlowLength; // Slow Length
|
|
ENUM_MA_METHOD mcMethod; // Calculation Method
|
|
ENUM_APPLIED_PRICE mcAppliedTo; // Applied To
|
|
// MC Style ...
|
|
int mcDrawWidth; // Draw Width
|
|
ENUM_DRAW_TYPE mcDrawType; // Draw Type
|
|
ENUM_LINE_STYLE mcDrawStyle; // Draw Style
|
|
color mcFastColor; // Fast Color
|
|
color mcSlowColor; // Slow Color
|
|
// MC Drawings ...
|
|
bool mcDrawFast; // Draw Fast
|
|
bool mcDrawSlow; // Draw Slow
|
|
bool mcDrawCrosses; // Draw Cross Lines
|
|
|
|
//
|
|
// Short Cycle ...
|
|
// SC Market ...
|
|
int scFastLength; // Fast Length
|
|
int scSlowLength; // Slow Length
|
|
ENUM_MA_METHOD scMethod; // Calculation Method
|
|
ENUM_APPLIED_PRICE scAppliedTo; // Applied To
|
|
// SC Style ...
|
|
int scDrawWidth; // Draw Width
|
|
ENUM_DRAW_TYPE scDrawType; // Draw Type
|
|
ENUM_LINE_STYLE scDrawStyle; // Draw Style
|
|
color scFastColor; // Fast Color
|
|
color scSlowColor; // Slow Color
|
|
// SC Drawings ...
|
|
bool scDrawFast; // Draw Fast
|
|
bool scDrawSlow; // Draw Slow
|
|
bool scDrawCrosses; // Draw Cross Lines
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
XCHMAInputs()
|
|
{
|
|
//
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Clean ...
|
|
void Clean()
|
|
{
|
|
//
|
|
// Hot Areas ...
|
|
drawHotAreas = false;
|
|
hotBullishArrowCode = 228;
|
|
hotBullishArrowColor = CLR_NONE;
|
|
hotBearishArrowCode = 230;
|
|
hotBearishArrowColor = CLR_NONE;
|
|
|
|
//
|
|
// Long Cycle ...
|
|
// LC Market ...
|
|
lcFastLength = 20;
|
|
lcSlowLength = 50;
|
|
lcMethod = MODE_EMA;
|
|
lcAppliedTo = PRICE_CLOSE;
|
|
// LC Style ...
|
|
lcDrawWidth = 1;
|
|
lcDrawType = DRAW_NONE;
|
|
lcDrawStyle = STYLE_DOT;
|
|
lcFastColor = CLR_NONE;
|
|
lcSlowColor = CLR_NONE;
|
|
// LC Drawings ...
|
|
lcDrawFast = false;
|
|
lcDrawSlow = false;
|
|
lcDrawCrosses = false;
|
|
|
|
//
|
|
// Medium Cycle ...
|
|
// MC Market ...
|
|
mcFastLength = 10;
|
|
mcSlowLength = 30;
|
|
mcMethod = MODE_EMA;
|
|
mcAppliedTo = PRICE_CLOSE;
|
|
// MC Style ...
|
|
mcDrawWidth = 1;
|
|
mcDrawType = DRAW_NONE;
|
|
mcDrawStyle = STYLE_DOT;
|
|
mcFastColor = CLR_NONE;
|
|
mcSlowColor = CLR_NONE;
|
|
// MC Drawings ...
|
|
mcDrawFast = false;
|
|
mcDrawSlow = false;
|
|
mcDrawCrosses = false;
|
|
|
|
//
|
|
// Short Cycle ...
|
|
// SC Market ...
|
|
scFastLength = 7;
|
|
scSlowLength = 14;
|
|
scMethod = MODE_EMA;
|
|
scAppliedTo = PRICE_CLOSE;
|
|
// SC Style ...
|
|
scDrawWidth = 1;
|
|
scDrawType = DRAW_NONE;
|
|
scDrawStyle = STYLE_SOLID;
|
|
scFastColor = CLR_NONE;
|
|
scSlowColor = CLR_NONE;
|
|
// SC Drawings ...
|
|
scDrawFast = false;
|
|
scDrawSlow = false;
|
|
scDrawCrosses = false;
|
|
}
|
|
|
|
//
|
|
// Default ...
|
|
void Default()
|
|
{
|
|
//
|
|
// Hot Areas ...
|
|
drawHotAreas = false;
|
|
hotBullishArrowCode = 228;
|
|
hotBullishArrowColor = CLR_NONE;
|
|
hotBearishArrowCode = 230;
|
|
hotBearishArrowColor = CLR_NONE;
|
|
|
|
//
|
|
// Long Cycle ...
|
|
// LC Market ...
|
|
lcFastLength = 20;
|
|
lcSlowLength = 50;
|
|
lcMethod = MODE_EMA;
|
|
lcAppliedTo = PRICE_CLOSE;
|
|
// LC Style ...
|
|
lcDrawWidth = 1;
|
|
lcDrawType = DRAW_LINE;
|
|
lcDrawStyle = STYLE_DOT;
|
|
lcFastColor = clrAqua;
|
|
lcSlowColor = clrFuchsia;
|
|
// LC Drawings ...
|
|
lcDrawFast = false;
|
|
lcDrawSlow = false;
|
|
lcDrawCrosses = false;
|
|
|
|
//
|
|
// Medium Cycle ...
|
|
// MC Market ...
|
|
mcFastLength = 10;
|
|
mcSlowLength = 30;
|
|
mcMethod = MODE_EMA;
|
|
mcAppliedTo = PRICE_CLOSE;
|
|
// MC Style ...
|
|
mcDrawWidth = 1;
|
|
mcDrawType = DRAW_LINE;
|
|
mcDrawStyle = STYLE_DOT;
|
|
mcFastColor = clrLime;
|
|
mcSlowColor = clrRed;
|
|
// MC Drawings ...
|
|
mcDrawFast = false;
|
|
mcDrawSlow = false;
|
|
mcDrawCrosses = false;
|
|
|
|
//
|
|
// Short Cycle ...
|
|
// SC Market ...
|
|
scFastLength = 7;
|
|
scSlowLength = 14;
|
|
scMethod = MODE_EMA;
|
|
scAppliedTo = PRICE_CLOSE;
|
|
// SC Style ...
|
|
scDrawWidth = 1;
|
|
scDrawType = DRAW_LINE;
|
|
scDrawStyle = STYLE_SOLID;
|
|
scFastColor = clrLightBlue;
|
|
scSlowColor = clrLightSalmon;
|
|
// SC Drawings ...
|
|
scDrawFast = false;
|
|
scDrawSlow = false;
|
|
scDrawCrosses = false;
|
|
}
|
|
|
|
//
|
|
// Validate ...
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
(lcFastLength >= 4 && lcSlowLength > lcFastLength) &&
|
|
(mcFastLength >= 4 && mcSlowLength > mcFastLength) &&
|
|
(scFastLength >= 4 && scSlowLength > scFastLength) &&
|
|
(lcFastLength > mcFastLength &&
|
|
mcFastLength > scFastLength)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Retrieve MAx Length ...
|
|
int Max()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
result = MathMax(scFastLength, scSlowLength);
|
|
result = MathMax(result, lcFastLength);
|
|
result = MathMax(result, lcSlowLength);
|
|
result = MathMax(result, mcFastLength);
|
|
result = MathMax(result, mcSlowLength);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Class ...
|
|
class XSCXCHMAHelper : public XSCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Constructors ...
|
|
XSCXCHMAHelper() : XSCBaseHelper(_Symbol, _Period)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XSCXCHMAHelper() {}
|
|
|
|
//
|
|
// Tools ...
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
XCHMAInputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
ArraySetAsSeries(scFastBuffer, true);
|
|
ArraySetAsSeries(scSlowBuffer, true);
|
|
ArraySetAsSeries(mcFastBuffer, true);
|
|
ArraySetAsSeries(mcSlowBuffer, true);
|
|
ArraySetAsSeries(lcFastBuffer, true);
|
|
ArraySetAsSeries(lcSlowBuffer, true);
|
|
ArraySetAsSeries(hotStateBuffer, true);
|
|
|
|
//
|
|
mHandler = iCustom(
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.xchma",
|
|
//
|
|
// Inputs ...
|
|
//
|
|
// Hot Areas ...
|
|
"",
|
|
mInputs.drawHotAreas, // Draw Hot Areas Symbol
|
|
mInputs.hotBullishArrowCode, // Hot Bullish Arrow Code
|
|
mInputs.hotBullishArrowColor, // Hot Bullish Arrow Color
|
|
mInputs.hotBearishArrowCode, // Hot Bearish Arrow Code
|
|
mInputs.hotBearishArrowColor, // Hot Bearish Arrow Color
|
|
//
|
|
// Long Cycle ...
|
|
"",
|
|
//
|
|
// LC Market ...
|
|
"",
|
|
mInputs.lcFastLength, // Fast Length
|
|
mInputs.lcSlowLength, // Slow Length
|
|
mInputs.lcMethod, // Calculation Method
|
|
mInputs.lcAppliedTo, // Applied To
|
|
//
|
|
// LC Style ...
|
|
"",
|
|
mInputs.lcDrawWidth, // Draw Width
|
|
mInputs.lcDrawType, // Draw Type
|
|
mInputs.lcDrawStyle, // Draw Style
|
|
mInputs.lcFastColor, // Fast Color
|
|
mInputs.lcSlowColor, // Slow Color
|
|
//
|
|
// LC Drawings ...
|
|
"",
|
|
mInputs.lcDrawFast, // Draw Fast
|
|
mInputs.lcDrawSlow, // Draw Slow
|
|
mInputs.lcDrawCrosses, // Draw Cross Lines
|
|
//
|
|
// Medium Cycle ...
|
|
"",
|
|
//
|
|
// MC Market ...
|
|
"",
|
|
mInputs.mcFastLength, // Fast Length
|
|
mInputs.mcSlowLength, // Slow Length
|
|
mInputs.mcMethod, // Calculation Method
|
|
mInputs.mcAppliedTo, // Applied To
|
|
//
|
|
// MC Style ...
|
|
"",
|
|
mInputs.mcDrawWidth, // Draw Width
|
|
mInputs.mcDrawType, // Draw Type
|
|
mInputs.mcDrawStyle, // Draw Style
|
|
mInputs.mcFastColor, // Fast Color
|
|
mInputs.mcSlowColor, // Slow Color
|
|
//
|
|
// MC Drawings ...
|
|
"",
|
|
mInputs.mcDrawFast, // Draw Fast
|
|
mInputs.mcDrawSlow, // Draw Slow
|
|
mInputs.mcDrawCrosses, // Draw Cross Lines
|
|
//
|
|
// Short Cycle ...
|
|
"",
|
|
//
|
|
// SC Market ...
|
|
"",
|
|
mInputs.scFastLength, // Fast Length
|
|
mInputs.scSlowLength, // Slow Length
|
|
mInputs.scMethod, // Calculation Method
|
|
mInputs.scAppliedTo, // Applied To
|
|
//
|
|
// SC Style ...
|
|
"",
|
|
mInputs.scDrawWidth, // Draw Width
|
|
mInputs.scDrawType, // Draw Type
|
|
mInputs.scDrawStyle, // Draw Style
|
|
mInputs.scFastColor, // Fast Color
|
|
mInputs.scSlowColor, // Slow Color
|
|
//
|
|
// SC Drawings ...
|
|
"",
|
|
mInputs.scDrawFast, // Draw Fast
|
|
mInputs.scDrawSlow, // Draw Slow
|
|
mInputs.scDrawCrosses // Draw Cross Lines
|
|
//
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
XCHMAInputs GetInputs()
|
|
{
|
|
return mInputs;
|
|
}
|
|
|
|
//
|
|
bool SetInputs(
|
|
XCHMAInputs &inputs // Configs
|
|
)
|
|
{
|
|
//
|
|
return Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
inputs
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
double GetSCFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(scFastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return scFastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySCFast(
|
|
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,
|
|
scFastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetSCSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(scSlowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return scSlowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySCSlow(
|
|
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,
|
|
scSlowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
double GetMCFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mcFastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return mcFastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMCFast(
|
|
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,
|
|
mcFastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetMCSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mcSlowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return mcSlowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMCSlow(
|
|
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,
|
|
mcSlowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
double GetLCFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lcFastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return lcFastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLCFast(
|
|
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,
|
|
lcFastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetLCSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lcSlowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return lcSlowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLCSlow(
|
|
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,
|
|
lcSlowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetHotState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(hotStateBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return hotStateBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyHotState(
|
|
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,
|
|
hotStateBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
XCHMAInputs mInputs; // Inputs ...
|
|
|
|
//
|
|
// Buffers ...
|
|
double scFastBuffer[];
|
|
double scSlowBuffer[];
|
|
double mcFastBuffer[];
|
|
double mcSlowBuffer[];
|
|
double lcFastBuffer[];
|
|
double lcSlowBuffer[];
|
|
double hotStateBuffer[];
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Calculate Values Until Now ...
|
|
void Calculate()
|
|
{
|
|
//
|
|
int totalBars = CountBars();
|
|
|
|
//
|
|
// Short Cycle ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_SC_FAST_LINE,
|
|
0,
|
|
totalBars,
|
|
scFastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_SC_SLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
scSlowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Medium Cycle ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_MC_FAST_LINE,
|
|
0,
|
|
totalBars,
|
|
mcFastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_MC_SLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
mcSlowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Long Cycle ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_LC_FAST_LINE,
|
|
0,
|
|
totalBars,
|
|
lcFastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_LC_SLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
lcSlowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Hot State ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_HOT_STATE_LINE,
|
|
0,
|
|
totalBars,
|
|
hotStateBuffer
|
|
//
|
|
);
|
|
}
|
|
};
|
|
|
|
//
|
|
// Tools ... |