2991 lines
64 KiB
Plaintext
2991 lines
64 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XCXFIMAHelper
|
|
// 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"
|
|
#include "../Classes/x-saherelm.x-market.pattern.class.mq5"
|
|
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
|
|
#include "../Libraries/x-saherelm.x-poi.lib.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
// Buffers ...
|
|
enum ENUM_XFIMA_BUFFERS
|
|
{
|
|
//
|
|
// Plot Buffers ...
|
|
XFIMA_MA_FAST_LINE = 0,
|
|
XFIMA_MA_FAST_COLOR_LINE = 1,
|
|
XFIMA_MA_SLOW_LINE = 2,
|
|
XFIMA_MA_SLOW_COLOR_LINE = 3,
|
|
XFIMA_SAR_LINE = 4,
|
|
XFIMA_SAR_COLOR_LINE = 5,
|
|
XFIMA_PEAK_LINE = 6,
|
|
XFIMA_VALE_LINE = 7,
|
|
XFIMA_FIBO_UPPER_LINE = 8,
|
|
XFIMA_FIBO_MIDDLE_LINE = 9,
|
|
XFIMA_FIBO_LOWER_LINE = 10,
|
|
XFIMA_ZIGZAG_LINE = 11,
|
|
XFIMA_MA_BAND_UPPER_LINE = 12,
|
|
XFIMA_MA_BAND_LOWER_LINE = 13,
|
|
XFIMA_HK_OPEN_LINE = 14,
|
|
XFIMA_HK_HIGH_LINE = 15,
|
|
XFIMA_HK_LOW_LINE = 16,
|
|
XFIMA_HK_CLOSE_LINE = 17,
|
|
XFIMA_HK_COLOR_LINE = 18,
|
|
XFIMA_HK_BAND_UPPER_LINE = 19,
|
|
XFIMA_HK_BAND_LOWER_LINE = 20,
|
|
XFIMA_PB_BAND_UPPER_LINE = 21,
|
|
XFIMA_PB_BAND_LOWER_LINE = 22,
|
|
XFIMA_ATR_BAND_UPPER_LINE = 23,
|
|
XFIMA_ATR_BAND_LOWER_LINE = 24,
|
|
XFIMA_SC_MA_LINE = 25,
|
|
XFIMA_MC_MA_LINE = 26,
|
|
XFIMA_LC_MA_LINE = 27,
|
|
XFIMA_HC_MA_LINE = 28,
|
|
//
|
|
// Data Buffers ...
|
|
XFIMA_MA_FAST_STATE_LINE = 29,
|
|
XFIMA_MA_SLOW_STATE_LINE = 30,
|
|
XFIMA_SAR_STATE_LINE = 31,
|
|
XFIMA_SC_HH_LINE = 32,
|
|
XFIMA_SC_LL_LINE = 33,
|
|
XFIMA_MC_HH_LINE = 34,
|
|
XFIMA_MC_LL_LINE = 35,
|
|
XFIMA_LC_HH_LINE = 36,
|
|
XFIMA_LC_LL_LINE = 37,
|
|
XFIMA_HC_HH_LINE = 38,
|
|
XFIMA_HC_LL_LINE = 39,
|
|
XFIMA_ZIGZAG_HIGHS_LINE = 40,
|
|
XFIMA_ZIGZAG_HIGHS_TIME_LINE = 41,
|
|
XFIMA_ZIGZAG_LOWS_LINE = 42,
|
|
XFIMA_ZIGZAG_LOWS_TIME_LINE = 43,
|
|
XFIMA_HK_RAW_OPEN_LINE = 44,
|
|
XFIMA_HK_RAW_HIGH_LINE = 45,
|
|
XFIMA_HK_RAW_LOW_LINE = 46,
|
|
XFIMA_HK_RAW_CLOSE_LINE = 47,
|
|
XFIMA_PB_BAND_RAW_UPPER_LINE = 48,
|
|
XFIMA_PB_BAND_RAW_LOWER_LINE = 49,
|
|
XFIMA_ATR_LINE = 50,
|
|
XFIMA_ATR_BAND_RAW_UPPER_LINE = 51,
|
|
XFIMA_ATR_BAND_RAW_LOWER_LINE = 52,
|
|
XFIMA_SC_MA_STATE_LINE = 53,
|
|
XFIMA_MC_MA_STATE_LINE = 54,
|
|
XFIMA_LC_MA_STATE_LINE = 55,
|
|
XFIMA_HC_MA_STATE_LINE = 56,
|
|
};
|
|
|
|
//
|
|
// Input Models ...
|
|
struct XFIMAInputs
|
|
{
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Calculation ...
|
|
ENUM_X_PERIOD_METHOD scMethod; // How to Find Short Period
|
|
ENUM_TIMEFRAMES scPeriod; // Short Period
|
|
ENUM_X_PERIOD_METHOD mcMethod; // How to Find Medium Period
|
|
ENUM_TIMEFRAMES mcPeriod; // Medium Period
|
|
ENUM_X_PERIOD_METHOD lcMethod; // How to Find Long Period
|
|
ENUM_TIMEFRAMES lcPeriod; // Long Period
|
|
ENUM_X_PERIOD_METHOD hcMethod; // How to Find Hind Period
|
|
ENUM_TIMEFRAMES hcPeriod; // Hind Period
|
|
ENUM_SERIESMODE upperMode; // Peak Method
|
|
ENUM_SERIESMODE lowerMode; // Vale Method
|
|
ENUM_X_FIBO_LEVELS fiboUpperZoneLevel; // Upper Zone Level
|
|
ENUM_X_FIBO_LEVELS fiboMiddleZoneLevel; // Upper Zone Level
|
|
ENUM_X_FIBO_LEVELS fiboLowerZoneLevel; // Lower Zone Level
|
|
double sarStep; // SAR Step
|
|
double sarMax; // SAR Maximum
|
|
ENUM_MA_METHOD maMethod; // MA Method
|
|
ENUM_APPLIED_PRICE maAppliedTo; // MA Applied To
|
|
int maFastLength; // Fast MA Length
|
|
int maSlowLength; // Slow MA Length
|
|
int maBandLength; // MA Band Length
|
|
int zigzagDepth; // ZigZag Depth
|
|
int zigzagDeviation; // ZigZag Deviation
|
|
int zigzagBackStep; // ZigZag Back Step
|
|
ENUM_X_PRICE zigzagUppersMode; // ZigZag High Detect Mode
|
|
ENUM_X_PRICE zigzagLowersMode; // ZigZag Low Detect Mode
|
|
bool hkIgnoreShadows; // HK Remove noises
|
|
int hkSmoothingLength; // HK Smoothing Length
|
|
ENUM_X_MA_METHOD hkSmoothingMode; // HK Smoothing Method
|
|
int atrLength; // ATR Length
|
|
double atrMultiplier; // ATR Band Multiplier
|
|
int atrSmoothingLength; // ATR Smoothing Length
|
|
ENUM_X_PRICE atrUpperPriceType; // ATR Upper Zone Applied To
|
|
ENUM_X_PRICE atrLowerPriceType; // ATR Lower Zone Applied To
|
|
ENUM_X_MA_METHOD atrSmoothingMode; // ATR Smoothing Method
|
|
|
|
//
|
|
// Presentation ...
|
|
bool showPV; // Show PV
|
|
bool showHK; // Show HK
|
|
bool showSAR; // Show SAR
|
|
bool showMAFast; // Show MA Fast
|
|
bool showMASlow; // Show MA Slow
|
|
bool showMABand; // Show MA Band
|
|
bool showHKBand; // Show HK Band
|
|
bool showATRBand; // Show ATR Band
|
|
bool showZigZag; // Show ZigZag
|
|
bool showCyclesMa; // Show Cycles MA
|
|
bool showFiboZone; // Show Fibo Zone
|
|
int startCalculationForLastBars; // Calculate Last n Bars
|
|
int sarArrowCode; // Parabolic SAR Arrow Code
|
|
int peakArrowCode; // Peaks Arrow Code
|
|
int valeArrowCode; // Vales Arrow Code
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
XFIMAInputs()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Clean ...
|
|
void Clean()
|
|
{
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
//
|
|
// Default ...
|
|
void Default()
|
|
{
|
|
//
|
|
// Calculations ...
|
|
scMethod = X_PERIOD_AUTO; // How to Find Short Period
|
|
scPeriod = NULL; // Short Period
|
|
mcMethod = X_PERIOD_AUTO; // How to Find Medium Period
|
|
mcPeriod = NULL; // Medium Period
|
|
lcMethod = X_PERIOD_AUTO; // How to Find Long Period
|
|
lcPeriod = NULL; // Long Period
|
|
hcMethod = X_PERIOD_AUTO; // How to Find Hind Period
|
|
hcPeriod = NULL; // Hind Period
|
|
upperMode = MODE_HIGH; // Peak Method
|
|
lowerMode = MODE_LOW; // Vale Method
|
|
fiboUpperZoneLevel = X_FIBO_LEVEL_382; // Upper Zone Level
|
|
fiboMiddleZoneLevel = X_FIBO_LEVEL_500; // Upper Zone Level
|
|
fiboLowerZoneLevel = X_FIBO_LEVEL_618; // Lower Zone Level
|
|
sarStep = 0.02; // SAR Step
|
|
sarMax = 0.2; // SAR Maximum
|
|
maMethod = MODE_EMA; // MA Method
|
|
maAppliedTo = PRICE_CLOSE; // MA Applied To
|
|
maFastLength = 7; // Fast MA Length
|
|
maSlowLength = 20; // Slow MA Length
|
|
maBandLength = 7; // MA Band Length
|
|
zigzagDepth = 12; // ZigZag Depth
|
|
zigzagDeviation = 5; // ZigZag Deviation
|
|
zigzagBackStep = 3; // ZigZag Back Step
|
|
zigzagUppersMode = X_PRICE_HIGH; // ZigZag High Detect Mode
|
|
zigzagLowersMode = X_PRICE_LOW; // ZigZag Low Detect Mode
|
|
hkIgnoreShadows = true; // HK Remove noises
|
|
hkSmoothingLength = 21; // HK Smoothing Length
|
|
hkSmoothingMode = X_MA_MODE_EMA; // HK Smoothing Method
|
|
atrLength = 14; // ATR Length
|
|
atrMultiplier = 1.5; // ATR Band Multiplier
|
|
atrSmoothingLength = 21; // ATR Smoothing Length
|
|
atrUpperPriceType = X_PRICE_HIGH; // ATR Upper Zone Applied To
|
|
atrLowerPriceType = X_PRICE_LOW; // ATR Lower Zone Applied To
|
|
atrSmoothingMode = X_MA_MODE_EMA; // ATR Smoothing Method
|
|
|
|
//
|
|
// Presentation ...
|
|
showPV = true; // Show PV
|
|
showHK = true; // Show HK
|
|
showSAR = true; // Show SAR
|
|
showMAFast = true; // Show MA Fast
|
|
showMASlow = true; // Show MA Slow
|
|
showMABand = true; // Show MA Band
|
|
showHKBand = true; // Show HK Band
|
|
showATRBand = true; // Show ATR Band
|
|
showZigZag = true; // Show ZigZag
|
|
showCyclesMa = true; // Show Cycles MA
|
|
showFiboZone = true; // Show Fibo Zone
|
|
startCalculationForLastBars = 1500; // Calculate Last n Bars
|
|
sarArrowCode = 159; // Parabolic SAR Arrow Code
|
|
peakArrowCode = 159; // Peaks Arrow Code
|
|
valeArrowCode = 159; // Vales Arrow Code
|
|
}
|
|
|
|
//
|
|
// Hide all Visible Buffers ...
|
|
void Hide()
|
|
{
|
|
//
|
|
showPV = false;
|
|
showHK = false;
|
|
showSAR = false;
|
|
showMAFast = false;
|
|
showMASlow = false;
|
|
showMABand = false;
|
|
showHKBand = false;
|
|
showATRBand = false;
|
|
showZigZag = false;
|
|
showCyclesMa = true;
|
|
showFiboZone = false;
|
|
}
|
|
|
|
//
|
|
// Validate ...
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
// MA ...
|
|
maFastLength >= 2 &&
|
|
maSlowLength >= 2 &&
|
|
maBandLength >= 2 &&
|
|
maSlowLength > maFastLength &&
|
|
//
|
|
// SAR ...
|
|
sarMax > 0 &&
|
|
sarStep > 0 &&
|
|
sarMax > sarStep &&
|
|
//
|
|
// ATR ...
|
|
atrLength > 0 &&
|
|
atrMultiplier >= 1 &&
|
|
IsXValid(atrUpperPriceType) &&
|
|
IsXValid(atrLowerPriceType) &&
|
|
//
|
|
// CYCLES ...
|
|
(IsSpecifiedValid(scMethod, scPeriod) &&
|
|
IsSpecifiedValid(mcMethod, mcPeriod) &&
|
|
IsSpecifiedValid(lcMethod, lcPeriod) &&
|
|
IsSpecifiedValid(hcMethod, hcPeriod)) &&
|
|
//
|
|
// ZIGZAG ...
|
|
zigzagDepth > 0 &&
|
|
zigzagDeviation > 0 &&
|
|
zigzagBackStep > 0 &&
|
|
//
|
|
// Validate Upper Mode Detection ...
|
|
IsXValid(zigzagUppersMode) &&
|
|
//
|
|
// Validate Lower Mode Detection ...
|
|
IsXValid(zigzagLowersMode)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Conditions ...
|
|
struct XFIMAConditions
|
|
{
|
|
//
|
|
// Common ...
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
datetime to;
|
|
datetime from;
|
|
XOHCL bars[];
|
|
|
|
//
|
|
// Buffers ...
|
|
double maFastBuffer[];
|
|
double maSlowBuffer[];
|
|
double sarBuffer[];
|
|
double peakBuffer[];
|
|
double valeBuffer[];
|
|
double fiboUpperBuffer[];
|
|
double fiboMiddleBuffer[];
|
|
double fiboLowerBuffer[];
|
|
double zigzagBuffer[];
|
|
double maBandUpperBuffer[];
|
|
double maBandLowerBuffer[];
|
|
double hkOpenBuffer[];
|
|
double hkHighBuffer[];
|
|
double hkLowBuffer[];
|
|
double hkCloseBuffer[];
|
|
double hkColorBuffer[];
|
|
double hkBandUpperBuffer[];
|
|
double hkBandLowerBuffer[];
|
|
double pbBandUpperBuffer[];
|
|
double pbBandLowerBuffer[];
|
|
double atrBandUpperBuffer[];
|
|
double atrBandLowerBuffer[];
|
|
double scMaBuffer[];
|
|
double mcMaBuffer[];
|
|
double lcMaBuffer[];
|
|
double hcMaBuffer[];
|
|
double maFastStateBuffer[];
|
|
double maSlowStateBuffer[];
|
|
double sarStateBuffer[];
|
|
double sHHBuffer[];
|
|
double sLLBuffer[];
|
|
double mHHBuffer[];
|
|
double mLLBuffer[];
|
|
double lHHBuffer[];
|
|
double lLLBuffer[];
|
|
double hHHBuffer[];
|
|
double hLLBuffer[];
|
|
double hkRawHighBuffer[];
|
|
double hkRawOpenBuffer[];
|
|
double hkRawLowBuffer[];
|
|
double hkRawCloseBuffer[];
|
|
double pbBandRawUpperBuffer[];
|
|
double pbBandRawLowerBuffer[];
|
|
double atrBuffer[];
|
|
double atrBandRawUpperBuffer[];
|
|
double atrBandRawLowerBuffer[];
|
|
double scMaStateBuffer[];
|
|
double mcMaStateBuffer[];
|
|
double lcMaStateBuffer[];
|
|
double hcMaStateBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// Constructor ...
|
|
XFIMAConditions()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Cleaning Up ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
// Commons ...
|
|
to = NULL;
|
|
from = NULL;
|
|
time = NULL;
|
|
symbol = NULL;
|
|
period = NULL;
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
XClean(bars);
|
|
|
|
//
|
|
XClean(maFastBuffer);
|
|
XClean(maSlowBuffer);
|
|
XClean(sarBuffer);
|
|
XClean(peakBuffer);
|
|
XClean(valeBuffer);
|
|
XClean(fiboUpperBuffer);
|
|
XClean(fiboMiddleBuffer);
|
|
XClean(fiboLowerBuffer);
|
|
XClean(zigzagBuffer);
|
|
XClean(maBandUpperBuffer);
|
|
XClean(maBandLowerBuffer);
|
|
XClean(hkOpenBuffer);
|
|
XClean(hkHighBuffer);
|
|
XClean(hkLowBuffer);
|
|
XClean(hkCloseBuffer);
|
|
XClean(hkColorBuffer);
|
|
XClean(hkBandUpperBuffer);
|
|
XClean(hkBandLowerBuffer);
|
|
XClean(pbBandUpperBuffer);
|
|
XClean(pbBandLowerBuffer);
|
|
XClean(atrBandUpperBuffer);
|
|
XClean(atrBandLowerBuffer);
|
|
XClean(scMaBuffer);
|
|
XClean(mcMaBuffer);
|
|
XClean(lcMaBuffer);
|
|
XClean(hcMaBuffer);
|
|
XClean(maFastStateBuffer);
|
|
XClean(maSlowStateBuffer);
|
|
XClean(sarStateBuffer);
|
|
XClean(sHHBuffer);
|
|
XClean(sLLBuffer);
|
|
XClean(mHHBuffer);
|
|
XClean(mLLBuffer);
|
|
XClean(lHHBuffer);
|
|
XClean(lLLBuffer);
|
|
XClean(hHHBuffer);
|
|
XClean(hLLBuffer);
|
|
XClean(hkRawHighBuffer);
|
|
XClean(hkRawOpenBuffer);
|
|
XClean(hkRawLowBuffer);
|
|
XClean(hkRawCloseBuffer);
|
|
XClean(pbBandRawUpperBuffer);
|
|
XClean(pbBandRawLowerBuffer);
|
|
XClean(atrBuffer);
|
|
XClean(atrBandRawUpperBuffer);
|
|
XClean(atrBandRawLowerBuffer);
|
|
XClean(scMaStateBuffer);
|
|
XClean(mcMaStateBuffer);
|
|
XClean(lcMaStateBuffer);
|
|
XClean(hcMaStateBuffer);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
ArraySetAsSeries(bars, true);
|
|
|
|
//
|
|
ArraySetAsSeries(maFastBuffer, true);
|
|
ArraySetAsSeries(maSlowBuffer, true);
|
|
ArraySetAsSeries(sarBuffer, true);
|
|
ArraySetAsSeries(peakBuffer, true);
|
|
ArraySetAsSeries(valeBuffer, true);
|
|
ArraySetAsSeries(fiboUpperBuffer, true);
|
|
ArraySetAsSeries(fiboMiddleBuffer, true);
|
|
ArraySetAsSeries(fiboLowerBuffer, true);
|
|
ArraySetAsSeries(zigzagBuffer, true);
|
|
ArraySetAsSeries(maBandUpperBuffer, true);
|
|
ArraySetAsSeries(maBandLowerBuffer, true);
|
|
ArraySetAsSeries(hkOpenBuffer, true);
|
|
ArraySetAsSeries(hkHighBuffer, true);
|
|
ArraySetAsSeries(hkLowBuffer, true);
|
|
ArraySetAsSeries(hkCloseBuffer, true);
|
|
ArraySetAsSeries(hkColorBuffer, true);
|
|
ArraySetAsSeries(hkBandUpperBuffer, true);
|
|
ArraySetAsSeries(hkBandLowerBuffer, true);
|
|
ArraySetAsSeries(pbBandUpperBuffer, true);
|
|
ArraySetAsSeries(pbBandLowerBuffer, true);
|
|
ArraySetAsSeries(atrBandUpperBuffer, true);
|
|
ArraySetAsSeries(atrBandLowerBuffer, true);
|
|
ArraySetAsSeries(scMaBuffer, true);
|
|
ArraySetAsSeries(mcMaBuffer, true);
|
|
ArraySetAsSeries(lcMaBuffer, true);
|
|
ArraySetAsSeries(hcMaBuffer, true);
|
|
ArraySetAsSeries(maFastStateBuffer, true);
|
|
ArraySetAsSeries(maSlowStateBuffer, true);
|
|
ArraySetAsSeries(sarStateBuffer, true);
|
|
ArraySetAsSeries(sHHBuffer, true);
|
|
ArraySetAsSeries(sLLBuffer, true);
|
|
ArraySetAsSeries(mHHBuffer, true);
|
|
ArraySetAsSeries(mLLBuffer, true);
|
|
ArraySetAsSeries(lHHBuffer, true);
|
|
ArraySetAsSeries(lLLBuffer, true);
|
|
ArraySetAsSeries(hHHBuffer, true);
|
|
ArraySetAsSeries(hLLBuffer, true);
|
|
ArraySetAsSeries(hkRawHighBuffer, true);
|
|
ArraySetAsSeries(hkRawOpenBuffer, true);
|
|
ArraySetAsSeries(hkRawLowBuffer, true);
|
|
ArraySetAsSeries(hkRawCloseBuffer, true);
|
|
ArraySetAsSeries(pbBandRawUpperBuffer, true);
|
|
ArraySetAsSeries(pbBandRawLowerBuffer, true);
|
|
ArraySetAsSeries(atrBuffer, true);
|
|
ArraySetAsSeries(atrBandRawUpperBuffer, true);
|
|
ArraySetAsSeries(atrBandRawLowerBuffer, true);
|
|
ArraySetAsSeries(scMaStateBuffer, true);
|
|
ArraySetAsSeries(mcMaStateBuffer, true);
|
|
ArraySetAsSeries(lcMaStateBuffer, true);
|
|
ArraySetAsSeries(hcMaStateBuffer, true);
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
/**
|
|
* Generate Conditions Scores ...
|
|
*
|
|
* @param bullishScore: Double, Directional Scores Reference ...
|
|
* @param bearishScore: Double, Directional Scores Reference ...
|
|
*/
|
|
void GenerateScore(
|
|
double &bullishScore,
|
|
double &bearishScore //
|
|
)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Generate Summary String for Represent Conditions State ...
|
|
*
|
|
* @param onlyCommons: Boolean, Just Generate Only Commons Conditions ...
|
|
* @param onlyConditions: Boolean, Just Generate Only Conditions ...
|
|
* @param includeScores: Boolean, Attach Scores Representations on Result ...
|
|
* @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ...
|
|
* @param separator: String, Separate Lines ...
|
|
*
|
|
* @return ( string )
|
|
*/
|
|
string GenerateSummary(
|
|
bool onlyCommons = false,
|
|
bool onlyConditions = false,
|
|
bool includeScores = true,
|
|
bool ignoreFalseConditions = true,
|
|
string separator = "\n" //
|
|
)
|
|
{
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* Retrieve Unique Tag Identifier ...
|
|
*
|
|
* @return ( string )
|
|
*/
|
|
string GetTag()
|
|
{
|
|
return GetToken(this);
|
|
}
|
|
};
|
|
|
|
//
|
|
// Class ...
|
|
class XCXFIMAHelper : public XCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
XCMarketPatternDetector *patternDetector;
|
|
|
|
//
|
|
// Constructors ...
|
|
XCXFIMAHelper()
|
|
: XCBaseHelper(_Symbol, _Period)
|
|
{
|
|
patternDetector = new XCMarketPatternDetector();
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCXFIMAHelper()
|
|
{
|
|
//
|
|
delete patternDetector;
|
|
ZeroMemory(patternDetector);
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Initialize Helper Cleass ...
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
XFIMAInputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
mHandler = iCustom(
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.xfima",
|
|
"", // Calculation ...
|
|
mInputs.scMethod,
|
|
mInputs.scPeriod,
|
|
mInputs.mcMethod,
|
|
mInputs.mcPeriod,
|
|
mInputs.lcMethod,
|
|
mInputs.lcPeriod,
|
|
mInputs.hcMethod,
|
|
mInputs.hcPeriod,
|
|
mInputs.upperMode,
|
|
mInputs.lowerMode,
|
|
mInputs.fiboUpperZoneLevel,
|
|
mInputs.fiboMiddleZoneLevel,
|
|
mInputs.fiboLowerZoneLevel,
|
|
mInputs.sarStep,
|
|
mInputs.sarMax,
|
|
mInputs.maMethod,
|
|
mInputs.maAppliedTo,
|
|
mInputs.maFastLength,
|
|
mInputs.maSlowLength,
|
|
mInputs.maBandLength,
|
|
mInputs.zigzagDepth,
|
|
mInputs.zigzagDeviation,
|
|
mInputs.zigzagBackStep,
|
|
mInputs.zigzagUppersMode,
|
|
mInputs.zigzagLowersMode,
|
|
mInputs.hkIgnoreShadows,
|
|
mInputs.hkSmoothingLength,
|
|
mInputs.hkSmoothingMode,
|
|
mInputs.atrLength,
|
|
mInputs.atrMultiplier,
|
|
mInputs.atrSmoothingLength,
|
|
mInputs.atrUpperPriceType,
|
|
mInputs.atrLowerPriceType,
|
|
mInputs.atrSmoothingMode,
|
|
"", // Presentation ...
|
|
mInputs.showPV,
|
|
mInputs.showHK,
|
|
mInputs.showSAR,
|
|
mInputs.showMAFast,
|
|
mInputs.showMASlow,
|
|
mInputs.showMABand,
|
|
mInputs.showHKBand,
|
|
mInputs.showATRBand,
|
|
mInputs.showZigZag,
|
|
mInputs.showFiboZone,
|
|
mInputs.startCalculationForLastBars,
|
|
mInputs.sarArrowCode,
|
|
mInputs.peakArrowCode,
|
|
mInputs.valeArrowCode
|
|
//
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
XFIMAInputs GetInputs()
|
|
{
|
|
return mInputs;
|
|
}
|
|
|
|
//
|
|
bool SetInputs(
|
|
XFIMAInputs &inputs // Configs
|
|
)
|
|
{
|
|
//
|
|
return Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
inputs //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
bool GetConditions(
|
|
XFIMAConditions &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;
|
|
}
|
|
|
|
//
|
|
int zIDX = 0;
|
|
int cIDX = 1;
|
|
int pIDX = cIDX + 1;
|
|
int p2IDX = pIDX + 1;
|
|
int p3IDX = p2IDX + 1;
|
|
int p4IDX = p3IDX + 1;
|
|
|
|
//
|
|
conditions.to = conditions.bars[0].time;
|
|
conditions.from = conditions.bars[ArraySize(conditions.bars) - 1].time;
|
|
|
|
//
|
|
int zIndex = barIndex;
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
CopyMAFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maFastBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMAFastState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maFastStateBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMASlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maSlowBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMASlowState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maSlowStateBuffer //
|
|
);
|
|
|
|
//
|
|
CopySCMA(
|
|
zIndex,
|
|
loopback,
|
|
conditions.scMaBuffer //
|
|
);
|
|
|
|
//
|
|
CopySCMAState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.scMaStateBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMCMA(
|
|
zIndex,
|
|
loopback,
|
|
conditions.mcMaBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMCMAState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.mcMaStateBuffer //
|
|
);
|
|
|
|
//
|
|
CopyLCMA(
|
|
zIndex,
|
|
loopback,
|
|
conditions.lcMaBuffer //
|
|
);
|
|
|
|
//
|
|
CopyLCMAState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.lcMaStateBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHCMA(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hcMaBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHCMAState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hcMaStateBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMABandUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maBandUpperBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMABandLower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.maBandLowerBuffer //
|
|
);
|
|
|
|
//
|
|
CopySAR(
|
|
zIndex,
|
|
loopback,
|
|
conditions.sarBuffer //
|
|
);
|
|
|
|
//
|
|
CopySARState(
|
|
zIndex,
|
|
loopback,
|
|
conditions.sarStateBuffer //
|
|
);
|
|
|
|
//
|
|
CopyPeak(
|
|
zIndex,
|
|
loopback,
|
|
conditions.peakBuffer //
|
|
);
|
|
|
|
//
|
|
CopyVale(
|
|
zIndex,
|
|
loopback,
|
|
conditions.valeBuffer //
|
|
);
|
|
|
|
//
|
|
CopyFiboUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.fiboUpperBuffer //
|
|
);
|
|
|
|
//
|
|
CopyFiboMiddle(
|
|
zIndex,
|
|
loopback,
|
|
conditions.fiboMiddleBuffer //
|
|
);
|
|
|
|
//
|
|
CopyFiboLower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.fiboLowerBuffer //
|
|
);
|
|
|
|
//
|
|
CopyZigZag(
|
|
zIndex,
|
|
loopback,
|
|
conditions.zigzagBuffer //
|
|
);
|
|
|
|
//
|
|
CopySHH(
|
|
zIndex,
|
|
loopback,
|
|
conditions.sHHBuffer //
|
|
);
|
|
|
|
//
|
|
CopySLL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.sLLBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMHH(
|
|
zIndex,
|
|
loopback,
|
|
conditions.mHHBuffer //
|
|
);
|
|
|
|
//
|
|
CopyMLL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.mLLBuffer //
|
|
);
|
|
|
|
//
|
|
CopyLHH(
|
|
zIndex,
|
|
loopback,
|
|
conditions.lHHBuffer //
|
|
);
|
|
|
|
//
|
|
CopyLLL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.lLLBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHHH(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hHHBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHLL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hLLBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKOpen(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkOpenBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKHigh(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkHighBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKLow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkLowBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKClose(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkCloseBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKRawOpen(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkRawOpenBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKRawHigh(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkRawHighBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKRawLow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkRawLowBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKRawClose(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkRawCloseBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKColor(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkColorBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKBandUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkBandUpperBuffer //
|
|
);
|
|
|
|
//
|
|
CopyHKBandLower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hkBandLowerBuffer //
|
|
);
|
|
|
|
//
|
|
CopyPBBandUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.pbBandUpperBuffer //
|
|
);
|
|
|
|
//
|
|
CopyPBBandLower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.pbBandLowerBuffer //
|
|
);
|
|
|
|
//
|
|
CopyPBRawBandUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.pbBandRawUpperBuffer //
|
|
);
|
|
|
|
//
|
|
CopyPBRawBandLower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.pbBandRawLowerBuffer //
|
|
);
|
|
|
|
//
|
|
CopyATRBandUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrBandUpperBuffer //
|
|
);
|
|
|
|
//
|
|
CopyATRBandLower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrBandLowerBuffer //
|
|
);
|
|
|
|
//
|
|
CopyATR(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrBuffer //
|
|
);
|
|
|
|
//
|
|
CopyATRRawBandUpper(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrBandRawUpperBuffer //
|
|
);
|
|
|
|
//
|
|
CopyATRRawBandLower(
|
|
zIndex,
|
|
loopback,
|
|
conditions.atrBandRawLowerBuffer //
|
|
);
|
|
|
|
//
|
|
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Fast MA ...
|
|
|
|
//
|
|
double GetMAFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_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)XFIMA_MA_FAST_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Fast MA State ...
|
|
|
|
//
|
|
double GetMAFastState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_MA_FAST_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMAFastState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_MA_FAST_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Slow MA ...
|
|
|
|
//
|
|
double GetMASlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_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)XFIMA_MA_SLOW_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Slow MA State ...
|
|
|
|
//
|
|
double GetMASlowState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_MA_SLOW_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMASlowState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_MA_SLOW_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Upper MA ...
|
|
|
|
//
|
|
double GetMABandUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_MA_BAND_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMABandUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_MA_BAND_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Lower MA ...
|
|
|
|
//
|
|
double GetMABandLower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_MA_BAND_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMABandLower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_MA_BAND_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XPB ...
|
|
|
|
//
|
|
// Upper PB ...
|
|
|
|
//
|
|
double GetPBBandUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_PB_BAND_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyPBBandUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_PB_BAND_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Lower PB ...
|
|
|
|
//
|
|
double GetPBBandLower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_PB_BAND_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyPBBandLower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_PB_BAND_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Upper PB ...
|
|
|
|
//
|
|
double GetPBRawBandUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_PB_BAND_RAW_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyPBRawBandUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_PB_BAND_RAW_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Lower PB ...
|
|
|
|
//
|
|
double GetPBRawBandLower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_PB_BAND_RAW_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyPBRawBandLower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_PB_BAND_RAW_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XATR ...
|
|
|
|
//
|
|
// Upper ATR ...
|
|
|
|
//
|
|
double GetATRBandUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_ATR_BAND_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyATRBandUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_ATR_BAND_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Lower ATR ...
|
|
|
|
//
|
|
double GetATRBandLower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_ATR_BAND_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyATRBandLower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_ATR_BAND_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// ATR ...
|
|
|
|
//
|
|
double GetATR(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_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)XFIMA_ATR_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Upper ATR ...
|
|
|
|
//
|
|
double GetATRRawBandUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_ATR_BAND_RAW_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyATRRawBandUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_ATR_BAND_RAW_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Lower ATR ...
|
|
|
|
//
|
|
double GetATRRawBandLower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_ATR_BAND_RAW_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyATRRawBandLower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_ATR_BAND_RAW_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// SAR ...
|
|
|
|
//
|
|
double GetSAR(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_SAR_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopySAR(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_SAR_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// SAR State ...
|
|
|
|
//
|
|
double GetSARState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_SAR_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopySARState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_SAR_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// PEAK ...
|
|
|
|
//
|
|
double GetPeak(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_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)XFIMA_PEAK_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// VALE ...
|
|
|
|
//
|
|
double GetVale(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_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)XFIMA_VALE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// FIBO Zone ...
|
|
|
|
//
|
|
// FIBO Upper ...
|
|
|
|
//
|
|
double GetFiboUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_FIBO_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyFiboUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_FIBO_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// FIBO Middle ...
|
|
|
|
//
|
|
double GetFiboMiddle(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_FIBO_MIDDLE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyFiboMiddle(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_FIBO_MIDDLE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// FIBO Lower ...
|
|
|
|
//
|
|
double GetFiboLower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_FIBO_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyFiboLower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_FIBO_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// ZigZag ...
|
|
|
|
//
|
|
double GetZigZag(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_ZIGZAG_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyZigZag(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_ZIGZAG_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// CYCLES Range ...
|
|
|
|
//
|
|
// MAs ...
|
|
|
|
//
|
|
// SC MA ...
|
|
|
|
//
|
|
double GetSCMA(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_SC_MA_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopySCMA(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_SC_MA_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// SC MA State ...
|
|
|
|
//
|
|
double GetSCMAState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_SC_MA_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopySCMAState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_SC_MA_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// MC MA ...
|
|
|
|
//
|
|
double GetMCMA(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_MC_MA_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMCMA(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_MC_MA_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// MC MA State ...
|
|
|
|
//
|
|
double GetMCMAState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_MC_MA_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMCMAState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_MC_MA_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// LC MA ...
|
|
|
|
//
|
|
double GetLCMA(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_LC_MA_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyLCMA(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_LC_MA_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// LC MA State ...
|
|
|
|
//
|
|
double GetLCMAState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_LC_MA_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyLCMAState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_LC_MA_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// HC MA ...
|
|
|
|
//
|
|
double GetHCMA(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HC_MA_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHCMA(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HC_MA_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// HC MA State ...
|
|
|
|
//
|
|
double GetHCMAState(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HC_MA_STATE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHCMAState(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HC_MA_STATE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// SHORT ...
|
|
|
|
//
|
|
// HH ...
|
|
|
|
//
|
|
double GetSHH(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_SC_HH_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopySHH(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_SC_HH_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// LL ...
|
|
|
|
//
|
|
double GetSLL(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_SC_LL_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopySLL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_SC_LL_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// MEDIUM ...
|
|
|
|
//
|
|
// HH ...
|
|
|
|
//
|
|
double GetMHH(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_MC_HH_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMHH(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_MC_HH_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// LL ...
|
|
|
|
//
|
|
double GetMLL(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_MC_LL_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyMLL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_MC_LL_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// LONG ...
|
|
|
|
//
|
|
// HH ...
|
|
|
|
//
|
|
double GetLHH(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_LC_HH_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyLHH(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_LC_HH_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// LL ...
|
|
|
|
//
|
|
double GetLLL(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_LC_LL_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyLLL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_LC_LL_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// HIND ...
|
|
|
|
//
|
|
// HH ...
|
|
|
|
//
|
|
double GetHHH(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HC_HH_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHHH(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HC_HH_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// LL ...
|
|
|
|
//
|
|
double GetHLL(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HC_LL_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHLL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HC_LL_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK ...
|
|
|
|
//
|
|
// XHK Open ...
|
|
|
|
//
|
|
double GetHKOpen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_OPEN_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKOpen(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_OPEN_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK High ...
|
|
|
|
//
|
|
double GetHKHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_HIGH_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKHigh(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_HIGH_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Low ...
|
|
|
|
//
|
|
double GetHKLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_LOW_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKLow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_LOW_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Close ...
|
|
|
|
//
|
|
double GetHKClose(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_CLOSE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKClose(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_CLOSE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Color ...
|
|
|
|
//
|
|
double GetHKColor(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_COLOR_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKColor(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_COLOR_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Raw ...
|
|
|
|
//
|
|
// XHK Raw Open ...
|
|
|
|
//
|
|
double GetHKRawOpen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_RAW_OPEN_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKRawOpen(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_RAW_OPEN_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Raw High ...
|
|
|
|
//
|
|
double GetHKRawHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_RAW_HIGH_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKRawHigh(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_RAW_HIGH_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Raw Low ...
|
|
|
|
//
|
|
double GetHKRawLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_RAW_LOW_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKRawLow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_RAW_LOW_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Raw Close ...
|
|
|
|
//
|
|
double GetHKRawClose(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_RAW_CLOSE_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKRawClose(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_RAW_CLOSE_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Band ...
|
|
|
|
//
|
|
// XHK Band Upper ...
|
|
|
|
//
|
|
double GetHKBandUpper(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_BAND_UPPER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKBandUpper(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_BAND_UPPER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// XHK Band Lower ...
|
|
|
|
//
|
|
double GetHKBandLower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
return ReadValue(
|
|
(int)XFIMA_HK_BAND_LOWER_LINE,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
int CopyHKBandLower(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool asSeries = true // As Series Flag
|
|
)
|
|
{
|
|
//
|
|
return ReadValues(
|
|
buffer,
|
|
(int)XFIMA_HK_BAND_LOWER_LINE,
|
|
start,
|
|
count,
|
|
asSeries //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
XFIMAInputs mInputs; // Inputs ...
|
|
|
|
//
|
|
// XHK Helper ...
|
|
|
|
/**
|
|
* Validate HK Zone ...
|
|
*
|
|
* @param zone: XBoxZone, reference to Specified Zone ...
|
|
* @param validationLength: int, Validation Length of Zones ...
|
|
* @param breakValidLength: int, Break Validation Length of Zones ...
|
|
* @param validateFakeBreakes: bool, Validation Fake Breaked Zones ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool ValidateHKZone(
|
|
XBoxZone &zone,
|
|
int validationLength = 1,
|
|
int breakValidLength = 3,
|
|
bool validateFakeBreakes = true //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Normalize ...
|
|
validationLength = NormalizeInt(validationLength, 1);
|
|
breakValidLength = NormalizeInt(breakValidLength, 2);
|
|
|
|
//
|
|
// Validate ...
|
|
result = zone.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Requirements ...
|
|
double low = EMPTY_VALUE;
|
|
double open = EMPTY_VALUE;
|
|
double high = EMPTY_VALUE;
|
|
double close = EMPTY_VALUE;
|
|
|
|
//
|
|
int count = 0;
|
|
int start = zone.FromIndex() + 1;
|
|
int end = start + validationLength;
|
|
|
|
//
|
|
// Validate Before ...
|
|
for (int i = start; i < end; i++)
|
|
{
|
|
//
|
|
// Reading HK ...
|
|
low = GetHKLow(i);
|
|
high = GetHKHigh(i);
|
|
result =
|
|
NotEmptyZero(low) &&
|
|
NotEmptyZero(high);
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
result = zone.IsBullish()
|
|
? low > zone.lower
|
|
: high < zone.upper;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Validating After ...
|
|
if (result)
|
|
{
|
|
//
|
|
start = zone.ToIndex() + 1;
|
|
count = zone.FromIndex() - start;
|
|
end = start + count;
|
|
for (int i = start; i < end; i++)
|
|
{
|
|
//
|
|
// Read HK ...
|
|
low = GetHKLow(i);
|
|
high = GetHKHigh(i);
|
|
result =
|
|
NotEmptyZero(low) &&
|
|
NotEmptyZero(high);
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
result = zone.IsBullish()
|
|
? low > zone.lower
|
|
: high < zone.upper;
|
|
if (!result)
|
|
{
|
|
//
|
|
// Check For Fake Breake ...
|
|
if (validateFakeBreakes && breakValidLength > 0)
|
|
{
|
|
//
|
|
result = i - 1 >= 0;
|
|
if (result)
|
|
{
|
|
//
|
|
for (int j = i - 1; j >= zone.ToIndex(); j--)
|
|
{
|
|
//
|
|
// Reading HK ...
|
|
close = GetHKClose(j);
|
|
result = NotEmptyZero(close);
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
result = zone.IsBullish()
|
|
? close > zone.upper
|
|
: close < zone.lower;
|
|
if (result)
|
|
{
|
|
//
|
|
result = MathAbs(j - i) <= breakValidLength;
|
|
if (result)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Cleanup Resource ...
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
// |