5980 lines
116 KiB
Plaintext
5980 lines
116 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XSCXCHHKHelper
|
|
// 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_XCHHK_BUFFERS
|
|
{
|
|
//
|
|
// Current ...
|
|
XCHHK_CO_LINE = 0,
|
|
XCHHK_CH_LINE = 1,
|
|
XCHHK_CL_LINE = 2,
|
|
XCHHK_CC_LINE = 3,
|
|
//
|
|
// Short ...
|
|
XCHHK_SO_LINE = 5,
|
|
XCHHK_SH_LINE = 6,
|
|
XCHHK_SL_LINE = 7,
|
|
XCHHK_SC_LINE = 8,
|
|
//
|
|
// Medium ...
|
|
XCHHK_MO_LINE = 10,
|
|
XCHHK_MH_LINE = 11,
|
|
XCHHK_ML_LINE = 12,
|
|
XCHHK_MC_LINE = 13,
|
|
//
|
|
// Long ...
|
|
XCHHK_LO_LINE = 15,
|
|
XCHHK_LH_LINE = 16,
|
|
XCHHK_LL_LINE = 17,
|
|
XCHHK_LC_LINE = 18,
|
|
//
|
|
// Hind ...
|
|
XCHHK_HO_LINE = 20,
|
|
XCHHK_HH_LINE = 21,
|
|
XCHHK_HL_LINE = 22,
|
|
XCHHK_HC_LINE = 23,
|
|
};
|
|
|
|
//
|
|
// Input Models ...
|
|
struct XCHHKInputs
|
|
{
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Market ...
|
|
int cSmoothingLength; // Smoothing Length
|
|
|
|
//
|
|
// Cycles ...
|
|
|
|
//
|
|
// Short ...
|
|
ENUM_X_PERIOD_METHOD scMethod; // How to Find Period
|
|
ENUM_TIMEFRAMES scPeriod; // Time Period
|
|
|
|
//
|
|
// Medium ...
|
|
ENUM_X_PERIOD_METHOD mcMethod; // How to Find Period
|
|
ENUM_TIMEFRAMES mcPeriod; // Time Period
|
|
|
|
//
|
|
// Long ...
|
|
ENUM_X_PERIOD_METHOD lcMethod; // How to Find Period
|
|
ENUM_TIMEFRAMES lcPeriod; // Time Period
|
|
|
|
//
|
|
// Hind ...
|
|
ENUM_X_PERIOD_METHOD hcMethod; // How to Find Period
|
|
ENUM_TIMEFRAMES hcPeriod; // Time Period
|
|
|
|
//
|
|
// Presentation ...
|
|
bool ignoreShadows; // Ignore Bar Shadows
|
|
bool showCurrent; // Show Current Cycle
|
|
bool showShort; // Show Short Cycle
|
|
bool showMedium; // Show Medium Cycle
|
|
bool showLong; // Show Long Cycle
|
|
bool showHind; // Show Hind Cycle
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
XCHHKInputs()
|
|
{
|
|
//
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Clean ...
|
|
void Clean()
|
|
{
|
|
//
|
|
cSmoothingLength = 0;
|
|
|
|
//
|
|
scMethod = X_PERIOD_AUTO;
|
|
scPeriod = NULL;
|
|
mcMethod = X_PERIOD_AUTO;
|
|
mcPeriod = NULL;
|
|
lcMethod = X_PERIOD_AUTO;
|
|
lcPeriod = NULL;
|
|
hcMethod = X_PERIOD_AUTO;
|
|
hcPeriod = NULL;
|
|
|
|
//
|
|
ignoreShadows = false;
|
|
showCurrent = false;
|
|
showShort = false;
|
|
showMedium = false;
|
|
showLong = false;
|
|
showHind = false;
|
|
}
|
|
|
|
//
|
|
// Default ...
|
|
void Default()
|
|
{
|
|
//
|
|
cSmoothingLength = 14;
|
|
|
|
//
|
|
scMethod = X_PERIOD_AUTO;
|
|
scPeriod = NULL;
|
|
mcMethod = X_PERIOD_AUTO;
|
|
mcPeriod = NULL;
|
|
lcMethod = X_PERIOD_AUTO;
|
|
lcPeriod = NULL;
|
|
hcMethod = X_PERIOD_AUTO;
|
|
hcPeriod = NULL;
|
|
|
|
//
|
|
ignoreShadows = false;
|
|
showCurrent = true;
|
|
showShort = true;
|
|
showMedium = true;
|
|
showLong = true;
|
|
showHind = true;
|
|
}
|
|
|
|
//
|
|
// Validate ...
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
cSmoothingLength > 2 &&
|
|
//
|
|
(IsValid(scMethod, scPeriod) &&
|
|
IsValid(mcMethod, mcPeriod) &&
|
|
IsValid(lcMethod, lcPeriod) &&
|
|
IsValid(hcMethod, hcPeriod))
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Retrieve MAx Length ...
|
|
int Max()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
result =
|
|
//
|
|
MathMax(0, cSmoothingLength)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Define Conditions ...
|
|
struct XCHHKConditions
|
|
{
|
|
//
|
|
// Common ...
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Current ...
|
|
XOHCL cBars[];
|
|
|
|
//
|
|
// Short ...
|
|
XOHCL sBars[];
|
|
|
|
//
|
|
// Medium ...
|
|
XOHCL mBars[];
|
|
|
|
//
|
|
// Long ...
|
|
XOHCL lBars[];
|
|
|
|
//
|
|
// Hind ...
|
|
XOHCL hBars[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// Power ...
|
|
bool hasBullishPower;
|
|
bool hasBearishPower;
|
|
bool isBullishPowerUp;
|
|
bool isBearishPowerUp;
|
|
bool isBullishPowerIncreasing;
|
|
bool isBullishPowerDecreasing;
|
|
bool isBearishPowerIncreasing;
|
|
bool isBearishPowerDecreasing;
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
bool isCBullish;
|
|
bool isCSwitchedToBullish;
|
|
bool isCBearish;
|
|
bool isCSwitchedToBearish;
|
|
|
|
//
|
|
bool isCloseOverCHigh;
|
|
bool isCloseUnderCLow;
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
bool isSBullish;
|
|
bool isSSwitchedToBullish;
|
|
bool isSBearish;
|
|
bool isSSwitchedToBearish;
|
|
|
|
//
|
|
bool isCloseOverSHigh;
|
|
bool isCloseUnderSLow;
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
bool isMBullish;
|
|
bool isMSwitchedToBullish;
|
|
bool isMBearish;
|
|
bool isMSwitchedToBearish;
|
|
|
|
//
|
|
bool isCloseOverMHigh;
|
|
bool isCloseUnderMLow;
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
bool isLBullish;
|
|
bool isLSwitchedToBullish;
|
|
bool isLBearish;
|
|
bool isLSwitchedToBearish;
|
|
|
|
//
|
|
bool isCloseOverLHigh;
|
|
bool isCloseUnderLLow;
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
bool isHBullish;
|
|
bool isHSwitchedToBullish;
|
|
bool isHBearish;
|
|
bool isHSwitchedToBearish;
|
|
|
|
//
|
|
bool isCloseOverHHigh;
|
|
bool isCloseUnderHLow;
|
|
|
|
//
|
|
void Clean()
|
|
{
|
|
//
|
|
Clean(cBars);
|
|
Clean(sBars);
|
|
Clean(mBars);
|
|
Clean(lBars);
|
|
Clean(hBars);
|
|
|
|
//
|
|
ArraySetAsSeries(cBars, true);
|
|
ArraySetAsSeries(sBars, true);
|
|
ArraySetAsSeries(mBars, true);
|
|
ArraySetAsSeries(lBars, true);
|
|
ArraySetAsSeries(hBars, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// Power ...
|
|
hasBullishPower = false;
|
|
hasBearishPower = false;
|
|
isBullishPowerUp = false;
|
|
isBearishPowerUp = false;
|
|
isBullishPowerIncreasing = false;
|
|
isBullishPowerDecreasing = false;
|
|
isBearishPowerIncreasing = false;
|
|
isBearishPowerDecreasing = false;
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
isCBullish = false;
|
|
isCSwitchedToBullish = false;
|
|
isCBearish = false;
|
|
isCSwitchedToBearish = false;
|
|
|
|
//
|
|
isCloseOverCHigh = false;
|
|
isCloseUnderCLow = false;
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
isSBullish = false;
|
|
isSSwitchedToBullish = false;
|
|
isSBearish = false;
|
|
isSSwitchedToBearish = false;
|
|
|
|
//
|
|
isCloseOverSHigh = false;
|
|
isCloseUnderSLow = false;
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
isMBullish = false;
|
|
isMSwitchedToBullish = false;
|
|
isMBearish = false;
|
|
isMSwitchedToBearish = false;
|
|
|
|
//
|
|
isCloseOverMHigh = false;
|
|
isCloseUnderMLow = false;
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
isLBullish = false;
|
|
isLSwitchedToBullish = false;
|
|
isLBearish = false;
|
|
isLSwitchedToBearish = false;
|
|
|
|
//
|
|
isCloseOverLHigh = false;
|
|
isCloseUnderLLow = false;
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
isHBullish = false;
|
|
isHSwitchedToBullish = false;
|
|
isHBearish = false;
|
|
isHSwitchedToBearish = false;
|
|
|
|
//
|
|
isCloseOverHHigh = false;
|
|
isCloseUnderHLow = false;
|
|
}
|
|
|
|
//
|
|
void GenerateScore(
|
|
double &bullishScore,
|
|
double &bearishScore //
|
|
)
|
|
{
|
|
//
|
|
bullishScore = 0;
|
|
bearishScore = 0;
|
|
|
|
//
|
|
// Since We have to Use this
|
|
// Only for Filtering Signals ...
|
|
// We Can Ignore Scoring ...
|
|
// or Complete this later ...
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// Power ...
|
|
if (hasBullishPower)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (hasBearishPower)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isBullishPowerUp)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isBearishPowerUp)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isBullishPowerIncreasing)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isBullishPowerDecreasing)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isBearishPowerIncreasing)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isBearishPowerDecreasing)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
|
|
//
|
|
// Current ...
|
|
if (isCBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isCSwitchedToBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isCBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isCSwitchedToBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isCloseOverCHigh)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isCloseUnderCLow)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
if (isSBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isSSwitchedToBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isSBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isSSwitchedToBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isCloseOverSHigh)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isCloseUnderSLow)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
if (isMBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isMSwitchedToBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isMBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isMSwitchedToBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isCloseOverMHigh)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isCloseUnderMLow)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
if (isLBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isLSwitchedToBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isLBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isLSwitchedToBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isCloseOverLHigh)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isCloseUnderLLow)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
if (isHBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isHSwitchedToBullish)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isHBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isHSwitchedToBearish)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isCloseOverHHigh)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isCloseUnderHLow)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
}
|
|
|
|
//
|
|
string GenerateSummary(
|
|
bool onlyCommons = false,
|
|
bool onlyConditions = false,
|
|
bool includeScores = true,
|
|
bool ignoreFalseConditions = true,
|
|
string separator = "\n" //
|
|
)
|
|
{
|
|
//
|
|
string result = NULL;
|
|
|
|
//
|
|
double bullishScore = 0;
|
|
double bearishScore = 0;
|
|
GenerateScore(
|
|
bullishScore,
|
|
bearishScore //
|
|
);
|
|
|
|
//
|
|
string scoresStr =
|
|
//
|
|
"Scores: " + separator +
|
|
"---------------" + separator +
|
|
"Bullish: " + ToString(bullishScore) + separator +
|
|
"Bearish: " + ToString(bearishScore) + separator +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
string commonStr = GenerateSpecifiedCommonSummary(
|
|
this,
|
|
separator,
|
|
includeScores //
|
|
);
|
|
|
|
//
|
|
string conditionsStr =
|
|
//
|
|
// Power ...
|
|
ToString("hasBullishPower", hasBullishPower, ignoreFalseConditions, separator) +
|
|
ToString("hasBearishPower", hasBearishPower, ignoreFalseConditions, separator) +
|
|
ToString("isBullishPowerUp", isBullishPowerUp, ignoreFalseConditions, separator) +
|
|
ToString("isBearishPowerUp", isBearishPowerUp, ignoreFalseConditions, separator) +
|
|
ToString("isBullishPowerIncreasing", isBullishPowerIncreasing, ignoreFalseConditions, separator) +
|
|
ToString("isBullishPowerDecreasing", isBullishPowerDecreasing, ignoreFalseConditions, separator) +
|
|
ToString("isBearishPowerIncreasing", isBearishPowerIncreasing, ignoreFalseConditions, separator) +
|
|
ToString("isBearishPowerDecreasing", isBearishPowerDecreasing, ignoreFalseConditions, separator) +
|
|
//
|
|
// Current ...
|
|
ToString("isCBullish", isCBullish, ignoreFalseConditions, separator) +
|
|
ToString("isCSwitchedToBullish", isCSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isCBearish", isCBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCSwitchedToBearish", isCSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverCHigh", isCloseOverCHigh, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderCLow", isCloseUnderCLow, ignoreFalseConditions, separator) +
|
|
//
|
|
// Short ...
|
|
ToString("isSBullish", isSBullish, ignoreFalseConditions, separator) +
|
|
ToString("isSSwitchedToBullish", isSSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isSBearish", isSBearish, ignoreFalseConditions, separator) +
|
|
ToString("isSSwitchedToBearish", isSSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverSHigh", isCloseOverSHigh, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderSLow", isCloseUnderSLow, ignoreFalseConditions, separator) +
|
|
//
|
|
// Medium ...
|
|
ToString("isMBullish", isMBullish, ignoreFalseConditions, separator) +
|
|
ToString("isMSwitchedToBullish", isMSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isMBearish", isMBearish, ignoreFalseConditions, separator) +
|
|
ToString("isMSwitchedToBearish", isMSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverMHigh", isCloseOverMHigh, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderMLow", isCloseUnderMLow, ignoreFalseConditions, separator) +
|
|
//
|
|
// Long ...
|
|
ToString("isLBullish", isLBullish, ignoreFalseConditions, separator) +
|
|
ToString("isLSwitchedToBullish", isLSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isLBearish", isLBearish, ignoreFalseConditions, separator) +
|
|
ToString("isLSwitchedToBearish", isLSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverLHigh", isCloseOverLHigh, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderLLow", isCloseUnderLLow, ignoreFalseConditions, separator) +
|
|
//
|
|
// Hind ...
|
|
ToString("isHBullish", isHBullish, ignoreFalseConditions, separator) +
|
|
ToString("isHSwitchedToBullish", isHSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isHBearish", isHBearish, ignoreFalseConditions, separator) +
|
|
ToString("isHSwitchedToBearish", isHSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverHHigh", isCloseOverHHigh, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderHLow", isCloseUnderHLow, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
"[" + GetTag() + "]" + separator +
|
|
(onlyConditions
|
|
? ""
|
|
: commonStr) +
|
|
(!includeScores
|
|
? ""
|
|
: scoresStr) +
|
|
" " + separator +
|
|
(onlyCommons
|
|
? ""
|
|
: conditionsStr) +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
string GetTag()
|
|
{
|
|
return "XCHHK";
|
|
}
|
|
};
|
|
|
|
//
|
|
// Class ...
|
|
class XSCXCHHKHelper : public XSCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Constructors ...
|
|
XSCXCHHKHelper() : XSCBaseHelper(_Symbol, _Period)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XSCXCHHKHelper()
|
|
{
|
|
//
|
|
Clean(cOpenBuffer);
|
|
Clean(cHighBuffer);
|
|
Clean(cLowBuffer);
|
|
Clean(cCloseBuffer);
|
|
Clean(sOpenBuffer);
|
|
Clean(sHighBuffer);
|
|
Clean(sLowBuffer);
|
|
Clean(sCloseBuffer);
|
|
Clean(mOpenBuffer);
|
|
Clean(mHighBuffer);
|
|
Clean(mLowBuffer);
|
|
Clean(mCloseBuffer);
|
|
Clean(lOpenBuffer);
|
|
Clean(lHighBuffer);
|
|
Clean(lLowBuffer);
|
|
Clean(lCloseBuffer);
|
|
Clean(hOpenBuffer);
|
|
Clean(hHighBuffer);
|
|
Clean(hLowBuffer);
|
|
Clean(hCloseBuffer);
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
XCHHKInputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
ArraySetAsSeries(cOpenBuffer, true);
|
|
ArraySetAsSeries(cHighBuffer, true);
|
|
ArraySetAsSeries(cLowBuffer, true);
|
|
ArraySetAsSeries(cCloseBuffer, true);
|
|
ArraySetAsSeries(sOpenBuffer, true);
|
|
ArraySetAsSeries(sHighBuffer, true);
|
|
ArraySetAsSeries(sLowBuffer, true);
|
|
ArraySetAsSeries(sCloseBuffer, true);
|
|
ArraySetAsSeries(mOpenBuffer, true);
|
|
ArraySetAsSeries(mHighBuffer, true);
|
|
ArraySetAsSeries(mLowBuffer, true);
|
|
ArraySetAsSeries(mCloseBuffer, true);
|
|
ArraySetAsSeries(lOpenBuffer, true);
|
|
ArraySetAsSeries(lHighBuffer, true);
|
|
ArraySetAsSeries(lLowBuffer, true);
|
|
ArraySetAsSeries(lCloseBuffer, true);
|
|
ArraySetAsSeries(hOpenBuffer, true);
|
|
ArraySetAsSeries(hHighBuffer, true);
|
|
ArraySetAsSeries(hLowBuffer, true);
|
|
ArraySetAsSeries(hCloseBuffer, true);
|
|
|
|
//
|
|
mHandler = iCustom(
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.xchhk",
|
|
//
|
|
// Inputs ...
|
|
//
|
|
// Market ...
|
|
"",
|
|
mInputs.cSmoothingLength,
|
|
//
|
|
// Cycles ...
|
|
"",
|
|
//
|
|
// Short ...
|
|
"",
|
|
mInputs.scMethod,
|
|
mInputs.scPeriod,
|
|
//
|
|
// Medium ...
|
|
"",
|
|
mInputs.mcMethod,
|
|
mInputs.mcPeriod,
|
|
//
|
|
// Long ...
|
|
"",
|
|
mInputs.lcMethod,
|
|
mInputs.lcPeriod,
|
|
//
|
|
// Hind ...
|
|
"",
|
|
mInputs.hcMethod,
|
|
mInputs.hcPeriod,
|
|
//
|
|
// Presentation ...
|
|
"",
|
|
mInputs.ignoreShadows,
|
|
mInputs.showCurrent,
|
|
mInputs.showShort,
|
|
mInputs.showMedium,
|
|
mInputs.showLong,
|
|
mInputs.showHind
|
|
//
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
XCHHKInputs GetInputs()
|
|
{
|
|
return mInputs;
|
|
}
|
|
|
|
//
|
|
bool SetInputs(
|
|
XCHHKInputs &inputs // Configs
|
|
)
|
|
{
|
|
//
|
|
return Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
inputs
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
double GetCOpen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(cOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return cOpenBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyCOpen(
|
|
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,
|
|
cOpenBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetCHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(cHighBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return cHighBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyCHigh(
|
|
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,
|
|
cHighBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetCLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(cLowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return cLowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyCLow(
|
|
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,
|
|
cLowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetCClose(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(cCloseBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return cCloseBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyCClose(
|
|
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,
|
|
cCloseBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Get XOHCL ...
|
|
bool CAsOHCL(
|
|
XOHCL &bar, // Holds Result
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(cOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
double open = GetCOpen(barIndex);
|
|
double high = GetCHigh(barIndex);
|
|
double close = GetCClose(barIndex);
|
|
double low = GetCLow(barIndex);
|
|
|
|
//
|
|
result = bar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
barIndex
|
|
//
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyCAsOHCL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
XOHCL &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
if (forceClean)
|
|
{
|
|
Clean(buffer);
|
|
}
|
|
|
|
//
|
|
int before = ArraySize(buffer);
|
|
|
|
//
|
|
if (start < 0)
|
|
{
|
|
start = 0;
|
|
}
|
|
|
|
//
|
|
if (start >= ArraySize(cOpenBuffer))
|
|
{
|
|
start = ArraySize(cOpenBuffer) - 1;
|
|
}
|
|
|
|
//
|
|
bool asSeriesBuffer = ArrayGetAsSeries(buffer);
|
|
ArraySetAsSeries(buffer, true);
|
|
|
|
//
|
|
for (int i = start; i < start + count; i++)
|
|
{
|
|
//
|
|
XOHCL iBar;
|
|
bool isInit = CAsOHCL(iBar, i);
|
|
|
|
//
|
|
if (isInit)
|
|
{
|
|
//
|
|
AddRef(
|
|
iBar,
|
|
buffer
|
|
//
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
ArraySetAsSeries(buffer, asSeriesBuffer);
|
|
|
|
//
|
|
int after = ArraySize(buffer);
|
|
|
|
//
|
|
result = after - before;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
double GetSOpen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(sOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return sOpenBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySOpen(
|
|
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,
|
|
sOpenBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetSHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(sHighBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return sHighBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySHigh(
|
|
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,
|
|
sHighBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetSLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(sLowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return sLowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySLow(
|
|
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,
|
|
sLowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetSClose(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(sCloseBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return sCloseBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySClose(
|
|
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,
|
|
sCloseBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Get XOHCL ...
|
|
bool SAsOHCL(
|
|
XOHCL &bar, // Holds Result
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(sOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
double open = GetSOpen(barIndex);
|
|
double high = GetSHigh(barIndex);
|
|
double close = GetSClose(barIndex);
|
|
double low = GetSLow(barIndex);
|
|
|
|
//
|
|
result = bar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
barIndex
|
|
//
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySAsOHCL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
XOHCL &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
if (forceClean)
|
|
{
|
|
Clean(buffer);
|
|
}
|
|
|
|
//
|
|
int before = ArraySize(buffer);
|
|
|
|
//
|
|
if (start < 0)
|
|
{
|
|
start = 0;
|
|
}
|
|
|
|
//
|
|
if (start >= ArraySize(sOpenBuffer))
|
|
{
|
|
start = ArraySize(sOpenBuffer) - 1;
|
|
}
|
|
|
|
//
|
|
bool asSeriesBuffer = ArrayGetAsSeries(buffer);
|
|
ArraySetAsSeries(buffer, true);
|
|
|
|
//
|
|
for (int i = start; i < start + count; i++)
|
|
{
|
|
//
|
|
XOHCL iBar;
|
|
bool isInit = SAsOHCL(iBar, i);
|
|
|
|
//
|
|
if (isInit)
|
|
{
|
|
//
|
|
AddRef(
|
|
iBar,
|
|
buffer
|
|
//
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
ArraySetAsSeries(buffer, asSeriesBuffer);
|
|
|
|
//
|
|
int after = ArraySize(buffer);
|
|
|
|
//
|
|
result = after - before;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
double GetMOpen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return mOpenBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMOpen(
|
|
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,
|
|
mOpenBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetMHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mHighBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return mHighBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMHigh(
|
|
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,
|
|
mHighBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetMLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mLowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return mLowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMLow(
|
|
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,
|
|
mLowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetMClose(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mCloseBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return mCloseBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMClose(
|
|
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,
|
|
mCloseBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Get XOHCL ...
|
|
bool MAsOHCL(
|
|
XOHCL &bar, // Holds Result
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
double open = GetMOpen(barIndex);
|
|
double high = GetMHigh(barIndex);
|
|
double close = GetMClose(barIndex);
|
|
double low = GetMLow(barIndex);
|
|
|
|
//
|
|
result = bar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
barIndex
|
|
//
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMAsOHCL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
XOHCL &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
if (forceClean)
|
|
{
|
|
Clean(buffer);
|
|
}
|
|
|
|
//
|
|
int before = ArraySize(buffer);
|
|
|
|
//
|
|
if (start < 0)
|
|
{
|
|
start = 0;
|
|
}
|
|
|
|
//
|
|
if (start >= ArraySize(mOpenBuffer))
|
|
{
|
|
start = ArraySize(mOpenBuffer) - 1;
|
|
}
|
|
|
|
//
|
|
bool asSeriesBuffer = ArrayGetAsSeries(buffer);
|
|
ArraySetAsSeries(buffer, true);
|
|
|
|
//
|
|
for (int i = start; i < start + count; i++)
|
|
{
|
|
//
|
|
XOHCL iBar;
|
|
bool isInit = MAsOHCL(iBar, i);
|
|
|
|
//
|
|
if (isInit)
|
|
{
|
|
//
|
|
AddRef(
|
|
iBar,
|
|
buffer
|
|
//
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
ArraySetAsSeries(buffer, asSeriesBuffer);
|
|
|
|
//
|
|
int after = ArraySize(buffer);
|
|
|
|
//
|
|
result = after - before;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
double GetLOpen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return lOpenBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLOpen(
|
|
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,
|
|
lOpenBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetLHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lHighBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return lHighBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLHigh(
|
|
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,
|
|
lHighBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetLLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lLowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return lLowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLLow(
|
|
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,
|
|
lLowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetLClose(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lCloseBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return lCloseBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLClose(
|
|
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,
|
|
lCloseBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Get XOHCL ...
|
|
bool LAsOHCL(
|
|
XOHCL &bar, // Holds Result
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
double open = GetLOpen(barIndex);
|
|
double high = GetLHigh(barIndex);
|
|
double close = GetLClose(barIndex);
|
|
double low = GetLLow(barIndex);
|
|
|
|
//
|
|
result = bar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
barIndex
|
|
//
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLAsOHCL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
XOHCL &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
if (forceClean)
|
|
{
|
|
Clean(buffer);
|
|
}
|
|
|
|
//
|
|
int before = ArraySize(buffer);
|
|
|
|
//
|
|
if (start < 0)
|
|
{
|
|
start = 0;
|
|
}
|
|
|
|
//
|
|
if (start >= ArraySize(lOpenBuffer))
|
|
{
|
|
start = ArraySize(lOpenBuffer) - 1;
|
|
}
|
|
|
|
//
|
|
bool asSeriesBuffer = ArrayGetAsSeries(buffer);
|
|
ArraySetAsSeries(buffer, true);
|
|
|
|
//
|
|
for (int i = start; i < start + count; i++)
|
|
{
|
|
//
|
|
XOHCL iBar;
|
|
bool isInit = LAsOHCL(iBar, i);
|
|
|
|
//
|
|
if (isInit)
|
|
{
|
|
//
|
|
AddRef(
|
|
iBar,
|
|
buffer
|
|
//
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
ArraySetAsSeries(buffer, asSeriesBuffer);
|
|
|
|
//
|
|
int after = ArraySize(buffer);
|
|
|
|
//
|
|
result = after - before;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
double GetHOpen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(hOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return hOpenBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyHOpen(
|
|
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,
|
|
hOpenBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetHHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(hHighBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return hHighBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyHHigh(
|
|
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,
|
|
hHighBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetHLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(hLowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return hLowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyHLow(
|
|
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,
|
|
hLowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetHClose(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(hCloseBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return hCloseBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyHClose(
|
|
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,
|
|
hCloseBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Get XOHCL ...
|
|
bool HAsOHCL(
|
|
XOHCL &bar, // Holds Result
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(hOpenBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
double open = GetHOpen(barIndex);
|
|
double high = GetHHigh(barIndex);
|
|
double close = GetHClose(barIndex);
|
|
double low = GetHLow(barIndex);
|
|
|
|
//
|
|
result = bar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
barIndex
|
|
//
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyHAsOHCL(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
XOHCL &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
if (forceClean)
|
|
{
|
|
Clean(buffer);
|
|
}
|
|
|
|
//
|
|
int before = ArraySize(buffer);
|
|
|
|
//
|
|
if (start < 0)
|
|
{
|
|
start = 0;
|
|
}
|
|
|
|
//
|
|
if (start >= ArraySize(hOpenBuffer))
|
|
{
|
|
start = ArraySize(hOpenBuffer) - 1;
|
|
}
|
|
|
|
//
|
|
bool asSeriesBuffer = ArrayGetAsSeries(buffer);
|
|
ArraySetAsSeries(buffer, true);
|
|
|
|
//
|
|
for (int i = start; i < start + count; i++)
|
|
{
|
|
//
|
|
XOHCL iBar;
|
|
bool isInit = HAsOHCL(iBar, i);
|
|
|
|
//
|
|
if (isInit)
|
|
{
|
|
//
|
|
AddRef(
|
|
iBar,
|
|
buffer
|
|
//
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
ArraySetAsSeries(buffer, asSeriesBuffer);
|
|
|
|
//
|
|
int after = ArraySize(buffer);
|
|
|
|
//
|
|
result = after - before;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
int GetBars(
|
|
XOHCL &bars[],
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
Clean(bars);
|
|
|
|
//
|
|
XOHCL bar;
|
|
bool hasBar = false;
|
|
|
|
//
|
|
// CURRENT ...
|
|
bar.Clean();
|
|
hasBar = CAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar && bar.IsValid())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// SHORT ...
|
|
bar.Clean();
|
|
hasBar = SAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar && bar.IsValid())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// MEDIUM ...
|
|
bar.Clean();
|
|
hasBar = MAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar && bar.IsValid())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// LONG ...
|
|
bar.Clean();
|
|
hasBar = LAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar && bar.IsValid())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// HIND ...
|
|
bar.Clean();
|
|
hasBar = HAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar && bar.IsValid())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
result = ArraySize(bars);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int GetBullishBars(
|
|
XOHCL &bars[],
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
Clean(bars);
|
|
|
|
//
|
|
XOHCL bar;
|
|
bool hasBar = false;
|
|
|
|
//
|
|
// CURRENT ...
|
|
bar.Clean();
|
|
hasBar = CAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBullish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// SHORT ...
|
|
bar.Clean();
|
|
hasBar = SAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBullish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// MEDIUM ...
|
|
bar.Clean();
|
|
hasBar = MAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBullish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// LONG ...
|
|
bar.Clean();
|
|
hasBar = LAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBullish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// HIND ...
|
|
bar.Clean();
|
|
hasBar = HAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBullish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
result = ArraySize(bars);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int GetBearishBars(
|
|
XOHCL &bars[],
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
Clean(bars);
|
|
|
|
//
|
|
XOHCL bar;
|
|
bool hasBar = false;
|
|
|
|
//
|
|
// CURRENT ...
|
|
bar.Clean();
|
|
hasBar = CAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBearish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// SHORT ...
|
|
bar.Clean();
|
|
hasBar = SAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBearish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// MEDIUM ...
|
|
bar.Clean();
|
|
hasBar = MAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBearish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// LONG ...
|
|
bar.Clean();
|
|
hasBar = LAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBearish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
// HIND ...
|
|
bar.Clean();
|
|
hasBar = HAsOHCL(
|
|
bar,
|
|
barIndex //
|
|
);
|
|
if (hasBar &&
|
|
bar.IsValid() &&
|
|
bar.IsBearish())
|
|
{
|
|
//
|
|
AddRef(
|
|
bar,
|
|
bars //
|
|
);
|
|
|
|
//
|
|
hasBar = false;
|
|
bar.Clean();
|
|
}
|
|
|
|
//
|
|
result = ArraySize(bars);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int GetCyclesBars(
|
|
XOHCL &bars[],
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
Clean(bars);
|
|
|
|
//
|
|
int cyclesCount = ArraySize(cycles);
|
|
if (!IsValidSize(cyclesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < cyclesCount; i++)
|
|
{
|
|
//
|
|
XOHCL iBar;
|
|
bool hasBar = false;
|
|
|
|
//
|
|
switch (cycles[i])
|
|
{
|
|
//
|
|
// CURRENT ...
|
|
case X_MARKET_CYCLE_UNKNOWN:
|
|
hasBar = CAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// SHORT ...
|
|
case X_MARKET_CYCLE_SHORT:
|
|
hasBar = SAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// MEDIUM ...
|
|
case X_MARKET_CYCLE_MEDIUM:
|
|
hasBar = MAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// LONG ...
|
|
case X_MARKET_CYCLE_LONG:
|
|
hasBar = LAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// HIND ...
|
|
case X_MARKET_CYCLE_HIND:
|
|
hasBar = HAsOHCL(iBar, barIndex);
|
|
break;
|
|
}
|
|
|
|
//
|
|
if (hasBar && iBar.IsValid())
|
|
{
|
|
//
|
|
AddRef(
|
|
iBar,
|
|
bars //
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
result = ArraySize(bars);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int GetCyclesBullishBars(
|
|
XOHCL &bars[],
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
Clean(bars);
|
|
|
|
//
|
|
int cyclesCount = ArraySize(cycles);
|
|
if (!IsValidSize(cyclesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < cyclesCount; i++)
|
|
{
|
|
//
|
|
XOHCL iBar;
|
|
bool hasBar = false;
|
|
|
|
//
|
|
switch (cycles[i])
|
|
{
|
|
//
|
|
// CURRENT ...
|
|
case X_MARKET_CYCLE_UNKNOWN:
|
|
hasBar = CAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// SHORT ...
|
|
case X_MARKET_CYCLE_SHORT:
|
|
hasBar = SAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// MEDIUM ...
|
|
case X_MARKET_CYCLE_MEDIUM:
|
|
hasBar = MAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// LONG ...
|
|
case X_MARKET_CYCLE_LONG:
|
|
hasBar = LAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// HIND ...
|
|
case X_MARKET_CYCLE_HIND:
|
|
hasBar = HAsOHCL(iBar, barIndex);
|
|
break;
|
|
}
|
|
|
|
//
|
|
if (hasBar &&
|
|
iBar.IsValid() &&
|
|
iBar.IsBullish())
|
|
{
|
|
//
|
|
AddRef(
|
|
iBar,
|
|
bars //
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
result = ArraySize(bars);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int GetCyclesBearishBars(
|
|
XOHCL &bars[],
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
Clean(bars);
|
|
|
|
//
|
|
int cyclesCount = ArraySize(cycles);
|
|
if (!IsValidSize(cyclesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < cyclesCount; i++)
|
|
{
|
|
//
|
|
XOHCL iBar;
|
|
bool hasBar = false;
|
|
|
|
//
|
|
switch (cycles[i])
|
|
{
|
|
//
|
|
// CURRENT ...
|
|
case X_MARKET_CYCLE_UNKNOWN:
|
|
hasBar = CAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// SHORT ...
|
|
case X_MARKET_CYCLE_SHORT:
|
|
hasBar = SAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// MEDIUM ...
|
|
case X_MARKET_CYCLE_MEDIUM:
|
|
hasBar = MAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// LONG ...
|
|
case X_MARKET_CYCLE_LONG:
|
|
hasBar = LAsOHCL(iBar, barIndex);
|
|
break;
|
|
//
|
|
// HIND ...
|
|
case X_MARKET_CYCLE_HIND:
|
|
hasBar = HAsOHCL(iBar, barIndex);
|
|
break;
|
|
}
|
|
|
|
//
|
|
if (hasBar &&
|
|
iBar.IsValid() &&
|
|
iBar.IsBearish())
|
|
{
|
|
//
|
|
AddRef(
|
|
iBar,
|
|
bars //
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
result = ArraySize(bars);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMaxHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMaxLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Bullish ...
|
|
|
|
//
|
|
double GetMaxBullishHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBullishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinBullishHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBullishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMaxBullishLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBullishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinBullishLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBullishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Bearish ...
|
|
|
|
//
|
|
double GetMaxBearishHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBearishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinBearishHigh(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBearishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMaxBearishLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBearishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinBearishLow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBearishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Cycles Bullish ...
|
|
|
|
//
|
|
double GetMaxCyclesBullishHigh(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBullishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinCyclesBullishHigh(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBullishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMaxCyclesBullishLow(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBullishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinCyclesBullishLow(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBullishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Cycles Bearish ...
|
|
|
|
//
|
|
double GetMaxCyclesBearishHigh(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBearishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinCyclesBearishHigh(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBearishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].high,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMaxCyclesBearishLow(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBearishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMax(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetMinCyclesBearishLow(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBearishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double values[];
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
//
|
|
Add(
|
|
bars[i].low,
|
|
values);
|
|
}
|
|
|
|
//
|
|
int valuesCount = ArraySize(values);
|
|
if (!IsValidSize(valuesCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = GetMin(values);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetBullishPower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBullishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
result += bars[i].GetBody();
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetBearishPower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetBearishBars(
|
|
bars,
|
|
barIndex //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
result += bars[i].GetBody();
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetCyclesBullishPower(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBullishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
result += bars[i].GetBody();
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double GetCyclesBearishPower(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
double result = 0;
|
|
|
|
//
|
|
XOHCL bars[];
|
|
int barsCount = GetCyclesBearishBars(
|
|
bars,
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
if (!IsValidSize(barsCount))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < barsCount; i++)
|
|
{
|
|
result += bars[i].GetBody();
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool HasBullishPower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double bullishPower = GetBullishPower(barIndex);
|
|
double bearishPower = GetBearishPower(barIndex);
|
|
|
|
//
|
|
result =
|
|
//
|
|
bearishPower >= 0 &&
|
|
bullishPower > bearishPower
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool HasBearishPower(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double bullishPower = GetBullishPower(barIndex);
|
|
double bearishPower = GetBearishPower(barIndex);
|
|
|
|
//
|
|
result =
|
|
//
|
|
bullishPower >= 0 &&
|
|
bearishPower > bullishPower
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool HasCyclesBullishPower(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double bullishPower = GetCyclesBullishPower(barIndex, cycles);
|
|
double bearishPower = GetCyclesBearishPower(barIndex, cycles);
|
|
|
|
//
|
|
result =
|
|
//
|
|
bearishPower >= 0 &&
|
|
bullishPower > bearishPower
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool HasCyclesBearishPower(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double bullishPower = GetCyclesBullishPower(barIndex, cycles);
|
|
double bearishPower = GetCyclesBearishPower(barIndex, cycles);
|
|
|
|
//
|
|
result =
|
|
//
|
|
bullishPower >= 0 &&
|
|
bearishPower > bullishPower
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Bullish Power Increasing ...
|
|
bool IsBullishPowerIncreasing(
|
|
int barIndex, // Bar Index
|
|
int loopback = 5 // Loopback
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (loopback <= 0)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
double firstPower = GetBullishPower(barIndex);
|
|
double lastPower = firstPower;
|
|
for (int i = barIndex + 1; i < barIndex + loopback; i++)
|
|
{
|
|
//
|
|
double iPower = GetBullishPower(i);
|
|
|
|
//
|
|
result =
|
|
//
|
|
iPower > 0 &&
|
|
firstPower > 0 &&
|
|
lastPower > iPower
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
lastPower = iPower;
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
firstPower > lastPower
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Bullish Power Decreasing ...
|
|
bool IsBullishPowerDecreasing(
|
|
int barIndex, // Bar Index
|
|
int loopback = 5 // Loopback
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (loopback <= 0)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
double firstPower = GetBullishPower(barIndex);
|
|
double lastPower = firstPower;
|
|
for (int i = barIndex + 1; i < barIndex + loopback; i++)
|
|
{
|
|
//
|
|
double iPower = GetBullishPower(i);
|
|
|
|
//
|
|
result =
|
|
//
|
|
iPower > 0 &&
|
|
firstPower > 0 &&
|
|
lastPower < iPower
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
lastPower = iPower;
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
firstPower < lastPower
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Bearish Power Increasing ...
|
|
bool IsBearishPowerIncreasing(
|
|
int barIndex, // Bar Index
|
|
int loopback = 5 // Loopback
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (loopback <= 0)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
double firstPower = GetBearishPower(barIndex);
|
|
double lastPower = firstPower;
|
|
for (int i = barIndex + 1; i < barIndex + loopback; i++)
|
|
{
|
|
//
|
|
double iPower = GetBearishPower(i);
|
|
|
|
//
|
|
result =
|
|
//
|
|
iPower > 0 &&
|
|
firstPower > 0 &&
|
|
lastPower > iPower
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
lastPower = iPower;
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
firstPower > lastPower
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Bearish Power Decreasing ...
|
|
bool IsBearishPowerDecreasing(
|
|
int barIndex, // Bar Index
|
|
int loopback = 5 // Loopback
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (loopback <= 0)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
double firstPower = GetBearishPower(barIndex);
|
|
double lastPower = firstPower;
|
|
for (int i = barIndex + 1; i < barIndex + loopback; i++)
|
|
{
|
|
//
|
|
double iPower = GetBearishPower(i);
|
|
|
|
//
|
|
result =
|
|
//
|
|
iPower > 0 &&
|
|
firstPower > 0 &&
|
|
lastPower < iPower
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
lastPower = iPower;
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
firstPower < lastPower
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Bullish Power Increasing ...
|
|
bool IsCyclesBullishPowerIncreasing(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[], //
|
|
int loopback = 5 // Loopback
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (loopback <= 0)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
double firstPower = GetCyclesBullishPower(barIndex, cycles);
|
|
double lastPower = firstPower;
|
|
for (int i = barIndex + 1; i < barIndex + loopback; i++)
|
|
{
|
|
//
|
|
double iPower = GetCyclesBullishPower(i, cycles);
|
|
|
|
//
|
|
result =
|
|
//
|
|
iPower > 0 &&
|
|
firstPower > 0 &&
|
|
lastPower > iPower
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
lastPower = iPower;
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
firstPower > lastPower
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Bullish Power Decreasing ...
|
|
bool IsCyclesBullishPowerDecreasing(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[], //
|
|
int loopback = 5 // Loopback
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (loopback <= 0)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
double firstPower = GetCyclesBullishPower(barIndex, cycles);
|
|
double lastPower = firstPower;
|
|
for (int i = barIndex + 1; i < barIndex + loopback; i++)
|
|
{
|
|
//
|
|
double iPower = GetCyclesBullishPower(i, cycles);
|
|
|
|
//
|
|
result =
|
|
//
|
|
iPower > 0 &&
|
|
firstPower > 0 &&
|
|
lastPower < iPower
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
lastPower = iPower;
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
firstPower < lastPower
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Bearish Power Increasing ...
|
|
bool IsCyclesBearishPowerIncreasing(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[], //
|
|
int loopback = 5 // Loopback
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (loopback <= 0)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
double firstPower = GetCyclesBearishPower(barIndex, cycles);
|
|
double lastPower = firstPower;
|
|
for (int i = barIndex + 1; i < barIndex + loopback; i++)
|
|
{
|
|
//
|
|
double iPower = GetCyclesBearishPower(i, cycles);
|
|
|
|
//
|
|
result =
|
|
//
|
|
iPower > 0 &&
|
|
firstPower > 0 &&
|
|
lastPower > iPower
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
lastPower = iPower;
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
firstPower > lastPower
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Bearish Power Decreasing ...
|
|
bool IsCyclesBearishPowerDecreasing(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[], //
|
|
int loopback = 5 // Loopback
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (loopback <= 0)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
double firstPower = GetCyclesBearishPower(barIndex, cycles);
|
|
double lastPower = firstPower;
|
|
for (int i = barIndex + 1; i < barIndex + loopback; i++)
|
|
{
|
|
//
|
|
double iPower = GetCyclesBearishPower(i, cycles);
|
|
|
|
//
|
|
result =
|
|
//
|
|
iPower > 0 &&
|
|
firstPower > 0 &&
|
|
lastPower < iPower
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
lastPower = iPower;
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
firstPower < lastPower
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Cycles Switched to Bullish or not ...
|
|
bool IsCyclesSwitchedToBullish(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int cyclesCount = ArraySize(cycles);
|
|
result = IsValidSize(cyclesCount);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int cIndex = barIndex;
|
|
int pIndex = cIndex + 1;
|
|
|
|
//
|
|
XOHCL cBars[];
|
|
XOHCL pBars[];
|
|
for (int i = 0; i < cyclesCount; i++)
|
|
{
|
|
//
|
|
XOHCL iCBar;
|
|
XOHCL iPBar;
|
|
|
|
//
|
|
switch (cycles[i])
|
|
{
|
|
//
|
|
// CURRENT ...
|
|
case X_MARKET_CYCLE_UNKNOWN:
|
|
result = CAsOHCL(iCBar, cIndex);
|
|
break;
|
|
//
|
|
// SHORT ...
|
|
case X_MARKET_CYCLE_SHORT:
|
|
result = SAsOHCL(iCBar, cIndex);
|
|
break;
|
|
//
|
|
// MEDIUM ...
|
|
case X_MARKET_CYCLE_MEDIUM:
|
|
result = MAsOHCL(iCBar, cIndex);
|
|
break;
|
|
//
|
|
// LONG ...
|
|
case X_MARKET_CYCLE_LONG:
|
|
result = LAsOHCL(iCBar, cIndex);
|
|
break;
|
|
//
|
|
// HIND ...
|
|
case X_MARKET_CYCLE_HIND:
|
|
result = HAsOHCL(iCBar, cIndex);
|
|
break;
|
|
}
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
AddRef(
|
|
iCBar,
|
|
cBars //
|
|
);
|
|
|
|
//
|
|
switch (cycles[i])
|
|
{
|
|
//
|
|
// CURRENT ...
|
|
case X_MARKET_CYCLE_UNKNOWN:
|
|
result = CAsOHCL(iPBar, pIndex);
|
|
break;
|
|
//
|
|
// SHORT ...
|
|
case X_MARKET_CYCLE_SHORT:
|
|
result = SAsOHCL(iPBar, pIndex);
|
|
break;
|
|
//
|
|
// MEDIUM ...
|
|
case X_MARKET_CYCLE_MEDIUM:
|
|
result = MAsOHCL(iPBar, pIndex);
|
|
break;
|
|
//
|
|
// LONG ...
|
|
case X_MARKET_CYCLE_LONG:
|
|
result = LAsOHCL(iPBar, pIndex);
|
|
break;
|
|
//
|
|
// HIND ...
|
|
case X_MARKET_CYCLE_HIND:
|
|
result = HAsOHCL(iPBar, pIndex);
|
|
break;
|
|
}
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
AddRef(
|
|
iPBar,
|
|
pBars //
|
|
);
|
|
}
|
|
|
|
//
|
|
int cBarsCount = ArraySize(cBars);
|
|
int pBarsCount = ArraySize(pBars);
|
|
result =
|
|
//
|
|
IsValidSize(cBarsCount) &&
|
|
cBarsCount == cyclesCount &&
|
|
//
|
|
IsValidSize(pBarsCount) &&
|
|
pBarsCount == cyclesCount
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isCIndexBullish = true;
|
|
for (int i = 0; i < cBarsCount; i++)
|
|
{
|
|
isCIndexBullish = isCIndexBullish && cBars[i].IsBullish();
|
|
}
|
|
|
|
//
|
|
bool isPIndexBullish = true;
|
|
for (int i = 0; i < pBarsCount; i++)
|
|
{
|
|
isPIndexBullish = isPIndexBullish && pBars[i].IsBullish();
|
|
}
|
|
|
|
//
|
|
result = isCIndexBullish &&
|
|
!isPIndexBullish;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Cycles Switched to Bearish or not ...
|
|
bool IsCyclesSwitchedToBearish(
|
|
int barIndex, // Bar Index
|
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int cyclesCount = ArraySize(cycles);
|
|
result = IsValidSize(cyclesCount);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int cIndex = barIndex;
|
|
int pIndex = cIndex + 1;
|
|
|
|
//
|
|
XOHCL cBars[];
|
|
XOHCL pBars[];
|
|
for (int i = 0; i < cyclesCount; i++)
|
|
{
|
|
//
|
|
XOHCL iCBar;
|
|
XOHCL iPBar;
|
|
|
|
//
|
|
switch (cycles[i])
|
|
{
|
|
//
|
|
// CURRENT ...
|
|
case X_MARKET_CYCLE_UNKNOWN:
|
|
result = CAsOHCL(iCBar, cIndex);
|
|
break;
|
|
//
|
|
// SHORT ...
|
|
case X_MARKET_CYCLE_SHORT:
|
|
result = SAsOHCL(iCBar, cIndex);
|
|
break;
|
|
//
|
|
// MEDIUM ...
|
|
case X_MARKET_CYCLE_MEDIUM:
|
|
result = MAsOHCL(iCBar, cIndex);
|
|
break;
|
|
//
|
|
// LONG ...
|
|
case X_MARKET_CYCLE_LONG:
|
|
result = LAsOHCL(iCBar, cIndex);
|
|
break;
|
|
//
|
|
// HIND ...
|
|
case X_MARKET_CYCLE_HIND:
|
|
result = HAsOHCL(iCBar, cIndex);
|
|
break;
|
|
}
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
AddRef(
|
|
iCBar,
|
|
cBars //
|
|
);
|
|
|
|
//
|
|
switch (cycles[i])
|
|
{
|
|
//
|
|
// CURRENT ...
|
|
case X_MARKET_CYCLE_UNKNOWN:
|
|
result = CAsOHCL(iPBar, pIndex);
|
|
break;
|
|
//
|
|
// SHORT ...
|
|
case X_MARKET_CYCLE_SHORT:
|
|
result = SAsOHCL(iPBar, pIndex);
|
|
break;
|
|
//
|
|
// MEDIUM ...
|
|
case X_MARKET_CYCLE_MEDIUM:
|
|
result = MAsOHCL(iPBar, pIndex);
|
|
break;
|
|
//
|
|
// LONG ...
|
|
case X_MARKET_CYCLE_LONG:
|
|
result = LAsOHCL(iPBar, pIndex);
|
|
break;
|
|
//
|
|
// HIND ...
|
|
case X_MARKET_CYCLE_HIND:
|
|
result = HAsOHCL(iPBar, pIndex);
|
|
break;
|
|
}
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
AddRef(
|
|
iPBar,
|
|
pBars //
|
|
);
|
|
}
|
|
|
|
//
|
|
int cBarsCount = ArraySize(cBars);
|
|
int pBarsCount = ArraySize(pBars);
|
|
result =
|
|
//
|
|
IsValidSize(cBarsCount) &&
|
|
cBarsCount == cyclesCount &&
|
|
//
|
|
IsValidSize(pBarsCount) &&
|
|
pBarsCount == cyclesCount
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isCIndexBearish = true;
|
|
for (int i = 0; i < cBarsCount; i++)
|
|
{
|
|
isCIndexBearish = isCIndexBearish && cBars[i].IsBearish();
|
|
}
|
|
|
|
//
|
|
bool isPIndexBearish = true;
|
|
for (int i = 0; i < pBarsCount; i++)
|
|
{
|
|
isPIndexBearish = isPIndexBearish && pBars[i].IsBearish();
|
|
}
|
|
|
|
//
|
|
result = isCIndexBearish &&
|
|
!isPIndexBearish;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool IsBullishSorted(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int cIndex = barIndex;
|
|
int pIndex = cIndex + 1;
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
XOHCL cCBar;
|
|
result = CAsOHCL(cCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL cPBar;
|
|
result = CAsOHCL(cPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
XOHCL sCBar;
|
|
result = SAsOHCL(sCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL sPBar;
|
|
result = SAsOHCL(sPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
XOHCL mCBar;
|
|
result = MAsOHCL(mCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL mPBar;
|
|
result = MAsOHCL(mPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
XOHCL lCBar;
|
|
result = LAsOHCL(lCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL lPBar;
|
|
result = LAsOHCL(lPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
XOHCL hCBar;
|
|
result = HAsOHCL(hCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL hPBar;
|
|
result = HAsOHCL(hPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isCBullish =
|
|
//
|
|
cCBar.IsBullish() &&
|
|
sCBar.IsBullish() &&
|
|
mCBar.IsBullish() &&
|
|
lCBar.IsBullish() &&
|
|
hCBar.IsBullish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCSorted =
|
|
//
|
|
cCBar.high > sCBar.high &&
|
|
sCBar.high > mCBar.high &&
|
|
mCBar.high > lCBar.high &&
|
|
lCBar.high > hCBar.high
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCPrepred = isCBullish &&
|
|
isCSorted;
|
|
|
|
//
|
|
bool isPBullish =
|
|
//
|
|
cPBar.IsBullish() &&
|
|
sPBar.IsBullish() &&
|
|
mPBar.IsBullish() &&
|
|
lPBar.IsBullish() &&
|
|
hPBar.IsBullish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isPSorted =
|
|
//
|
|
cPBar.high > sPBar.high &&
|
|
sPBar.high > mPBar.high &&
|
|
mPBar.high > lPBar.high &&
|
|
lPBar.high > hPBar.high
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isPPrepred = isPBullish &&
|
|
isPSorted;
|
|
|
|
//
|
|
result = isCPrepred &&
|
|
!isPPrepred;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool IsBearishSorted(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int cIndex = barIndex;
|
|
int pIndex = cIndex + 1;
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
XOHCL cCBar;
|
|
result = CAsOHCL(cCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL cPBar;
|
|
result = CAsOHCL(cPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
XOHCL sCBar;
|
|
result = SAsOHCL(sCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL sPBar;
|
|
result = SAsOHCL(sPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
XOHCL mCBar;
|
|
result = MAsOHCL(mCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL mPBar;
|
|
result = MAsOHCL(mPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
XOHCL lCBar;
|
|
result = LAsOHCL(lCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL lPBar;
|
|
result = LAsOHCL(lPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
XOHCL hCBar;
|
|
result = HAsOHCL(hCBar, cIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL hPBar;
|
|
result = HAsOHCL(hPBar, pIndex);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isCBearish =
|
|
//
|
|
cCBar.IsBearish() &&
|
|
sCBar.IsBearish() &&
|
|
mCBar.IsBearish() &&
|
|
lCBar.IsBearish() &&
|
|
hCBar.IsBearish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCSorted =
|
|
//
|
|
cCBar.low < sCBar.low &&
|
|
sCBar.low < mCBar.low &&
|
|
mCBar.low < lCBar.low &&
|
|
lCBar.low < hCBar.low
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCPrepred = isCBearish &&
|
|
isCSorted;
|
|
|
|
//
|
|
bool isPBearish =
|
|
//
|
|
cPBar.IsBearish() &&
|
|
sPBar.IsBearish() &&
|
|
mPBar.IsBearish() &&
|
|
lPBar.IsBearish() &&
|
|
hPBar.IsBearish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isPSorted =
|
|
//
|
|
cPBar.low < sPBar.low &&
|
|
sPBar.low < mPBar.low &&
|
|
mPBar.low < lPBar.low &&
|
|
lPBar.low < hPBar.low
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isPPrepred = isPBearish &&
|
|
isPSorted;
|
|
|
|
//
|
|
result = isCPrepred &&
|
|
!isPPrepred;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check All Cycles Switched to Bullish or not ...
|
|
bool IsSwitchedToBullish(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
ENUM_X_MARKET_CYCLES cycles[];
|
|
int cyclesCount = GetAllMarketCycles(cycles);
|
|
result = IsValidSize(cyclesCount);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = IsCyclesSwitchedToBullish(
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check All Cycles Switched to Bearish or not ...
|
|
bool IsSwitchedToBearish(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
ENUM_X_MARKET_CYCLES cycles[];
|
|
int cyclesCount = GetAllMarketCycles(cycles);
|
|
result = IsValidSize(cyclesCount);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = IsCyclesSwitchedToBearish(
|
|
barIndex,
|
|
cycles //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool GetConditions(
|
|
XCHHKConditions &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();
|
|
|
|
//
|
|
int zIndex = barIndex;
|
|
int cIndex = zIndex + 1;
|
|
int pIndex = cIndex + 1;
|
|
int ppIndex = pIndex + 1;
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Current ...
|
|
CopyCAsOHCL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.cBars //
|
|
);
|
|
|
|
//
|
|
// Short ...
|
|
CopySAsOHCL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.sBars //
|
|
);
|
|
|
|
//
|
|
// Medium ...
|
|
CopyMAsOHCL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.mBars //
|
|
);
|
|
|
|
//
|
|
// Long ...
|
|
CopyLAsOHCL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.lBars //
|
|
);
|
|
|
|
//
|
|
// Hind ...
|
|
CopyHAsOHCL(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hBars //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
XOHCL cBar;
|
|
result = cBar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
cIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL pBar;
|
|
result = pBar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
pIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Power ...
|
|
|
|
//
|
|
bool hasBullishPower = HasBullishPower(cIndex);
|
|
bool hasBullishPowerPrev = HasBullishPower(pIndex);
|
|
|
|
//
|
|
bool hasBearishPower = HasBearishPower(cIndex);
|
|
bool hasBearishPowerPrev = HasBearishPower(pIndex);
|
|
|
|
//
|
|
bool isBullishPowerUp = hasBullishPower &&
|
|
!hasBullishPowerPrev;
|
|
bool isBearishPowerUp = hasBearishPower &&
|
|
!hasBearishPowerPrev;
|
|
|
|
//
|
|
bool isBullishPowerIncreasing = IsBullishPowerIncreasing(cIndex);
|
|
bool isBullishPowerDecreasing = IsBullishPowerDecreasing(cIndex);
|
|
bool isBearishPowerIncreasing = IsBearishPowerIncreasing(cIndex);
|
|
bool isBearishPowerDecreasing = IsBearishPowerDecreasing(cIndex);
|
|
|
|
//
|
|
conditions.hasBullishPower = hasBullishPower;
|
|
conditions.hasBearishPower = hasBearishPower;
|
|
conditions.isBullishPowerUp = isBullishPowerUp;
|
|
conditions.isBearishPowerUp = isBearishPowerUp;
|
|
conditions.isBullishPowerIncreasing = isBullishPowerIncreasing;
|
|
conditions.isBullishPowerDecreasing = isBullishPowerDecreasing;
|
|
conditions.isBearishPowerIncreasing = isBearishPowerIncreasing;
|
|
conditions.isBearishPowerDecreasing = isBearishPowerDecreasing;
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
bool isCBullish = conditions.cBars[cIndex].IsBullish();
|
|
bool isCBullishPrev = conditions.cBars[pIndex].IsBullish();
|
|
|
|
//
|
|
bool isCBearish = conditions.cBars[cIndex].IsBearish();
|
|
bool isCBearishPrev = conditions.cBars[pIndex].IsBearish();
|
|
|
|
//
|
|
bool isCSwitchedToBullish = isCBullish &&
|
|
!isCBullishPrev;
|
|
bool isCSwitchedToBearish = isCBearish &&
|
|
!isCBearishPrev;
|
|
|
|
//
|
|
bool isCloseOverCHigh = cBar.close > conditions.cBars[cIndex].high;
|
|
bool isCloseUnderCLow = cBar.close < conditions.cBars[cIndex].low;
|
|
|
|
//
|
|
conditions.isCBullish = isCBullish;
|
|
conditions.isCSwitchedToBullish = isCSwitchedToBullish;
|
|
conditions.isCBearish = isCBearish;
|
|
conditions.isCSwitchedToBearish = isCSwitchedToBearish;
|
|
|
|
//
|
|
conditions.isCloseOverCHigh = isCloseOverCHigh;
|
|
conditions.isCloseUnderCLow = isCloseUnderCLow;
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
bool isSBullish = conditions.sBars[cIndex].IsBullish();
|
|
bool isSBullishPrev = conditions.sBars[pIndex].IsBullish();
|
|
|
|
//
|
|
bool isSBearish = conditions.sBars[cIndex].IsBearish();
|
|
bool isSBearishPrev = conditions.sBars[pIndex].IsBearish();
|
|
|
|
//
|
|
bool isSSwitchedToBullish = isSBullish &&
|
|
!isSBullishPrev;
|
|
bool isSSwitchedToBearish = isSBearish &&
|
|
!isSBearishPrev;
|
|
|
|
//
|
|
bool isCloseOverSHigh = cBar.close > conditions.sBars[cIndex].high;
|
|
bool isCloseUnderSLow = cBar.close < conditions.sBars[cIndex].low;
|
|
|
|
//
|
|
conditions.isSBullish = isSBullish;
|
|
conditions.isSSwitchedToBullish = isSSwitchedToBullish;
|
|
conditions.isSBearish = isSBearish;
|
|
conditions.isSSwitchedToBearish = isSSwitchedToBearish;
|
|
|
|
//
|
|
conditions.isCloseOverSHigh = isCloseOverSHigh;
|
|
conditions.isCloseUnderSLow = isCloseUnderSLow;
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
bool isMBullish = conditions.mBars[cIndex].IsBullish();
|
|
bool isMBullishPrev = conditions.mBars[pIndex].IsBullish();
|
|
|
|
//
|
|
bool isMBearish = conditions.mBars[cIndex].IsBearish();
|
|
bool isMBearishPrev = conditions.mBars[pIndex].IsBearish();
|
|
|
|
//
|
|
bool isMSwitchedToBullish = isMBullish &&
|
|
!isMBullishPrev;
|
|
bool isMSwitchedToBearish = isMBearish &&
|
|
!isMBearishPrev;
|
|
|
|
//
|
|
bool isCloseOverMHigh = cBar.close > conditions.mBars[cIndex].high;
|
|
bool isCloseUnderMLow = cBar.close < conditions.mBars[cIndex].low;
|
|
|
|
//
|
|
conditions.isMBullish = isMBullish;
|
|
conditions.isMSwitchedToBullish = isMSwitchedToBullish;
|
|
conditions.isMBearish = isMBearish;
|
|
conditions.isMSwitchedToBearish = isMSwitchedToBearish;
|
|
|
|
//
|
|
conditions.isCloseOverMHigh = isCloseOverMHigh;
|
|
conditions.isCloseUnderMLow = isCloseUnderMLow;
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
bool isLBullish = conditions.lBars[cIndex].IsBullish();
|
|
bool isLBullishPrev = conditions.lBars[pIndex].IsBullish();
|
|
|
|
//
|
|
bool isLBearish = conditions.lBars[cIndex].IsBearish();
|
|
bool isLBearishPrev = conditions.lBars[pIndex].IsBearish();
|
|
|
|
//
|
|
bool isLSwitchedToBullish = isLBullish &&
|
|
!isLBullishPrev;
|
|
bool isLSwitchedToBearish = isLBearish &&
|
|
!isLBearishPrev;
|
|
|
|
//
|
|
bool isCloseOverLHigh = cBar.close > conditions.lBars[cIndex].high;
|
|
bool isCloseUnderLLow = cBar.close < conditions.lBars[cIndex].low;
|
|
|
|
//
|
|
conditions.isLBullish = isLBullish;
|
|
conditions.isLSwitchedToBullish = isLSwitchedToBullish;
|
|
conditions.isLBearish = isLBearish;
|
|
conditions.isLSwitchedToBearish = isLSwitchedToBearish;
|
|
|
|
//
|
|
conditions.isCloseOverLHigh = isCloseOverLHigh;
|
|
conditions.isCloseUnderLLow = isCloseUnderLLow;
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
bool isHBullish = conditions.hBars[cIndex].IsBullish();
|
|
bool isHBullishPrev = conditions.hBars[pIndex].IsBullish();
|
|
|
|
//
|
|
bool isHBearish = conditions.hBars[cIndex].IsBearish();
|
|
bool isHBearishPrev = conditions.hBars[pIndex].IsBearish();
|
|
|
|
//
|
|
bool isHSwitchedToBullish = isHBullish &&
|
|
!isHBullishPrev;
|
|
bool isHSwitchedToBearish = isHBearish &&
|
|
!isHBearishPrev;
|
|
|
|
//
|
|
bool isCloseOverHHigh = cBar.close > conditions.hBars[cIndex].high;
|
|
bool isCloseUnderHLow = cBar.close < conditions.hBars[cIndex].low;
|
|
|
|
//
|
|
conditions.isHBullish = isHBullish;
|
|
conditions.isHSwitchedToBullish = isHSwitchedToBullish;
|
|
conditions.isHBearish = isHBearish;
|
|
conditions.isHSwitchedToBearish = isHSwitchedToBearish;
|
|
|
|
//
|
|
conditions.isCloseOverHHigh = isCloseOverHHigh;
|
|
conditions.isCloseUnderHLow = isCloseUnderHLow;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
XCHHKInputs mInputs; // Inputs ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Current ...
|
|
double cOpenBuffer[];
|
|
double cHighBuffer[];
|
|
double cLowBuffer[];
|
|
double cCloseBuffer[];
|
|
|
|
//
|
|
// Short ...
|
|
double sOpenBuffer[];
|
|
double sHighBuffer[];
|
|
double sLowBuffer[];
|
|
double sCloseBuffer[];
|
|
|
|
//
|
|
// Medium ...
|
|
double mOpenBuffer[];
|
|
double mHighBuffer[];
|
|
double mLowBuffer[];
|
|
double mCloseBuffer[];
|
|
|
|
//
|
|
// Long ...
|
|
double lOpenBuffer[];
|
|
double lHighBuffer[];
|
|
double lLowBuffer[];
|
|
double lCloseBuffer[];
|
|
|
|
//
|
|
// Hind ...
|
|
double hOpenBuffer[];
|
|
double hHighBuffer[];
|
|
double hLowBuffer[];
|
|
double hCloseBuffer[];
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Calculate Values Until Now ...
|
|
void Calculate()
|
|
{
|
|
//
|
|
int totalBars = CountBars();
|
|
if (totalBars > 1000)
|
|
{
|
|
totalBars = 1000;
|
|
}
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
// Open ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_CO_LINE,
|
|
0,
|
|
totalBars,
|
|
cOpenBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// High ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_CH_LINE,
|
|
0,
|
|
totalBars,
|
|
cHighBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Low ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_CL_LINE,
|
|
0,
|
|
totalBars,
|
|
cLowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Close ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_CC_LINE,
|
|
0,
|
|
totalBars,
|
|
cCloseBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
// Open ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_SO_LINE,
|
|
0,
|
|
totalBars,
|
|
sOpenBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// High ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_SH_LINE,
|
|
0,
|
|
totalBars,
|
|
sHighBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Low ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_SL_LINE,
|
|
0,
|
|
totalBars,
|
|
sLowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Close ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_SC_LINE,
|
|
0,
|
|
totalBars,
|
|
sCloseBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
// Open ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_MO_LINE,
|
|
0,
|
|
totalBars,
|
|
mOpenBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// High ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_MH_LINE,
|
|
0,
|
|
totalBars,
|
|
mHighBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Low ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_ML_LINE,
|
|
0,
|
|
totalBars,
|
|
mLowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Close ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_MC_LINE,
|
|
0,
|
|
totalBars,
|
|
mCloseBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
// Open ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_LO_LINE,
|
|
0,
|
|
totalBars,
|
|
lOpenBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// High ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_LH_LINE,
|
|
0,
|
|
totalBars,
|
|
lHighBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Low ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_LL_LINE,
|
|
0,
|
|
totalBars,
|
|
lLowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Close ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_LC_LINE,
|
|
0,
|
|
totalBars,
|
|
lCloseBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
// Open ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_HO_LINE,
|
|
0,
|
|
totalBars,
|
|
hOpenBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// High ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_HH_LINE,
|
|
0,
|
|
totalBars,
|
|
hHighBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Low ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_HL_LINE,
|
|
0,
|
|
totalBars,
|
|
hLowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Close ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHHK_HC_LINE,
|
|
0,
|
|
totalBars,
|
|
hCloseBuffer
|
|
//
|
|
);
|
|
};
|
|
};
|
|
|
|
// |