1629 lines
36 KiB
Plaintext
1629 lines
36 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XCX121XKIHelper
|
|
// 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.x-helper.class.mq5"
|
|
|
|
// #region Definitions ...
|
|
enum ENUM_X121_XKI_BUFFER_NAME
|
|
{
|
|
X121_XKI_NONE = 0,
|
|
X121_XKI_FAST = 1,
|
|
X121_XKI_SLOW = 2,
|
|
X121_XKI_SUPER_SLOW = 3,
|
|
X121_XKI_UPPER = 4,
|
|
X121_XKI_LOWER = 5,
|
|
X121_XKI_WAVE = 6,
|
|
X121_XKI_MA_FAST = 7,
|
|
X121_XKI_MA_SLOW = 8,
|
|
X121_XKI_MA_SUPER_SLOW = 9,
|
|
X121_XKI_MA_CROSS = 10,
|
|
X121_XKI_ATR = 11,
|
|
};
|
|
|
|
bool IsXValid(ENUM_X121_XKI_BUFFER_NAME value)
|
|
{
|
|
return value != X121_XKI_NONE;
|
|
}
|
|
string ToXString(ENUM_X121_XKI_BUFFER_NAME value)
|
|
{
|
|
//
|
|
string result = NULL;
|
|
|
|
//
|
|
if (IsXValid(value))
|
|
{
|
|
//
|
|
switch (value)
|
|
{
|
|
//
|
|
case X121_XKI_FAST:
|
|
result = "FAST";
|
|
break;
|
|
|
|
//
|
|
case X121_XKI_SLOW:
|
|
result = "SLOW";
|
|
break;
|
|
|
|
//
|
|
case X121_XKI_SUPER_SLOW:
|
|
result = "SUPER_SLOW";
|
|
break;
|
|
|
|
//
|
|
case X121_XKI_UPPER:
|
|
result = "UPPER";
|
|
break;
|
|
|
|
//
|
|
case X121_XKI_LOWER:
|
|
result = "LOWER";
|
|
break;
|
|
|
|
//
|
|
case X121_XKI_WAVE:
|
|
result = "WAVE";
|
|
break;
|
|
|
|
//
|
|
case X121_XKI_MA_FAST:
|
|
result = "MA_FAST";
|
|
break;
|
|
|
|
//
|
|
case X121_XKI_MA_SLOW:
|
|
result = "MA_SLOW";
|
|
break;
|
|
|
|
//
|
|
case X121_XKI_MA_SUPER_SLOW:
|
|
result = "MA_SUPER_SLOW";
|
|
break;
|
|
}
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
ENUM_X121_XKI_BUFFER_NAME ToXKIBufferName(string value)
|
|
{
|
|
//
|
|
ENUM_X121_XKI_BUFFER_NAME result = X121_XKI_NONE;
|
|
|
|
//
|
|
if (IsXValid(value))
|
|
{
|
|
//
|
|
if (value == ToXString(X121_XKI_FAST))
|
|
{
|
|
result = X121_XKI_FAST;
|
|
}
|
|
else if (value == ToXString(X121_XKI_SLOW))
|
|
{
|
|
result = X121_XKI_SLOW;
|
|
}
|
|
else if (value == ToXString(X121_XKI_SUPER_SLOW))
|
|
{
|
|
result = X121_XKI_SUPER_SLOW;
|
|
}
|
|
else if (value == ToXString(X121_XKI_UPPER))
|
|
{
|
|
result = X121_XKI_UPPER;
|
|
}
|
|
else if (value == ToXString(X121_XKI_LOWER))
|
|
{
|
|
result = X121_XKI_LOWER;
|
|
}
|
|
else if (value == ToXString(X121_XKI_WAVE))
|
|
{
|
|
result = X121_XKI_WAVE;
|
|
}
|
|
else if (value == ToXString(X121_XKI_MA_FAST))
|
|
{
|
|
result = X121_XKI_MA_FAST;
|
|
}
|
|
else if (value == ToXString(X121_XKI_MA_SLOW))
|
|
{
|
|
result = X121_XKI_MA_SLOW;
|
|
}
|
|
else if (value == ToXString(X121_XKI_MA_SUPER_SLOW))
|
|
{
|
|
result = X121_XKI_MA_SUPER_SLOW;
|
|
}
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
// #endregion
|
|
|
|
// #region Buffers ...
|
|
enum ENUM_X121_XKI_BUFFERS
|
|
{
|
|
//
|
|
// KI Fast ...
|
|
X121_XKI_KI_FAST_LINE = 0,
|
|
X121_XKI_KI_FAST_COLOR_LINE = 1,
|
|
X121_XKI_KI_FAST_STATE_LINE = 15,
|
|
//
|
|
// KI Slow ...
|
|
X121_XKI_KI_SLOW_LINE = 8,
|
|
X121_XKI_KI_SLOW_COLOR_LINE = 9,
|
|
X121_XKI_KI_SLOW_STATE_LINE = 22,
|
|
//
|
|
// KI Super Slow ...
|
|
X121_XKI_KI_SUPER_SLOW_LINE = 10,
|
|
X121_XKI_KI_SUPER_SLOW_COLOR_LINE = 11,
|
|
X121_XKI_KI_SUPER_SLOW_STATE_LINE = 24,
|
|
//
|
|
// KI Wave ...
|
|
X121_XKI_KI_WAVE_LINE = 2,
|
|
X121_XKI_KI_WAVE_RAW_LINE = 20,
|
|
X121_XKI_KI_WAVE_COLOR_LINE = 3,
|
|
X121_XKI_KI_WAVE_STATE_LINE = 21,
|
|
//
|
|
// Upper/Lower ...
|
|
X121_XKI_KI_UPPER_LINE = 4,
|
|
X121_XKI_KI_LOWER_LINE = 5,
|
|
//
|
|
// MA Fast/Slow ...
|
|
X121_XKI_MA_FAST_LINE = 6,
|
|
X121_XKI_MA_SLOW_LINE = 7,
|
|
X121_XKI_MA_SUPER_SLOW_LINE = 12,
|
|
//
|
|
// PV ...
|
|
X121_XKI_PEAK_LINE = 13,
|
|
X121_XKI_VALE_LINE = 14,
|
|
//
|
|
// ATR ...
|
|
X121_XKI_ATR_LINE = 16,
|
|
X121_XKI_ATR_SMOOTHED_LINE = 23,
|
|
X121_XKI_ATR_RAW_UPPER_LINE = 17,
|
|
X121_XKI_ATR_RAW_LOWER_LINE = 18,
|
|
//
|
|
// RSI ...
|
|
X121_XKI_RSI_LINE = 19,
|
|
};
|
|
// #endregion
|
|
|
|
// #region Inputs ...
|
|
struct X121XKIInputs
|
|
{
|
|
// #region Props ...
|
|
// #region Calculations ...
|
|
int kiFastLength; // KI Fast Length
|
|
int kiSlowLength; // KI Slow Length
|
|
int kiSuperSlowLength; // KI Super Slow Length
|
|
int maFastLength; // MA Fast Length
|
|
int maSlowLength; // MA Slow Length
|
|
int maSuperSlowLength; // MA Super Slow Length
|
|
ENUM_MA_METHOD maMethod; // MA Mode
|
|
ENUM_APPLIED_PRICE maAppliedTo; // MA Applied To
|
|
double rsiBullishConfirmation; // RSI Bullish Confirmation Level
|
|
double rsiBearishConfirmation; // RSI Bearish Confirmation Level
|
|
int rsiLength; // RSI Length
|
|
ENUM_APPLIED_PRICE rsiAppliedTo; // RSI Applied To
|
|
int kiWaveSmoothingLength; // RSI KI Wave Smoothing Length
|
|
ENUM_X_MA_METHOD kiWaveSmoothingMode; // RSI KI Wave Smoothing Method
|
|
double rsiMultiplier; // RSI Multiplier
|
|
int atrLength; // ATR Length
|
|
double atrMultiplier; // ATR Multiplier
|
|
int atrSmoothingLength; // ATR Smoothing Length
|
|
ENUM_X_MA_METHOD atrSmoothingMode; // ATR Smoothing Method
|
|
ENUM_X_PRICE atrUpperPriceType; // ATR Upper Price Type
|
|
ENUM_X_PRICE atrLowerPriceType; // ATR Lower Price Type
|
|
// #endregion
|
|
|
|
// #region Presentations ...
|
|
bool showPV; // Show PV
|
|
bool showKIFast; // Show KI
|
|
bool showKISlow; // Show KI Slow
|
|
bool showKISuperSlow; // Show KI Super Slow
|
|
bool showMaFast; // Show Ma Fast
|
|
bool showMaSlow; // Show MA Slow
|
|
bool showMaSuperSlow; // Show MA Super Slow
|
|
bool showKIWave; // Show KI Wave
|
|
bool showKIUpper; // Show KI Upper
|
|
bool showKILower; // Show KI Lower
|
|
|
|
//
|
|
int startCalculationForLastBars; // Calculate Last n Bars
|
|
|
|
//
|
|
int peakArrowCode; // Peaks Arrow Code
|
|
int valeArrowCode; // Vales Arrow Code
|
|
// #endregion
|
|
// #endregion
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
X121XKIInputs()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
// #region Tools ...
|
|
//
|
|
// Clean ...
|
|
void Clean()
|
|
{
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
//
|
|
// Default ...
|
|
void Default()
|
|
{
|
|
//
|
|
// Calculations ...
|
|
kiFastLength = 26;
|
|
kiSlowLength = 104;
|
|
kiSuperSlowLength = 208;
|
|
maFastLength = 26;
|
|
maSlowLength = 104;
|
|
maSuperSlowLength = 208;
|
|
maMethod = MODE_EMA;
|
|
maAppliedTo = PRICE_CLOSE;
|
|
rsiLength = 14;
|
|
rsiAppliedTo = PRICE_CLOSE;
|
|
rsiBullishConfirmation = 55;
|
|
rsiBearishConfirmation = 45;
|
|
kiWaveSmoothingLength = 14;
|
|
kiWaveSmoothingMode = X_MA_MODE_EMA;
|
|
rsiMultiplier = 0.5;
|
|
atrLength = 14;
|
|
atrMultiplier = 2;
|
|
atrSmoothingLength = 14;
|
|
atrSmoothingMode = X_MA_MODE_EMA;
|
|
atrUpperPriceType = X_PRICE_HIGH;
|
|
atrLowerPriceType = X_PRICE_LOW;
|
|
|
|
//
|
|
// Presentations ...
|
|
showPV = true;
|
|
showKIFast = true;
|
|
showKISlow = true;
|
|
showKISuperSlow = true;
|
|
showMaFast = true;
|
|
showMaSlow = true;
|
|
showMaSuperSlow = true;
|
|
showKIWave = true;
|
|
showKIUpper = true;
|
|
showKILower = true;
|
|
|
|
//
|
|
startCalculationForLastBars = 1500;
|
|
|
|
//
|
|
peakArrowCode = 159;
|
|
valeArrowCode = 159;
|
|
}
|
|
|
|
//
|
|
// Hide ...
|
|
void Hide()
|
|
{
|
|
//
|
|
// Presentations ...
|
|
showPV = false;
|
|
showKIFast = false;
|
|
showKISlow = false;
|
|
showKISuperSlow = false;
|
|
showMaFast = false;
|
|
showMaSlow = false;
|
|
showMaSuperSlow = false;
|
|
showKIWave = false;
|
|
showKIUpper = false;
|
|
showKILower = false;
|
|
}
|
|
|
|
//
|
|
// Validate ...
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
// KI ...
|
|
kiFastLength >= 5 &&
|
|
kiSlowLength > kiFastLength &&
|
|
kiSuperSlowLength > kiSlowLength &&
|
|
//
|
|
// MA ...
|
|
maFastLength >= 2 &&
|
|
maSlowLength > maFastLength &&
|
|
maSuperSlowLength > maSlowLength &&
|
|
//
|
|
// ATR ...
|
|
atrLength >= 5 &&
|
|
//
|
|
// RSI ...
|
|
rsiLength >= 5 &&
|
|
rsiBullishConfirmation > 0 &&
|
|
rsiBullishConfirmation < 100 &&
|
|
rsiBearishConfirmation > 0 &&
|
|
rsiBearishConfirmation < 100
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
// #endregion
|
|
};
|
|
// #endregion
|
|
|
|
// #region Conditions ...
|
|
struct X121XKIConditions
|
|
{
|
|
// #region Commons ...
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
datetime to;
|
|
datetime from;
|
|
XOHCL bars[];
|
|
// #endregion
|
|
|
|
// #region Buffers ...
|
|
double kiFastBuffer[];
|
|
double kiFastColorBuffer[];
|
|
double kiFastStateBuffer[];
|
|
double kiSlowBuffer[];
|
|
double kiSlowColorBuffer[];
|
|
double kiSlowStateBuffer[];
|
|
double kiSuperSlowBuffer[];
|
|
double kiSuperSlowColorBuffer[];
|
|
double kiSuperSlowStateBuffer[];
|
|
double kiWaveBuffer[];
|
|
double kiWaveColorBuffer[];
|
|
double kiUpperBuffer[];
|
|
double kiLowerBuffer[];
|
|
double maFastBuffer[];
|
|
double maSlowBuffer[];
|
|
double maSuperSlowBuffer[];
|
|
double peakBuffer[];
|
|
double valeBuffer[];
|
|
double atrBuffer[];
|
|
double atrSmoothedBuffer[];
|
|
double atrRawUpperBuffer[];
|
|
double atrRawLowerBuffer[];
|
|
double rsiBuffer[];
|
|
double kiWaveRawBuffer[];
|
|
double kiWaveStateBuffer[];
|
|
// #endregion
|
|
|
|
//
|
|
// Constructor ...
|
|
X121XKIConditions()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
// #region Tools ...
|
|
/**
|
|
* Cleaning Up ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
// Commons ...
|
|
to = NULL;
|
|
from = NULL;
|
|
time = NULL;
|
|
symbol = NULL;
|
|
period = NULL;
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
XClean(kiFastBuffer);
|
|
XClean(kiFastColorBuffer);
|
|
XClean(kiFastStateBuffer);
|
|
XClean(kiSlowBuffer);
|
|
XClean(kiSlowColorBuffer);
|
|
XClean(kiSlowStateBuffer);
|
|
XClean(kiSuperSlowBuffer);
|
|
XClean(kiSuperSlowColorBuffer);
|
|
XClean(kiSuperSlowStateBuffer);
|
|
XClean(kiWaveBuffer);
|
|
XClean(kiWaveColorBuffer);
|
|
XClean(kiUpperBuffer);
|
|
XClean(kiLowerBuffer);
|
|
XClean(maFastBuffer);
|
|
XClean(maSlowBuffer);
|
|
XClean(maSuperSlowBuffer);
|
|
XClean(peakBuffer);
|
|
XClean(valeBuffer);
|
|
XClean(atrBuffer);
|
|
XClean(atrSmoothedBuffer);
|
|
XClean(atrRawUpperBuffer);
|
|
XClean(atrRawLowerBuffer);
|
|
XClean(rsiBuffer);
|
|
XClean(kiWaveRawBuffer);
|
|
XClean(kiWaveStateBuffer);
|
|
|
|
//
|
|
ArraySetAsSeries(kiFastBuffer, true);
|
|
ArraySetAsSeries(kiFastColorBuffer, true);
|
|
ArraySetAsSeries(kiFastStateBuffer, true);
|
|
ArraySetAsSeries(kiSlowBuffer, true);
|
|
ArraySetAsSeries(kiSlowColorBuffer, true);
|
|
ArraySetAsSeries(kiSlowStateBuffer, true);
|
|
ArraySetAsSeries(kiSuperSlowBuffer, true);
|
|
ArraySetAsSeries(kiSuperSlowColorBuffer, true);
|
|
ArraySetAsSeries(kiSuperSlowStateBuffer, true);
|
|
ArraySetAsSeries(kiWaveBuffer, true);
|
|
ArraySetAsSeries(kiWaveColorBuffer, true);
|
|
ArraySetAsSeries(kiUpperBuffer, true);
|
|
ArraySetAsSeries(kiLowerBuffer, true);
|
|
ArraySetAsSeries(maFastBuffer, true);
|
|
ArraySetAsSeries(maSlowBuffer, true);
|
|
ArraySetAsSeries(maSuperSlowBuffer, true);
|
|
ArraySetAsSeries(peakBuffer, true);
|
|
ArraySetAsSeries(valeBuffer, true);
|
|
ArraySetAsSeries(atrBuffer, true);
|
|
ArraySetAsSeries(atrSmoothedBuffer, true);
|
|
ArraySetAsSeries(atrRawUpperBuffer, true);
|
|
ArraySetAsSeries(atrRawLowerBuffer, true);
|
|
ArraySetAsSeries(rsiBuffer, true);
|
|
ArraySetAsSeries(kiWaveRawBuffer, true);
|
|
ArraySetAsSeries(kiWaveStateBuffer, true);
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
/**
|
|
* Retrieve Unique Tag Identifier ...
|
|
*
|
|
* @return ( string )
|
|
*/
|
|
string GetTag()
|
|
{
|
|
return GetToken(this);
|
|
}
|
|
// #endregion
|
|
};
|
|
// #endregion
|
|
|
|
// #region Class ...
|
|
class XCX121XKIHelper : public XCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Constructors ...
|
|
XCX121XKIHelper()
|
|
: XCBaseHelper(_Symbol, _Period)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCX121XKIHelper()
|
|
{
|
|
}
|
|
|
|
// #region Tools ...
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
X121XKIInputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
mHandler = iCustom(
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.x121.xki",
|
|
"", // Calculation ...
|
|
mInputs.kiFastLength,
|
|
mInputs.kiSlowLength,
|
|
mInputs.kiSuperSlowLength,
|
|
mInputs.maFastLength,
|
|
mInputs.maSlowLength,
|
|
mInputs.maSuperSlowLength,
|
|
mInputs.maMethod,
|
|
mInputs.maAppliedTo,
|
|
mInputs.rsiLength,
|
|
mInputs.rsiBullishConfirmation,
|
|
mInputs.rsiBearishConfirmation,
|
|
mInputs.rsiAppliedTo,
|
|
mInputs.kiWaveSmoothingLength,
|
|
mInputs.kiWaveSmoothingMode,
|
|
mInputs.rsiMultiplier,
|
|
mInputs.atrLength,
|
|
mInputs.atrMultiplier,
|
|
mInputs.atrSmoothingLength,
|
|
mInputs.atrSmoothingMode,
|
|
mInputs.atrUpperPriceType,
|
|
mInputs.atrLowerPriceType,
|
|
"", // Presentation ...
|
|
mInputs.showPV,
|
|
mInputs.showKIFast,
|
|
mInputs.showKISlow,
|
|
mInputs.showKISuperSlow,
|
|
mInputs.showMaFast,
|
|
mInputs.showMaSlow,
|
|
mInputs.showMaSuperSlow,
|
|
mInputs.showKIWave,
|
|
mInputs.showKIUpper,
|
|
mInputs.showKILower,
|
|
mInputs.startCalculationForLastBars,
|
|
mInputs.peakArrowCode,
|
|
mInputs.valeArrowCode //
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
X121XKIInputs GetInputs()
|
|
{
|
|
return mInputs;
|
|
}
|
|
|
|
//
|
|
bool SetInputs(
|
|
X121XKIInputs &inputs // Configs
|
|
)
|
|
{
|
|
//
|
|
return Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
inputs //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool GetConditions(
|
|
X121XKIConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = true;
|
|
|
|
//
|
|
if (loopback < 5)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
conditions.Clean();
|
|
|
|
//
|
|
conditions.symbol = mSymbol;
|
|
conditions.period = mPeriod;
|
|
conditions.time = TimeCurrent();
|
|
|
|
//
|
|
// Filling Bars ...
|
|
int barsCount = GetBars(
|
|
conditions.bars,
|
|
mSymbol,
|
|
mPeriod,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
result = barsCount == loopback;
|
|
if (!result)
|
|
{
|
|
//
|
|
conditions.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
conditions.to = conditions.bars[0].time;
|
|
conditions.from = conditions.bars[ArraySize(conditions.bars) - 1].time;
|
|
|
|
//
|
|
int zIndex = barIndex;
|
|
|
|
// #region Reading Buffers ...
|
|
CopyKIFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiFastBuffer //
|
|
);
|
|
CopyKIFastColor(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiFastColorBuffer //
|
|
);
|
|
CopyKIFastState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiFastStateBuffer //
|
|
);
|
|
CopyKISlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiSlowBuffer //
|
|
);
|
|
CopyKISlowColor(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiSlowColorBuffer //
|
|
);
|
|
CopyKISlowState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiSlowStateBuffer //
|
|
);
|
|
CopyKISuperSlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiSuperSlowBuffer //
|
|
);
|
|
CopyKISuperSlowColor(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiSuperSlowColorBuffer //
|
|
);
|
|
CopyKISuperSlowState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiSuperSlowStateBuffer //
|
|
);
|
|
CopyKIWave(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiWaveBuffer //
|
|
);
|
|
CopyKIWaveRaw(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiWaveRawBuffer //
|
|
);
|
|
CopyKIWaveColor(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiWaveColorBuffer //
|
|
);
|
|
CopyKIWaveState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiWaveStateBuffer //
|
|
);
|
|
CopyKIUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiUpperBuffer //
|
|
);
|
|
CopyKILower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kiLowerBuffer //
|
|
);
|
|
CopyMAFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maFastBuffer //
|
|
);
|
|
CopyMASlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maSlowBuffer //
|
|
);
|
|
CopyMASuperSlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maSuperSlowBuffer //
|
|
);
|
|
CopyPeak(
|
|
zIndex,
|
|
loopback,
|
|
conditions.peakBuffer //
|
|
);
|
|
CopyVale(
|
|
zIndex,
|
|
loopback,
|
|
conditions.valeBuffer //
|
|
);
|
|
CopyRSI(
|
|
zIndex,
|
|
loopback,
|
|
conditions.rsiBuffer //
|
|
);
|
|
CopyATR(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrBuffer //
|
|
);
|
|
CopyATRSmoothed(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrSmoothedBuffer //
|
|
);
|
|
CopyATRRawUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrRawUpperBuffer //
|
|
);
|
|
CopyATRRawLower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrRawLowerBuffer //
|
|
);
|
|
// #endregion
|
|
|
|
//
|
|
return result;
|
|
}
|
|
// #endregion
|
|
|
|
// #region Buffer Readers ...
|
|
// #region KI Fast ...
|
|
//
|
|
double GetKIFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_FAST_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKIFast(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_FAST_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Fast Color ...
|
|
//
|
|
double GetKIFastColor(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_FAST_COLOR_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKIFastColor(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_FAST_COLOR_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Fast State ...
|
|
//
|
|
double GetKIFastState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_FAST_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKIFastState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_FAST_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Slow ...
|
|
//
|
|
double GetKISlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_SLOW_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKISlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_SLOW_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Slow Color ...
|
|
//
|
|
double GetKISlowColor(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_SLOW_COLOR_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKISlowColor(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_SLOW_COLOR_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Slow State ...
|
|
//
|
|
double GetKISlowState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_SLOW_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKISlowState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_SLOW_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Super Slow ...
|
|
//
|
|
double GetKISuperSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_SUPER_SLOW_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKISuperSlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_SUPER_SLOW_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Super Slow Color ...
|
|
//
|
|
double GetKISuperSlowColor(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_SUPER_SLOW_COLOR_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKISuperSlowColor(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_SUPER_SLOW_COLOR_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Super Slow State ...
|
|
//
|
|
double GetKISuperSlowState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_SUPER_SLOW_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKISuperSlowState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_SUPER_SLOW_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Wave ...
|
|
//
|
|
double GetKIWave(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_WAVE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKIWave(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_WAVE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Wave Raw ...
|
|
//
|
|
double GetKIWaveRaw(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_WAVE_RAW_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKIWaveRaw(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_WAVE_RAW_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Wave Color ...
|
|
//
|
|
double GetKIWaveColor(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_WAVE_COLOR_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKIWaveColor(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_WAVE_COLOR_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Wave State ...
|
|
//
|
|
double GetKIWaveState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_WAVE_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKIWaveState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_WAVE_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Upper ...
|
|
//
|
|
double GetKIUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKIUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region KI Lower ...
|
|
//
|
|
double GetKILower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_KI_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyKILower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_KI_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region MA Fast ...
|
|
//
|
|
double GetMAFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_MA_FAST_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMAFast(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_MA_FAST_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region MA Slow ...
|
|
//
|
|
double GetMASlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_MA_SLOW_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMASlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_MA_SLOW_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region MA Super Slow ...
|
|
//
|
|
double GetMASuperSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_MA_SUPER_SLOW_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMASuperSlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_MA_SUPER_SLOW_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region Peak ...
|
|
//
|
|
double GetPeak(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_PEAK_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyPeak(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_PEAK_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region Vale ...
|
|
//
|
|
double GetVale(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_VALE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyVale(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_VALE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region RSI ...
|
|
//
|
|
double GetRSI(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_RSI_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyRSI(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_RSI_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region ATR ...
|
|
//
|
|
double GetATR(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_ATR_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyATR(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_ATR_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region ATRSmoothed ...
|
|
//
|
|
double GetATRSmoothed(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_ATR_SMOOTHED_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyATRSmoothed(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_ATR_SMOOTHED_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region ATR Raw Upper...
|
|
//
|
|
double GetATRRawUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_ATR_RAW_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyATRRawUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_ATR_RAW_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
|
|
// #region ATR Raw Lower...
|
|
//
|
|
double GetATRRawLower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)X121_XKI_ATR_RAW_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyATRRawLower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)X121_XKI_ATR_RAW_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
// #endregion
|
|
// #endregion
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
X121XKIInputs mInputs; // Inputs ...
|
|
};
|
|
// #endregion |