Files
MQL5Data/Helpers/x-saherelm.x121.xca.helper.mq5
T
2025-05-19 19:19:33 +03:30

5275 lines
122 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Helper Class Library
// ----------------------------------------------
// Name: XCX121XCAHelper
// Description: provides all Indicator
// Helper requirements ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// Imports ...
#include "../Classes/x-saherelm.x-helper.class.mq5"
//
// Definitions ...
//
// Buffers ...
enum ENUM_X121_XCA_BUFFERS
{
//
X121_XCA_S_HH_LINE = 0,
X121_XCA_S_LL_LINE = 1,
X121_XCA_M_HH_LINE = 2,
X121_XCA_M_LL_LINE = 3,
X121_XCA_L_HH_LINE = 4,
X121_XCA_L_LL_LINE = 5,
X121_XCA_H_HH_LINE = 6,
X121_XCA_H_LL_LINE = 7,
X121_XCA_SUPPORT_LINE = 8,
X121_XCA_RESISTANCE_LINE = 9,
X121_XCA_PEAK_LINE = 10,
X121_XCA_PEAK_GOLDEN_LINE = 11,
X121_XCA_VALE_LINE = 12,
X121_XCA_VALE_GOLDEN_LINE = 13,
X121_XCA_FIBO_L1_LINE = 14,
X121_XCA_FIBO_L2_LINE = 15,
X121_XCA_FIBO_L3_LINE = 16,
X121_XCA_FIBO_L4_LINE = 17,
X121_XCA_FIBO_L5_LINE = 18,
X121_XCA_SAR_LINE = 19,
X121_XCA_TREND_LINE = 20,
X121_XCA_KI_LINE = 22,
X121_XCA_SWING_LOW_LINE = 24,
X121_XCA_SWING_HIGH_LINE = 25,
X121_XCA_TKI_LINE = 26,
X121_XCA_VIDYA_LINE = 28,
X121_XCA_MAH_LINE = 30,
X121_XCA_MAL_LINE = 31,
X121_XCA_MAC_LINE = 32,
X121_XCA_TREND_STATE_LINE = 33,
X121_XCA_KI_STATE_LINE = 34,
X121_XCA_TKI_STATE_LINE = 35,
X121_XCA_VIDYA_STATE_LINE = 36,
};
//
// Input Models ...
struct X121XCAInputs
{
//
// Props ...
//
// Market ...
//
// 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
//
// Boundary Detection ...
ENUM_SERIESMODE hhMode; // Highest High Calculation Method
ENUM_SERIESMODE llMode; // Lowest Low Calculation Method
ENUM_X_FIBO_LEVELS goldenZoneLevel; // Golden Zone Detection
//
// Fibo Levels ...
ENUM_X_FIBO_LEVELS fiboLevel1; // Fibo Level 1
ENUM_X_FIBO_LEVELS fiboLevel2; // Fibo Level 2
ENUM_X_FIBO_LEVELS fiboLevel3; // Fibo Level 3
ENUM_X_FIBO_LEVELS fiboLevel4; // Fibo Level 4
ENUM_X_FIBO_LEVELS fiboLevel5; // Fibo Level 5
//
// Sar Detection ...
double sarStep; // Step
double sarMax; // Maximum
//
// KI ...
int kiLength; // KI Length
//
// VIDYA ...
int vidyaCMOLength; // CMO (Candle Momentum) Length
int vidyaEMALength; // EMA Length
ENUM_APPLIED_PRICE vidyaAppliedTo; // Applied To
//
// MANALYSER ...
int manalyserLength; // Length
ENUM_MA_METHOD manalyserMethod; // Method
//
// Swing Detection ...
int swingLength; // Length
//
// Support and Resistance ...
int supResSmoothingLength; // Smoothing Length
ENUM_X_MA_METHOD supResSmoothingMode; // Smoothing Method
//
// Presentation ...
//
int startCalculationForLastBars; // Calculate Last n Bars
//
bool showSar; // Show Sar
bool showKI; // Show KI
bool showTKI; // Show TKI
bool showMAH; // Show MAH
bool showMAL; // Show MAL
bool showMAC; // Show MAC
bool showVidya; // Show Vidya
bool showTrend; // Show Trend
bool showSwings; // Show Swings
bool showFiboLevel1; // Show Fibo Level 1
bool showFiboLevel2; // Show Fibo Level 2
bool showFiboLevel3; // Show Fibo Level 3
bool showFiboLevel4; // Show Fibo Level 4
bool showFiboLevel5; // Show Fibo Level 5
bool showPeaksAndVales; // Show Peaks And Vales
bool showPeakAndValeGolden; // Show Peak and Vale Golden
bool showSupportAndResistance; // Show Support and Resistance
//
bool showShortCycle; // Show Short Cycle
bool showMediumCycle; // Show Medium Cycle
bool showLongCycle; // Show Long Cycle
bool showHindCycle; // Show Hind Cycle
//
int sarArrowCode; // Parabolic Sar Arrow Code
int peakArrowCode; // Peaks Arrow Code
int valeArrowCode; // Vales Arrow Code
int swingLowArrowCode; // Swing Low Arrow Code
int swingHighArrowCode; // Swing High Arrow Code
//
// Constructor(s) ...
X121XCAInputs()
{
//
Clean();
}
//
// Tools ...
//
// Clean ...
void Clean()
{
//
// Market ...
//
// Short ...
scMethod = X_PERIOD_AUTO; // How to Find Period
scPeriod = NULL; // Time Period
//
// Medium ...
mcMethod = X_PERIOD_AUTO; // How to Find Period
mcPeriod = NULL; // Time Period
//
// Long ...
lcMethod = X_PERIOD_AUTO; // How to Find Period
lcPeriod = NULL; // Time Period
//
// Hind ...
hcMethod = X_PERIOD_AUTO; // How to Find Period
hcPeriod = NULL; // Time Period
//
// Boundary Detection ...
hhMode = MODE_HIGH; // Highest High Calculation Method
llMode = MODE_LOW; // Lowest Low Calculation Method
//
// Fibo Levels ...
fiboLevel1 = X_FIBO_LEVEL_236; // Fibo Level 1
fiboLevel2 = X_FIBO_LEVEL_382; // Fibo Level 2
fiboLevel3 = X_FIBO_LEVEL_500; // Fibo Level 3
fiboLevel4 = X_FIBO_LEVEL_618; // Fibo Level 4
fiboLevel5 = X_FIBO_LEVEL_764; // Fibo Level 5
//
// Sar Detection ...
sarStep = 0; // Step
sarMax = 0; // Maximum
//
// KI ...
kiLength = 0; // KI Length
//
// VIDYA ...
vidyaCMOLength = 0;
vidyaEMALength = 0;
vidyaAppliedTo = PRICE_CLOSE;
//
// MANALYSER ...
manalyserLength = 0; // Length
manalyserMethod = MODE_SMA; // Method
//
// Swing Detection ...
swingLength = 0; // Length
//
// Support and Resistance ...
supResSmoothingLength = 0; // Smoothing Length
supResSmoothingMode = X_MA_MODE_NONE; // Smoothing Method
//
// Presentation ...
//
startCalculationForLastBars = 0; // Calculate Last n Bars
//
showSar = false; // Show Sar
showKI = false; // Show KI
showTKI = false; // Show TKI
showMAH = false; // Show MAH
showMAL = false; // Show MAL
showMAC = false; // Show MAC
showVidya = false; // Show Vidya
showTrend = false; // Show Trend
showSwings = false; // Show Swings
showFiboLevel1 = false; // Show Fibo Level 1
showFiboLevel2 = false; // Show Fibo Level 2
showFiboLevel3 = false; // Show Fibo Level 3
showFiboLevel4 = false; // Show Fibo Level 4
showFiboLevel5 = false; // Show Fibo Level 5
showPeaksAndVales = false; // Show Peaks And Vales
showPeakAndValeGolden = false; // Show Peak and Vale Golden
showSupportAndResistance = false; // Show Support and Resistance
//
showShortCycle = false; // Show Short Cycle
showMediumCycle = false; // Show Medium Cycle
showLongCycle = false; // Show Long Cycle
showHindCycle = false; // Show Hind Cycle
//
sarArrowCode = 0; // Parabolic Sar Arrow Code
peakArrowCode = 0; // Peaks Arrow Code
valeArrowCode = 0; // Vales Arrow Code
swingLowArrowCode = 0; // Swing Low Arrow Code
swingHighArrowCode = 0; // Swing High Arrow Code
//
ZeroMemory(this);
}
//
// Default ...
void Default()
{
//
// Market ...
//
// Short ...
scMethod = X_PERIOD_AUTO; // How to Find Period
scPeriod = NULL; // Time Period
//
// Medium ...
mcMethod = X_PERIOD_AUTO; // How to Find Period
mcPeriod = NULL; // Time Period
//
// Long ...
lcMethod = X_PERIOD_AUTO; // How to Find Period
lcPeriod = NULL; // Time Period
//
// Hind ...
hcMethod = X_PERIOD_AUTO; // How to Find Period
hcPeriod = NULL; // Time Period
//
// Boundary Detection ...
hhMode = MODE_HIGH; // Highest High Calculation Method
llMode = MODE_LOW; // Lowest Low Calculation Method
//
// Fibo Levels ...
fiboLevel1 = X_FIBO_LEVEL_236; // Fibo Level 1
fiboLevel2 = X_FIBO_LEVEL_382; // Fibo Level 2
fiboLevel3 = X_FIBO_LEVEL_500; // Fibo Level 3
fiboLevel4 = X_FIBO_LEVEL_618; // Fibo Level 4
fiboLevel5 = X_FIBO_LEVEL_764; // Fibo Level 5
//
// Sar Detection ...
sarStep = 0.02; // Step
sarMax = 0.2; // Maximum
//
// KI ...
kiLength = 26; // KI Length
//
// VIDYA ...
vidyaCMOLength = 20;
vidyaEMALength = 14;
vidyaAppliedTo = PRICE_CLOSE;
//
// MANALYSER ...
manalyserLength = 14; // Length
manalyserMethod = MODE_SMA; // Method
//
// Swing Detection ...
swingLength = 5; // Length
//
// Presentation ...
//
startCalculationForLastBars = 1000; // Calculate Last n Bars
//
showSar = true; // Show Sar
showKI = true; // Show KI
showTKI = true; // Show TKI
showMAH = true; // Show MAH
showMAL = true; // Show MAL
showMAC = true; // Show MAC
showVidya = true; // Show Vidya
showTrend = true; // Show Trend
showSwings = true; // Show Swings
showFiboLevel1 = true; // Show Fibo Level 1
showFiboLevel2 = true; // Show Fibo Level 2
showFiboLevel3 = true; // Show Fibo Level 3
showFiboLevel4 = true; // Show Fibo Level 4
showFiboLevel5 = true; // Show Fibo Level 5
showPeaksAndVales = true; // Show Peaks And Vales
showPeakAndValeGolden = true; // Show Peak and Vale Golden
showSupportAndResistance = true; // Show Support and Resistance
//
showShortCycle = true; // Show Short Cycle
showMediumCycle = true; // Show Medium Cycle
showLongCycle = true; // Show Long Cycle
showHindCycle = true; // Show Hind Cycle
//
sarArrowCode = 159; // Parabolic Sar Arrow Code
peakArrowCode = 159; // Peaks Arrow Code
valeArrowCode = 159; // Vales Arrow Code
swingLowArrowCode = 225; // Swing Low Arrow Code
swingHighArrowCode = 226; // Swing High Arrow Code
}
//
// Hide all Visible Buffers ...
void Hide()
{
//
showSar = false; // Show Sar
showKI = false; // Show KI
showTKI = false; // Show TKI
showMAH = false; // Show MAH
showMAL = false; // Show MAL
showMAC = false; // Show MAC
showVidya = false; // Show Vidya
showTrend = false; // Show Trend
showSwings = false; // Show Swings
showFiboLevel1 = false; // Show Fibo Level 1
showFiboLevel2 = false; // Show Fibo Level 2
showFiboLevel3 = false; // Show Fibo Level 3
showFiboLevel4 = false; // Show Fibo Level 4
showFiboLevel5 = false; // Show Fibo Level 5
showPeaksAndVales = false; // Show Peaks And Vales
showPeakAndValeGolden = false; // Show Peak and Vale Golden
showSupportAndResistance = false; // Show Support and Resistance
//
showShortCycle = false; // Show Short Cycle
showMediumCycle = false; // Show Medium Cycle
showLongCycle = false; // Show Long Cycle
showHindCycle = false; // Show Hind Cycle
}
//
// Validate ...
bool IsValid()
{
//
bool result = false;
//
result =
//
// SAR ...
sarMax > 0 &&
sarStep > 0 &&
kiLength > 0 &&
swingLength > 0 &&
sarMax > sarStep &&
vidyaCMOLength > 0 &&
vidyaEMALength > 0 &&
manalyserLength > 0 &&
//
// XCA ...
(IsValid(scMethod, scPeriod) &&
IsValid(mcMethod, mcPeriod) &&
IsValid(lcMethod, lcPeriod) &&
IsValid(hcMethod, hcPeriod))
//
;
//
return result;
}
//
// Retrieve MAx Length ...
int Max()
{
//
int result = 0;
//
result = MathMax(kiLength, swingLength);
result = MathMax(result, vidyaCMOLength);
result = MathMax(result, vidyaEMALength);
result = MathMax(result, manalyserLength);
//
return result;
}
};
//
// Conditions ...
struct X121XCAConditions
{
//
// Common ...
string symbol;
ENUM_TIMEFRAMES period;
datetime time;
//
// Buffers ...
double kiBuffer[];
double tkiBuffer[];
double sHHBuffer[];
double sLLBuffer[];
double mHHBuffer[];
double mLLBuffer[];
double lHHBuffer[];
double lLLBuffer[];
double hHHBuffer[];
double hLLBuffer[];
double sarBuffer[];
double mahBuffer[];
double malBuffer[];
double macBuffer[];
double peakBuffer[];
double valeBuffer[];
double vidyaBuffer[];
double trendBuffer[];
double kiStateBuffer[];
double supportBuffer[];
double tkiStateBuffer[];
double swingLowBuffer[];
double swingHighBuffer[];
double vidyaStateBuffer[];
double resistanceBuffer[];
double peakGoldenBuffer[];
double valeGoldenBuffer[];
double fiboLevel1Buffer[];
double fiboLevel2Buffer[];
double fiboLevel3Buffer[];
double fiboLevel4Buffer[];
double fiboLevel5Buffer[];
double trendStateBuffer[];
//
// Conditions ...
//
// KI ...
//
bool isKIRejectUp;
bool isKIRejectDown;
//
bool isKIBullish;
bool isKIBearish;
//
bool isKISwitchedToBullish;
bool isKISwitchedToBearish;
//
bool isKIFinishedFromBullish;
bool isKIFinishedFromBearish;
//
// TKI ...
//
bool isTKIRejectUp;
bool isTKIRejectDown;
//
bool isTKIBullish;
bool isTKIBearish;
//
bool isTKISwitchedToBullish;
bool isTKISwitchedToBearish;
//
bool isTKIFinishedFromBullish;
bool isTKIFinishedFromBearish;
//
// VIDYA ...
//
bool isVidyaRejectUp;
bool isVidyaRejectDown;
//
bool isVidyaBullish;
bool isVidyaBearish;
//
bool isVidyaSwitchedToBullish;
bool isVidyaSwitchedToBearish;
//
bool isVidyaFinishedFromBullish;
bool isVidyaFinishedFromBearish;
//
// SAR ...
//
bool isSarBullish;
bool isSarBearish;
//
bool isSarSwitchedToBullish;
bool isSarSwitchedToBearish;
//
bool isSarFinishedFromBullish;
bool isSarFinishedFromBearish;
//
// MANALYSER ...
//
// MAH ...
//
bool isOverMah;
bool isUnderMah;
bool isCrossedOverMah;
bool isCrossedUnderMah;
//
bool isCloseOverMah;
bool isCloseUnderMah;
bool isCloseCrossedOverMah;
bool isCloseCrossedUnderMah;
//
bool isMahBullishRejected;
bool isMahBearishRejected;
//
// MAL ...
//
bool isOverMal;
bool isUnderMal;
bool isCrossedOverMal;
bool isCrossedUnderMal;
//
bool isCloseOverMal;
bool isCloseUnderMal;
bool isCloseCrossedOverMal;
bool isCloseCrossedUnderMal;
//
bool isMalBullishRejected;
bool isMalBearishRejected;
//
// MAC ...
//
bool isOverMac;
bool isUnderMac;
bool isCrossedOverMac;
bool isCrossedUnderMac;
//
bool isCloseOverMac;
bool isCloseUnderMac;
bool isCloseCrossedOverMac;
bool isCloseCrossedUnderMac;
//
bool isMacBullishRejected;
bool isMacBearishRejected;
//
// PEAK ...
//
bool isPeakSameLast;
bool isPeakOverLast;
bool isPeakUnderLast;
//
// VALE ...
//
bool isValeSameLast;
bool isValeOverLast;
bool isValeUnderLast;
//
// TREND ...
//
bool isTrendRejectUp;
bool isTrendRejectDown;
//
bool isTrendBullish;
bool isTrendBearish;
//
bool isTrendSwitchedToBullish;
bool isTrendSwitchedToBearish;
//
bool isTrendFinishedFromBullish;
bool isTrendFinishedFromBearish;
//
// SUPPORT ...
//
bool isSupportSameLast;
bool isSupportOverLast;
bool isSupportUnderLast;
//
bool isLastSupportBreaked;
bool isLastSupportRejected;
//
// RESISTANCE ...
//
bool isResistanceSameLast;
bool isResistanceOverLast;
bool isResistanceUnderLast;
//
bool isLastResistanceBreaked;
bool isLastResistanceRejected;
//
// SWING Low ...
//
bool isSwingLowSameLast;
bool isSwingLowOverLast;
bool isSwingLowUnderLast;
//
bool isLastSwingLowBreaked;
bool isLastSwingLowRejected;
//
// SWING High ...
//
bool isSwingHighSameLast;
bool isSwingHighOverLast;
bool isSwingHighUnderLast;
//
bool isLastSwingHighBreaked;
bool isLastSwingHighRejected;
//
// COMPLEX Conditions ...
//
bool isPeakIsPivot;
bool isValeIsPivot;
//
bool isPeakSwitchedToPivot;
bool isValeSwitchedToPivot;
//
bool isPeakFinishedFromPivot;
bool isValeFinishedFromPivot;
//
bool isSwingLowSameAsVale;
bool isSwingHighSameAsPeak;
//
bool isSupportSameAsVale;
bool isResistanceSameAsPeak;
//
bool isSupportSameAsSwingLow;
bool isResistanceSameAsSwingHigh;
//
// Constructor ...
X121XCAConditions()
{
Clean();
}
//
// Tools ...
/**
* Cleaning Up ...
*/
void Clean()
{
//
// Commons ...
symbol = NULL;
period = NULL;
time = NULL;
//
// Buffers ...
//
Clean(kiBuffer);
Clean(tkiBuffer);
Clean(sHHBuffer);
Clean(sLLBuffer);
Clean(mHHBuffer);
Clean(mLLBuffer);
Clean(lHHBuffer);
Clean(lLLBuffer);
Clean(hHHBuffer);
Clean(hLLBuffer);
Clean(sarBuffer);
Clean(mahBuffer);
Clean(malBuffer);
Clean(macBuffer);
Clean(peakBuffer);
Clean(valeBuffer);
Clean(vidyaBuffer);
Clean(trendBuffer);
Clean(kiStateBuffer);
Clean(supportBuffer);
Clean(tkiStateBuffer);
Clean(swingLowBuffer);
Clean(swingHighBuffer);
Clean(resistanceBuffer);
Clean(peakGoldenBuffer);
Clean(valeGoldenBuffer);
Clean(fiboLevel1Buffer);
Clean(fiboLevel2Buffer);
Clean(fiboLevel3Buffer);
Clean(fiboLevel4Buffer);
Clean(fiboLevel5Buffer);
Clean(vidyaStateBuffer);
Clean(trendStateBuffer);
//
ArraySetAsSeries(kiBuffer, true);
ArraySetAsSeries(tkiBuffer, true);
ArraySetAsSeries(sHHBuffer, true);
ArraySetAsSeries(sLLBuffer, true);
ArraySetAsSeries(mHHBuffer, true);
ArraySetAsSeries(mLLBuffer, true);
ArraySetAsSeries(lHHBuffer, true);
ArraySetAsSeries(lLLBuffer, true);
ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true);
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(mahBuffer, true);
ArraySetAsSeries(malBuffer, true);
ArraySetAsSeries(macBuffer, true);
ArraySetAsSeries(peakBuffer, true);
ArraySetAsSeries(valeBuffer, true);
ArraySetAsSeries(vidyaBuffer, true);
ArraySetAsSeries(trendBuffer, true);
ArraySetAsSeries(kiStateBuffer, true);
ArraySetAsSeries(supportBuffer, true);
ArraySetAsSeries(tkiStateBuffer, true);
ArraySetAsSeries(swingLowBuffer, true);
ArraySetAsSeries(swingHighBuffer, true);
ArraySetAsSeries(resistanceBuffer, true);
ArraySetAsSeries(peakGoldenBuffer, true);
ArraySetAsSeries(valeGoldenBuffer, true);
ArraySetAsSeries(fiboLevel1Buffer, true);
ArraySetAsSeries(fiboLevel2Buffer, true);
ArraySetAsSeries(fiboLevel3Buffer, true);
ArraySetAsSeries(fiboLevel4Buffer, true);
ArraySetAsSeries(fiboLevel5Buffer, true);
ArraySetAsSeries(vidyaStateBuffer, true);
ArraySetAsSeries(trendStateBuffer, true);
//
// Conditions ...
//
// KI ...
//
isKIRejectUp = false;
isKIRejectDown = false;
//
isKIBullish = false;
isKIBearish = false;
//
isKISwitchedToBullish = false;
isKISwitchedToBearish = false;
//
isKIFinishedFromBullish = false;
isKIFinishedFromBearish = false;
//
// TKI ...
//
isTKIRejectUp = false;
isTKIRejectDown = false;
//
isTKIBullish = false;
isTKIBearish = false;
//
isTKISwitchedToBullish = false;
isTKISwitchedToBearish = false;
//
isTKIFinishedFromBullish = false;
isTKIFinishedFromBearish = false;
//
// VIDYA ...
//
isVidyaRejectUp = false;
isVidyaRejectDown = false;
//
isVidyaBullish = false;
isVidyaBearish = false;
//
isVidyaSwitchedToBullish = false;
isVidyaSwitchedToBearish = false;
//
isVidyaFinishedFromBullish = false;
isVidyaFinishedFromBearish = false;
//
// SAR ...
//
isSarBullish = false;
isSarBearish = false;
//
isSarSwitchedToBullish = false;
isSarSwitchedToBearish = false;
//
isSarFinishedFromBullish = false;
isSarFinishedFromBearish = false;
//
// MANALYSER ...
//
// MAH ...
//
isOverMah = false;
isUnderMah = false;
isCrossedOverMah = false;
isCrossedUnderMah = false;
//
isCloseOverMah = false;
isCloseUnderMah = false;
isCloseCrossedOverMah = false;
isCloseCrossedUnderMah = false;
//
isMahBullishRejected = false;
isMahBearishRejected = false;
//
// MAL ...
//
isOverMal = false;
isUnderMal = false;
isCrossedOverMal = false;
isCrossedUnderMal = false;
//
isCloseOverMal = false;
isCloseUnderMal = false;
isCloseCrossedOverMal = false;
isCloseCrossedUnderMal = false;
//
isMalBullishRejected = false;
isMalBearishRejected = false;
//
// MAC ...
//
isOverMac = false;
isUnderMac = false;
isCrossedOverMac = false;
isCrossedUnderMac = false;
//
isCloseOverMac = false;
isCloseUnderMac = false;
isCloseCrossedOverMac = false;
isCloseCrossedUnderMac = false;
//
isMacBullishRejected = false;
isMacBearishRejected = false;
//
// PEAK ...
//
isPeakSameLast = false;
isPeakOverLast = false;
isPeakUnderLast = false;
//
// VALE ...
//
isValeSameLast = false;
isValeOverLast = false;
isValeUnderLast = false;
//
// TREND ...
//
isTrendRejectUp = false;
isTrendRejectDown = false;
//
isTrendBullish = false;
isTrendBearish = false;
//
isTrendSwitchedToBullish = false;
isTrendSwitchedToBearish = false;
//
isTrendFinishedFromBullish = false;
isTrendFinishedFromBearish = false;
//
// SUPPORT ...
//
isSupportSameLast = false;
isSupportOverLast = false;
isSupportUnderLast = false;
//
isLastSupportBreaked = false;
isLastSupportRejected = false;
//
// RESISTANCE ...
//
isResistanceSameLast = false;
isResistanceOverLast = false;
isResistanceUnderLast = false;
//
isLastResistanceBreaked = false;
isLastResistanceRejected = false;
//
// SWING Low ...
//
isSwingLowSameLast = false;
isSwingLowOverLast = false;
isSwingLowUnderLast = false;
//
isLastSwingLowBreaked = false;
isLastSwingLowRejected = false;
//
// SWING High ...
//
isSwingHighSameLast = false;
isSwingHighOverLast = false;
isSwingHighUnderLast = false;
//
isLastSwingHighBreaked = false;
isLastSwingHighRejected = false;
//
// COMPLEX Conditions ...
//
isPeakIsPivot = false;
isValeIsPivot = false;
//
isPeakSwitchedToPivot = false;
isValeSwitchedToPivot = false;
//
isPeakFinishedFromPivot = false;
isValeFinishedFromPivot = false;
//
isSwingLowSameAsVale = false;
isSwingHighSameAsPeak = false;
//
isSupportSameAsVale = false;
isResistanceSameAsPeak = false;
//
isSupportSameAsSwingLow = false;
isResistanceSameAsSwingHigh = false;
//
ZeroMemory(this);
}
/**
* Generate Conditions Scores ...
*
* @param bullishScore: Double, Directional Scores Reference ...
* @param bearishScore: Double, Directional Scores Reference ...
*/
void GenerateScore(
double &bullishScore,
double &bearishScore //
)
{
//
bullishScore = 0;
bearishScore = 0;
//
double score = 1;
double minScore = 0.5;
double highScore = 1.5;
//
// KI ...
//
if (isKIBullish)
{
bullishScore += minScore;
}
if (isKIRejectUp)
{
bullishScore += minScore;
}
if (isKISwitchedToBullish)
{
bullishScore += minScore;
}
//
if (isKIBearish)
{
bearishScore += minScore;
}
if (isKIRejectDown)
{
bearishScore += minScore;
}
if (isKISwitchedToBearish)
{
bearishScore += minScore;
}
//
// TKI ...
//
if (isTKIBullish)
{
bullishScore += minScore;
}
if (isTKIRejectUp)
{
bullishScore += minScore;
}
if (isTKISwitchedToBullish)
{
bullishScore += minScore;
}
//
if (isTKIBearish)
{
bearishScore += minScore;
}
if (isTKIRejectDown)
{
bearishScore += minScore;
}
if (isTKISwitchedToBearish)
{
bearishScore += minScore;
}
//
// VIDYA ...
//
if (isVidyaBullish)
{
bullishScore += minScore;
}
if (isVidyaRejectUp)
{
bullishScore += minScore;
}
if (isVidyaSwitchedToBullish)
{
bullishScore += minScore;
}
//
if (isVidyaBearish)
{
bearishScore += minScore;
}
if (isVidyaRejectDown)
{
bearishScore += minScore;
}
if (isVidyaSwitchedToBearish)
{
bearishScore += minScore;
}
//
// SAR ...
//
if (isSarBullish)
{
bullishScore += minScore;
}
if (isSarSwitchedToBullish)
{
bullishScore += minScore;
}
//
if (isSarBearish)
{
bearishScore += minScore;
}
if (isSarSwitchedToBearish)
{
bearishScore += minScore;
}
//
// MANALYSER ...
//
// MAH ...
//
if (isUnderMah)
{
bullishScore += minScore;
}
if (isCloseUnderMah)
{
bullishScore += minScore;
}
if (isCrossedUnderMah)
{
bullishScore += minScore;
}
if (isMahBullishRejected)
{
bullishScore += minScore;
}
if (isCloseCrossedUnderMah)
{
bullishScore += minScore;
}
//
if (isOverMah)
{
bearishScore += minScore;
}
if (isCloseOverMah)
{
bearishScore += minScore;
}
if (isCrossedOverMah)
{
bearishScore += minScore;
}
if (isMahBearishRejected)
{
bearishScore += minScore;
}
if (isCloseCrossedOverMah)
{
bearishScore += minScore;
}
//
//
// MAL ...
//
if (isOverMal)
{
bullishScore += minScore;
}
if (isCloseOverMal)
{
bullishScore += minScore;
}
if (isCrossedOverMal)
{
bullishScore += minScore;
}
if (isMalBullishRejected)
{
bullishScore += minScore;
}
if (isCloseCrossedOverMal)
{
bullishScore += minScore;
}
//
if (isUnderMal)
{
bearishScore += minScore;
}
if (isCloseUnderMal)
{
bearishScore += minScore;
}
if (isCrossedUnderMal)
{
bearishScore += minScore;
}
if (isMalBearishRejected)
{
bearishScore += minScore;
}
if (isCloseCrossedUnderMal)
{
bearishScore += minScore;
}
//
// MAC ...
//
if (isOverMac)
{
bullishScore += minScore;
}
if (isCloseOverMac)
{
bullishScore += minScore;
}
if (isCrossedOverMac)
{
bullishScore += minScore;
}
if (isMacBullishRejected)
{
bullishScore += minScore;
}
if (isCloseCrossedOverMac)
{
bullishScore += minScore;
}
//
if (isUnderMac)
{
bearishScore += minScore;
}
if (isCloseUnderMac)
{
bearishScore += minScore;
}
if (isCrossedUnderMac)
{
bearishScore += minScore;
}
if (isMacBearishRejected)
{
bearishScore += minScore;
}
if (isCloseCrossedUnderMac)
{
bearishScore += minScore;
}
//
// TREND ...
//
if (isTrendBullish)
{
bullishScore += minScore;
}
if (isTrendRejectUp)
{
bullishScore += minScore;
}
if (isTrendSwitchedToBullish)
{
bullishScore += minScore;
}
//
if (isTrendBearish)
{
bearishScore += minScore;
}
if (isTrendRejectDown)
{
bearishScore += minScore;
}
if (isTrendSwitchedToBearish)
{
bearishScore += minScore;
}
//
// SUPPORT ...
//
if (isSupportSameLast)
{
bullishScore += minScore;
}
if (isSupportOverLast)
{
bullishScore += minScore;
}
if (isLastSupportRejected)
{
bullishScore += minScore;
}
//
if (isSupportUnderLast)
{
bearishScore += minScore;
}
if (isLastSupportBreaked)
{
bearishScore += minScore;
}
//
// RESISTANCE ...
//
if (isResistanceOverLast)
{
bullishScore += minScore;
}
if (isLastResistanceBreaked)
{
bullishScore += minScore;
}
//
if (isResistanceSameLast)
{
bearishScore += minScore;
}
if (isResistanceUnderLast)
{
bearishScore += minScore;
}
if (isLastResistanceRejected)
{
bearishScore += minScore;
}
//
// SWING Low ...
//
if (isSwingLowSameLast)
{
bullishScore += minScore;
}
if (isSwingLowOverLast)
{
bullishScore += minScore;
}
if (isLastSwingLowRejected)
{
bullishScore += minScore;
}
//
if (isSwingLowUnderLast)
{
bearishScore += minScore;
}
if (isLastSwingLowBreaked)
{
bearishScore += minScore;
}
//
// SWING High ...
//
if (isSwingHighOverLast)
{
bullishScore += minScore;
}
if (isLastSwingHighBreaked)
{
bullishScore += minScore;
}
//
if (isSwingHighSameLast)
{
bearishScore += minScore;
}
if (isSwingHighUnderLast)
{
bearishScore += minScore;
}
if (isLastSwingHighRejected)
{
bearishScore += minScore;
}
//
// COMPLEX Conditions ...
//
if (isValeIsPivot)
{
bullishScore += score;
}
if (isSupportSameAsVale)
{
bullishScore += score;
}
if (isSwingLowSameAsVale)
{
bullishScore += score;
}
if (isSupportSameAsSwingLow)
{
bullishScore += score;
}
//
if (isPeakIsPivot)
{
bearishScore += score;
}
if (isSwingHighSameAsPeak)
{
bearishScore += score;
}
if (isResistanceSameAsPeak)
{
bearishScore += score;
}
if (isResistanceSameAsSwingHigh)
{
bearishScore += score;
}
//
}
/**
* Generate Summary String for Represent Conditions State ...
*
* @param onlyCommons: Boolean, Just Generate Only Commons Conditions ...
* @param onlyConditions: Boolean, Just Generate Only Conditions ...
* @param includeScores: Boolean, Attach Scores Representations on Result ...
* @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ...
* @param separator: String, Separate Lines ...
*
* @return ( string )
*/
string GenerateSummary(
bool onlyCommons = false,
bool onlyConditions = false,
bool includeScores = true,
bool ignoreFalseConditions = true,
string separator = "\n" //
)
{
//
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 =
//
"-----------------------" + separator +
"XCA: " + separator +
"-----------------------" + separator +
ToString("isKIRejectUp", isKIRejectUp, ignoreFalseConditions, separator) +
ToString("isKIRejectDown", isKIRejectDown, ignoreFalseConditions, separator) +
ToString("isKIBullish", isKIBullish, ignoreFalseConditions, separator) +
ToString("isKIBearish", isKIBearish, ignoreFalseConditions, separator) +
ToString("isKISwitchedToBullish", isKISwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isKIFinishedFromBullish", isKIFinishedFromBullish, ignoreFalseConditions, separator) +
ToString("isKISwitchedToBearish", isKISwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isKIFinishedFromBearish", isKIFinishedFromBearish, ignoreFalseConditions, separator) +
ToString("isTKIRejectUp", isTKIRejectUp, ignoreFalseConditions, separator) +
ToString("isTKIRejectDown", isTKIRejectDown, ignoreFalseConditions, separator) +
ToString("isTKIBullish", isTKIBullish, ignoreFalseConditions, separator) +
ToString("isTKIBearish", isTKIBearish, ignoreFalseConditions, separator) +
ToString("isTKISwitchedToBullish", isTKISwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isTKIFinishedFromBullish", isTKIFinishedFromBullish, ignoreFalseConditions, separator) +
ToString("isTKISwitchedToBearish", isTKISwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isTKIFinishedFromBearish", isTKIFinishedFromBearish, ignoreFalseConditions, separator) +
ToString("isVidyaRejectUp", isVidyaRejectUp, ignoreFalseConditions, separator) +
ToString("isVidyaRejectDown", isVidyaRejectDown, ignoreFalseConditions, separator) +
ToString("isVidyaBullish", isVidyaBullish, ignoreFalseConditions, separator) +
ToString("isVidyaBearish", isVidyaBearish, ignoreFalseConditions, separator) +
ToString("isVidyaSwitchedToBullish", isVidyaSwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isVidyaFinishedFromBullish", isVidyaFinishedFromBullish, ignoreFalseConditions, separator) +
ToString("isVidyaSwitchedToBearish", isVidyaSwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isVidyaFinishedFromBearish", isVidyaFinishedFromBearish, ignoreFalseConditions, separator) +
ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) +
ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) +
ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isSarFinishedFromBullish", isSarFinishedFromBullish, ignoreFalseConditions, separator) +
ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isSarFinishedFromBearish", isSarFinishedFromBearish, ignoreFalseConditions, separator) +
ToString("isOverMah", isOverMah, ignoreFalseConditions, separator) +
ToString("isUnderMah", isUnderMah, ignoreFalseConditions, separator) +
ToString("isCrossedOverMah", isCrossedOverMah, ignoreFalseConditions, separator) +
ToString("isCrossedUnderMah", isCrossedUnderMah, ignoreFalseConditions, separator) +
ToString("isCloseOverMah", isCloseOverMah, ignoreFalseConditions, separator) +
ToString("isCloseUnderMah", isCloseUnderMah, ignoreFalseConditions, separator) +
ToString("isCloseCrossedOverMah", isCloseCrossedOverMah, ignoreFalseConditions, separator) +
ToString("isCloseCrossedUnderMah", isCloseCrossedUnderMah, ignoreFalseConditions, separator) +
ToString("isMahBullishRejected", isMahBullishRejected, ignoreFalseConditions, separator) +
ToString("isMahBearishRejected", isMahBearishRejected, ignoreFalseConditions, separator) +
ToString("isOverMal", isOverMal, ignoreFalseConditions, separator) +
ToString("isUnderMal", isUnderMal, ignoreFalseConditions, separator) +
ToString("isCrossedOverMal", isCrossedOverMal, ignoreFalseConditions, separator) +
ToString("isCrossedUnderMal", isCrossedUnderMal, ignoreFalseConditions, separator) +
ToString("isCloseOverMal", isCloseOverMal, ignoreFalseConditions, separator) +
ToString("isCloseUnderMal", isCloseUnderMal, ignoreFalseConditions, separator) +
ToString("isCloseCrossedOverMal", isCloseCrossedOverMal, ignoreFalseConditions, separator) +
ToString("isCloseCrossedUnderMal", isCloseCrossedUnderMal, ignoreFalseConditions, separator) +
ToString("isMalBullishRejected", isMalBullishRejected, ignoreFalseConditions, separator) +
ToString("isMalBearishRejected", isMalBearishRejected, ignoreFalseConditions, separator) +
ToString("isOverMac", isOverMac, ignoreFalseConditions, separator) +
ToString("isUnderMac", isUnderMac, ignoreFalseConditions, separator) +
ToString("isCrossedOverMac", isCrossedOverMac, ignoreFalseConditions, separator) +
ToString("isCrossedUnderMac", isCrossedUnderMac, ignoreFalseConditions, separator) +
ToString("isCloseOverMac", isCloseOverMac, ignoreFalseConditions, separator) +
ToString("isCloseUnderMac", isCloseUnderMac, ignoreFalseConditions, separator) +
ToString("isCloseCrossedOverMac", isCloseCrossedOverMac, ignoreFalseConditions, separator) +
ToString("isCloseCrossedUnderMac", isCloseCrossedUnderMac, ignoreFalseConditions, separator) +
ToString("isMacBullishRejected", isMacBullishRejected, ignoreFalseConditions, separator) +
ToString("isMacBearishRejected", isMacBearishRejected, ignoreFalseConditions, separator) +
ToString("isPeakSameLast", isPeakSameLast, ignoreFalseConditions, separator) +
ToString("isPeakOverLast", isPeakOverLast, ignoreFalseConditions, separator) +
ToString("isPeakUnderLast", isPeakUnderLast, ignoreFalseConditions, separator) +
ToString("isValeSameLast", isValeSameLast, ignoreFalseConditions, separator) +
ToString("isValeOverLast", isValeOverLast, ignoreFalseConditions, separator) +
ToString("isValeUnderLast", isValeUnderLast, ignoreFalseConditions, separator) +
ToString("isTrendRejectUp", isTrendRejectUp, ignoreFalseConditions, separator) +
ToString("isTrendRejectDown", isTrendRejectDown, ignoreFalseConditions, separator) +
ToString("isTrendBullish", isTrendBullish, ignoreFalseConditions, separator) +
ToString("isTrendBearish", isTrendBearish, ignoreFalseConditions, separator) +
ToString("isTrendSwitchedToBullish", isTrendSwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isTrendFinishedFromBullish", isTrendFinishedFromBullish, ignoreFalseConditions, separator) +
ToString("isTrendSwitchedToBearish", isTrendSwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isTrendFinishedFromBearish", isTrendFinishedFromBearish, ignoreFalseConditions, separator) +
ToString("isSupportSameLast", isSupportSameLast, ignoreFalseConditions, separator) +
ToString("isSupportOverLast", isSupportOverLast, ignoreFalseConditions, separator) +
ToString("isSupportUnderLast", isSupportUnderLast, ignoreFalseConditions, separator) +
ToString("isLastSupportBreaked", isLastSupportBreaked, ignoreFalseConditions, separator) +
ToString("isLastSupportRejected", isLastSupportRejected, ignoreFalseConditions, separator) +
ToString("isResistanceSameLast", isResistanceSameLast, ignoreFalseConditions, separator) +
ToString("isResistanceOverLast", isResistanceOverLast, ignoreFalseConditions, separator) +
ToString("isResistanceUnderLast", isResistanceUnderLast, ignoreFalseConditions, separator) +
ToString("isLastResistanceBreaked", isLastResistanceBreaked, ignoreFalseConditions, separator) +
ToString("isLastResistanceRejected", isLastResistanceRejected, ignoreFalseConditions, separator) +
ToString("isSwingLowSameLast", isSwingLowSameLast, ignoreFalseConditions, separator) +
ToString("isSwingLowOverLast", isSwingLowOverLast, ignoreFalseConditions, separator) +
ToString("isSwingLowUnderLast", isSwingLowUnderLast, ignoreFalseConditions, separator) +
ToString("isLastSwingLowBreaked", isLastSwingLowBreaked, ignoreFalseConditions, separator) +
ToString("isLastSwingLowRejected", isLastSwingLowRejected, ignoreFalseConditions, separator) +
ToString("isSwingHighSameLast", isSwingHighSameLast, ignoreFalseConditions, separator) +
ToString("isSwingHighOverLast", isSwingHighOverLast, ignoreFalseConditions, separator) +
ToString("isSwingHighUnderLast", isSwingHighUnderLast, ignoreFalseConditions, separator) +
ToString("isLastSwingHighBreaked", isLastSwingHighBreaked, ignoreFalseConditions, separator) +
ToString("isLastSwingHighRejected", isLastSwingHighRejected, ignoreFalseConditions, separator) +
ToString("isPeakIsPivot", isPeakIsPivot, ignoreFalseConditions, separator) +
ToString("isValeIsPivot", isValeIsPivot, ignoreFalseConditions, separator) +
ToString("isPeakSwitchedToPivot", isPeakSwitchedToPivot, ignoreFalseConditions, separator) +
ToString("isPeakFinishedFromPivot", isPeakFinishedFromPivot, ignoreFalseConditions, separator) +
ToString("isValeSwitchedToPivot", isValeSwitchedToPivot, ignoreFalseConditions, separator) +
ToString("isValeFinishedFromPivot", isValeFinishedFromPivot, ignoreFalseConditions, separator) +
ToString("isSwingLowSameAsVale", isSwingLowSameAsVale, ignoreFalseConditions, separator) +
ToString("isSwingHighSameAsPeak", isSwingHighSameAsPeak, ignoreFalseConditions, separator) +
ToString("isSupportSameAsVale", isSupportSameAsVale, ignoreFalseConditions, separator) +
ToString("isResistanceSameAsPeak", isResistanceSameAsPeak, ignoreFalseConditions, separator) +
ToString("isSupportSameAsSwingLow", isSupportSameAsSwingLow, ignoreFalseConditions, separator) +
ToString("isResistanceSameAsSwingHigh", isResistanceSameAsSwingHigh, ignoreFalseConditions, separator) +
//
""
//
;
//
result =
//
"[" + GetTag() + "]" + separator +
(onlyConditions
? ""
: commonStr) +
(!includeScores
? ""
: scoresStr) +
" " + separator +
(onlyCommons
? ""
: conditionsStr) +
""
//
;
//
return result;
}
/**
* Retrieve nique Tag Identifier ...
*
* @return ( string )
*/
string GetTag()
{
return GetTypeName(this);
}
//
};
//
// Class ...
class XCX121XCAHelper : public XCBaseHelper
{
//
// Public ...
public:
//
// Props ...
//
// Constructors ...
XCX121XCAHelper()
: XCBaseHelper(_Symbol, _Period)
{
}
//
// Deconstructor ...
~XCX121XCAHelper()
{
//
mInputs.Clean();
//
Clean(kiBuffer);
Clean(tkiBuffer);
Clean(sHHBuffer);
Clean(sLLBuffer);
Clean(mHHBuffer);
Clean(mLLBuffer);
Clean(lHHBuffer);
Clean(lLLBuffer);
Clean(hHHBuffer);
Clean(hLLBuffer);
Clean(sarBuffer);
Clean(mahBuffer);
Clean(malBuffer);
Clean(macBuffer);
Clean(peakBuffer);
Clean(valeBuffer);
Clean(vidyaBuffer);
Clean(trendBuffer);
Clean(kiStateBuffer);
Clean(supportBuffer);
Clean(tkiStateBuffer);
Clean(swingLowBuffer);
Clean(swingHighBuffer);
Clean(resistanceBuffer);
Clean(peakGoldenBuffer);
Clean(valeGoldenBuffer);
Clean(fiboLevel1Buffer);
Clean(fiboLevel2Buffer);
Clean(fiboLevel3Buffer);
Clean(fiboLevel4Buffer);
Clean(fiboLevel5Buffer);
Clean(trendStateBuffer);
Clean(vidyaStateBuffer);
}
//
// Tools ...
bool Init(
string symbol, // Trading Symbol
ENUM_TIMEFRAMES period, // Trading Period
X121XCAInputs &inputs // Inputs
)
{
//
bool result = false;
//
mSymbol = symbol;
mPeriod = period;
//
result = inputs.IsValid();
if (!result)
{
return result;
}
//
ArraySetAsSeries(kiBuffer, true);
ArraySetAsSeries(tkiBuffer, true);
ArraySetAsSeries(sHHBuffer, true);
ArraySetAsSeries(sLLBuffer, true);
ArraySetAsSeries(mHHBuffer, true);
ArraySetAsSeries(mLLBuffer, true);
ArraySetAsSeries(lHHBuffer, true);
ArraySetAsSeries(lLLBuffer, true);
ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true);
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(mahBuffer, true);
ArraySetAsSeries(malBuffer, true);
ArraySetAsSeries(macBuffer, true);
ArraySetAsSeries(peakBuffer, true);
ArraySetAsSeries(valeBuffer, true);
ArraySetAsSeries(vidyaBuffer, true);
ArraySetAsSeries(trendBuffer, true);
ArraySetAsSeries(kiStateBuffer, true);
ArraySetAsSeries(supportBuffer, true);
ArraySetAsSeries(tkiStateBuffer, true);
ArraySetAsSeries(swingLowBuffer, true);
ArraySetAsSeries(swingHighBuffer, true);
ArraySetAsSeries(resistanceBuffer, true);
ArraySetAsSeries(peakGoldenBuffer, true);
ArraySetAsSeries(valeGoldenBuffer, true);
ArraySetAsSeries(fiboLevel1Buffer, true);
ArraySetAsSeries(fiboLevel2Buffer, true);
ArraySetAsSeries(fiboLevel3Buffer, true);
ArraySetAsSeries(fiboLevel4Buffer, true);
ArraySetAsSeries(fiboLevel5Buffer, true);
ArraySetAsSeries(vidyaStateBuffer, true);
ArraySetAsSeries(trendStateBuffer, true);
//
mInputs = inputs;
//
mHandler = iCustom(
mSymbol,
mPeriod,
"x-saherelm.x121.xca",
"", // Market ...
"", // Short ...
mInputs.scMethod,
mInputs.scPeriod,
"", // Medium ...
mInputs.mcMethod,
mInputs.mcPeriod,
"", // Long ...
mInputs.lcMethod,
mInputs.lcPeriod,
"", // Hind ...
mInputs.hcMethod,
mInputs.hcPeriod,
"", // Boundary Detection ...
mInputs.hhMode,
mInputs.llMode,
"", // Fibo Levels ...
mInputs.fiboLevel1,
mInputs.fiboLevel2,
mInputs.fiboLevel3,
mInputs.fiboLevel4,
mInputs.fiboLevel5,
"", // Sar Detection ...
mInputs.sarStep,
mInputs.sarMax,
"", // KI ...
mInputs.kiLength,
"", // VIDYA ...
mInputs.vidyaCMOLength,
mInputs.vidyaEMALength,
mInputs.vidyaAppliedTo,
"", // MANALYSER ...
mInputs.manalyserLength,
mInputs.manalyserMethod,
"", // Swing Detection ...
mInputs.swingLength,
"", // Support and Resistance ...
mInputs.supResSmoothingLength,
mInputs.supResSmoothingMode,
"", // Presentation ...
mInputs.startCalculationForLastBars,
mInputs.showSar,
mInputs.showKI,
mInputs.showTKI,
mInputs.showMAH,
mInputs.showMAL,
mInputs.showMAC,
mInputs.showVidya,
mInputs.showTrend,
mInputs.showSwings,
mInputs.showFiboLevel1,
mInputs.showFiboLevel2,
mInputs.showFiboLevel3,
mInputs.showFiboLevel4,
mInputs.showFiboLevel5,
mInputs.showPeaksAndVales,
mInputs.showPeakAndValeGolden,
mInputs.showSupportAndResistance //
// mInputs.showShortCycle,
// mInputs.showMediumCycle,
// mInputs.showLongCycle,
// mInputs.showHindCycle // ,
//
// mInputs.sarArrowCode,
// mInputs.peakArrowCode,
// mInputs.valeArrowCode,
// mInputs.swingLowArrowCode,
// mInputs.swingHighArrowCode
//
);
result = mHandler != INVALID_HANDLE;
if (!result)
{
return result;
}
//
return result;
}
//
// Inputs ...
//
X121XCAInputs GetInputs()
{
return mInputs;
}
//
bool SetInputs(
X121XCAInputs &inputs // Configs
)
{
//
return Init(
mSymbol,
mPeriod,
inputs
//
);
}
//
// Readers ...
//
// KI ...
//
double GetKI(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(kiBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return kiBuffer[barIndex];
}
//
int CopyKI(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
kiBuffer,
buffer,
forceClean
//
);
}
//
// KI STATE ...
//
double GetKIState(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(kiStateBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return kiStateBuffer[barIndex];
}
//
int CopyKIState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
kiStateBuffer,
buffer,
forceClean
//
);
}
//
// TKI ...
//
double GetTKI(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(tkiBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return tkiBuffer[barIndex];
}
//
int CopyTKI(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
tkiBuffer,
buffer,
forceClean
//
);
}
//
// TKI STATE ...
//
double GetTKIState(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(tkiStateBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return tkiStateBuffer[barIndex];
}
//
int CopyTKIState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
tkiStateBuffer,
buffer,
forceClean
//
);
}
//
// VIDYA ...
//
double GetVidya(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(vidyaBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vidyaBuffer[barIndex];
}
//
int CopyVidya(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
vidyaBuffer,
buffer,
forceClean
//
);
}
//
// VIDYA STATE ...
//
double GetVidyaState(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(vidyaStateBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vidyaStateBuffer[barIndex];
}
//
int CopyVidyaState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
vidyaStateBuffer,
buffer,
forceClean
//
);
}
//
// SHORT ...
//
// HH ...
//
double GetSHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(sHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return sHHBuffer[barIndex];
}
//
int CopySHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
sHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetSLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(sLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return sLLBuffer[barIndex];
}
//
int CopySLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
sLLBuffer,
buffer,
forceClean
//
);
}
//
// MEDIUM ...
//
// HH ...
//
double GetMHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(mHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return mHHBuffer[barIndex];
}
//
int CopyMHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
mHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetMLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(mLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return mLLBuffer[barIndex];
}
//
int CopyMLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
mLLBuffer,
buffer,
forceClean
//
);
}
//
// LONG ...
//
// HH ...
//
double GetLHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(lHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return lHHBuffer[barIndex];
}
//
int CopyLHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
lHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetLLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(lLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return lLLBuffer[barIndex];
}
//
int CopyLLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
lLLBuffer,
buffer,
forceClean
//
);
}
//
// HIND ...
//
// HH ...
//
double GetHHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(hHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hHHBuffer[barIndex];
}
//
int CopyHHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
hHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetHLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(hLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hLLBuffer[barIndex];
}
//
int CopyHLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
hLLBuffer,
buffer,
forceClean
//
);
}
//
// SAR ...
//
double GetSar(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(sarBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return sarBuffer[barIndex];
}
//
int CopySar(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
sarBuffer,
buffer,
forceClean
//
);
}
//
// MANALYSER ...
//
// MAH ...
//
double GetMah(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(mahBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return mahBuffer[barIndex];
}
//
int CopyMah(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
mahBuffer,
buffer,
forceClean
//
);
}
//
// MAL ,,,
//
double GetMal(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(malBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return malBuffer[barIndex];
}
//
int CopyMal(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
malBuffer,
buffer,
forceClean
//
);
}
//
// MAC ...
//
double GetMac(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(macBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return macBuffer[barIndex];
}
//
int CopyMac(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
macBuffer,
buffer,
forceClean
//
);
}
//
// PEAK ...
//
double GetPeak(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(peakBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return peakBuffer[barIndex];
}
//
int CopyPeak(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
peakBuffer,
buffer,
forceClean
//
);
}
//
// PEAK Golden ...
//
double GetPeakGolden(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(peakGoldenBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return peakGoldenBuffer[barIndex];
}
//
int CopyPeakGolden(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
peakGoldenBuffer,
buffer,
forceClean
//
);
}
//
// VALE ...
//
double GetVale(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(valeBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return valeBuffer[barIndex];
}
//
int CopyVale(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
valeBuffer,
buffer,
forceClean
//
);
}
//
// VALE Golden ...
//
double GetValeGolden(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(valeGoldenBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return valeGoldenBuffer[barIndex];
}
//
int CopyValeGolden(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
valeGoldenBuffer,
buffer,
forceClean
//
);
}
//
// TREND ...
//
double GetTrend(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(trendBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return trendBuffer[barIndex];
}
//
int CopyTrend(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
trendBuffer,
buffer,
forceClean
//
);
}
//
// TREND ...
//
double GetTrendState(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(trendStateBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return trendStateBuffer[barIndex];
}
//
int CopyTrendState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
trendStateBuffer,
buffer,
forceClean
//
);
}
//
// SUPPORT ...
//
double GetSupport(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(supportBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return supportBuffer[barIndex];
}
//
int CopySupport(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
supportBuffer,
buffer,
forceClean
//
);
}
//
// RESISTANCE ...
//
double GetResistance(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(resistanceBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return resistanceBuffer[barIndex];
}
//
int CopyResistance(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
resistanceBuffer,
buffer,
forceClean
//
);
}
//
// SWING Low ...
//
double GetSwingLow(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(swingLowBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return swingLowBuffer[barIndex];
}
//
int CopySwingLow(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
swingLowBuffer,
buffer,
forceClean
//
);
}
//
// SWING High ...
//
double GetSwingHigh(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(swingHighBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return swingHighBuffer[barIndex];
}
//
int CopySwingHigh(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
swingHighBuffer,
buffer,
forceClean
//
);
}
//
// FIBO Level 1 ...
//
double GetFiboLevel1(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(fiboLevel1Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fiboLevel1Buffer[barIndex];
}
//
int CopyFiboLevel1(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
fiboLevel1Buffer,
buffer,
forceClean
//
);
}
//
// FIBO Level 2 ...
//
double GetFiboLevel2(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(fiboLevel2Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fiboLevel2Buffer[barIndex];
}
//
int CopyFiboLevel2(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
fiboLevel2Buffer,
buffer,
forceClean
//
);
}
//
// FIBO Level 3 ...
//
double GetFiboLevel3(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(fiboLevel3Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fiboLevel3Buffer[barIndex];
}
//
int CopyFiboLevel3(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
fiboLevel3Buffer,
buffer,
forceClean
//
);
}
//
// FIBO Level 4 ...
//
double GetFiboLevel4(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(fiboLevel4Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fiboLevel4Buffer[barIndex];
}
//
int CopyFiboLevel4(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
fiboLevel4Buffer,
buffer,
forceClean
//
);
}
//
// FIBO Level 5 ...
//
double GetFiboLevel5(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(fiboLevel5Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fiboLevel5Buffer[barIndex];
}
//
int CopyFiboLevel5(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
fiboLevel5Buffer,
buffer,
forceClean
//
);
}
//
void Free() override
{
Cleanup(10);
}
//
bool GetConditions(
X121XCAConditions &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;
//
XOHCL zBar;
result = zBar.Init(
mSymbol,
mPeriod,
zIndex //
);
if (!result)
{
return result;
}
//
XOHCL cBar;
result = cBar.Init(
mSymbol,
mPeriod,
cIndex //
);
if (!result)
{
return result;
}
//
XOHCL pBar;
result = pBar.Init(
mSymbol,
mPeriod,
pIndex //
);
if (!result)
{
return result;
}
//
// Buffers ...
//
CopyKI(
zIndex,
loopback,
conditions.kiBuffer //
);
//
CopyKIState(
zIndex,
loopback,
conditions.kiStateBuffer //
);
//
CopyTKI(
zIndex,
loopback,
conditions.tkiBuffer //
);
//
CopyTKIState(
zIndex,
loopback,
conditions.tkiStateBuffer //
);
//
CopyVidya(
zIndex,
loopback,
conditions.vidyaBuffer //
);
//
CopyVidyaState(
zIndex,
loopback,
conditions.vidyaStateBuffer //
);
//
CopySHH(
zIndex,
loopback,
conditions.sHHBuffer //
);
//
CopySLL(
zIndex,
loopback,
conditions.sLLBuffer //
);
//
CopyMHH(
zIndex,
loopback,
conditions.mHHBuffer //
);
//
CopyMLL(
zIndex,
loopback,
conditions.mLLBuffer //
);
//
CopyLHH(
zIndex,
loopback,
conditions.lHHBuffer //
);
//
CopyLLL(
zIndex,
loopback,
conditions.lLLBuffer //
);
//
CopyHHH(
zIndex,
loopback,
conditions.hHHBuffer //
);
//
CopyHLL(
zIndex,
loopback,
conditions.hLLBuffer //
);
//
CopySar(
zIndex,
loopback,
conditions.sarBuffer //
);
//
CopyMah(
zIndex,
loopback,
conditions.mahBuffer //
);
//
CopyMal(
zIndex,
loopback,
conditions.malBuffer //
);
//
CopyMac(
zIndex,
loopback,
conditions.macBuffer //
);
//
CopyPeak(
zIndex,
loopback,
conditions.peakBuffer //
);
//
CopyPeakGolden(
zIndex,
loopback,
conditions.peakGoldenBuffer //
);
//
CopyVale(
zIndex,
loopback,
conditions.valeBuffer //
);
//
CopyValeGolden(
zIndex,
loopback,
conditions.valeGoldenBuffer //
);
//
CopyTrend(
zIndex,
loopback,
conditions.trendBuffer //
);
//
CopyTrendState(
zIndex,
loopback,
conditions.trendStateBuffer //
);
//
CopySupport(
zIndex,
loopback,
conditions.supportBuffer //
);
//
CopyResistance(
zIndex,
loopback,
conditions.resistanceBuffer //
);
//
CopySwingLow(
zIndex,
loopback,
conditions.swingLowBuffer //
);
//
CopySwingHigh(
zIndex,
loopback,
conditions.swingHighBuffer //
);
//
CopyFiboLevel1(
zIndex,
loopback,
conditions.fiboLevel1Buffer //
);
//
CopyFiboLevel2(
zIndex,
loopback,
conditions.fiboLevel2Buffer //
);
//
CopyFiboLevel3(
zIndex,
loopback,
conditions.fiboLevel3Buffer //
);
//
CopyFiboLevel4(
zIndex,
loopback,
conditions.fiboLevel4Buffer //
);
//
CopyFiboLevel5(
zIndex,
loopback,
conditions.fiboLevel5Buffer //
);
//
// Conditions ...
//
int zIDX = 0;
int cIDX = 1;
int pIDX = cIDX + 1;
int p2IDX = pIDX + 1;
int p3IDX = p2IDX + 1;
int p4IDX = p3IDX + 1;
//
// Calculate ...
//
// KI ...
//
double cKI = conditions.kiBuffer[cIDX];
double pKI = conditions.kiBuffer[pIDX];
double p2KI = conditions.kiBuffer[p2IDX];
//
double cKIState = conditions.kiStateBuffer[cIDX];
double pKIState = conditions.kiStateBuffer[pIDX];
double p2KIState = conditions.kiStateBuffer[p2IDX];
//
bool isKIRejectUp = cBar.IsRejected(
cKI,
X_DIRECTION_BULLISH,
false,
false //
);
bool isKIRejectDown = cBar.IsRejected(
cKI,
X_DIRECTION_BEARISH,
false,
false //
);
//
bool isKIBullish = cKIState > 0;
bool isKIBullishPrev = pKIState > 0;
//
bool isKIBearish = cKIState < 0;
bool isKIBearishPrev = pKIState < 0;
//
bool isKISwitchedToBullish = isKIBullish &&
!isKIBullishPrev;
bool isKIFinishedFromBullish = !isKIBullish &&
isKIBullishPrev;
//
bool isKISwitchedToBearish = isKIBearish &&
!isKIBearishPrev;
bool isKIFinishedFromBearish = !isKIBearish &&
isKIBearishPrev;
//
// TKI ...
//
double cTKI = conditions.tkiBuffer[cIDX];
double pTKI = conditions.tkiBuffer[pIDX];
double p2TKI = conditions.tkiBuffer[p2IDX];
//
double cTKIState = conditions.tkiStateBuffer[cIDX];
double pTKIState = conditions.tkiStateBuffer[pIDX];
double p2TKIState = conditions.tkiStateBuffer[p2IDX];
//
bool isTKIRejectUp = cBar.IsRejected(
cTKI,
X_DIRECTION_BULLISH,
false,
false //
);
bool isTKIRejectDown = cBar.IsRejected(
cTKI,
X_DIRECTION_BEARISH,
false,
false //
);
//
bool isTKIBullish = cTKIState > 0;
bool isTKIBullishPrev = pTKIState > 0;
//
bool isTKIBearish = cTKIState < 0;
bool isTKIBearishPrev = pTKIState < 0;
//
bool isTKISwitchedToBullish = isTKIBullish &&
!isTKIBullishPrev;
bool isTKIFinishedFromBullish = !isTKIBullish &&
isTKIBullishPrev;
//
bool isTKISwitchedToBearish = isTKIBearish &&
!isTKIBearishPrev;
bool isTKIFinishedFromBearish = !isTKIBearish &&
isTKIBearishPrev;
//
// VIDYA ...
//
double cVidya = conditions.vidyaBuffer[cIDX];
double pVidya = conditions.vidyaBuffer[pIDX];
double p2Vidya = conditions.vidyaBuffer[p2IDX];
//
double cVidyaState = conditions.vidyaStateBuffer[cIDX];
double pVidyaState = conditions.vidyaStateBuffer[pIDX];
double p2VidyaState = conditions.vidyaStateBuffer[p2IDX];
//
bool isVidyaRejectUp = cBar.IsRejected(
cVidya,
X_DIRECTION_BULLISH,
false,
false //
);
bool isVidyaRejectDown = cBar.IsRejected(
cVidya,
X_DIRECTION_BEARISH,
false,
false //
);
//
bool isVidyaBullish = cVidyaState > 0;
bool isVidyaBullishPrev = pVidyaState > 0;
//
bool isVidyaBearish = cVidyaState < 0;
bool isVidyaBearishPrev = pVidyaState < 0;
//
bool isVidyaSwitchedToBullish = isVidyaBullish &&
!isVidyaBullishPrev;
bool isVidyaFinishedFromBullish = !isVidyaBullish &&
isVidyaBullishPrev;
//
bool isVidyaSwitchedToBearish = isVidyaBearish &&
!isVidyaBearishPrev;
bool isVidyaFinishedFromBearish = !isVidyaBearish &&
isVidyaBearishPrev;
//
// SAR ...
//
double cSar = conditions.sarBuffer[cIDX];
double pSar = conditions.sarBuffer[pIDX];
//
bool isSarBullish = cBar.low > cSar;
bool isSarBullishPrev = pBar.low > pSar;
//
bool isSarBearish = cBar.high < cSar;
bool isSarBearishPrev = pBar.high < pSar;
//
bool isSarSwitchedToBullish = isSarBullish &&
!isSarBullishPrev;
bool isSarFinishedFromBullish = !isSarBullish &&
isSarBullishPrev;
//
bool isSarSwitchedToBearish = isSarBearish &&
!isSarBearishPrev;
bool isSarFinishedFromBearish = !isSarBearish &&
isSarBearishPrev;
//
// MANALYSER ...
//
// MAH ...
//
bool isOverMah = cBar.low > conditions.mahBuffer[cIDX];
bool isOverMahPrev = pBar.low > conditions.mahBuffer[pIDX];
//
bool isUnderMah = cBar.high < conditions.mahBuffer[cIDX];
bool isUnderMahPrev = pBar.high < conditions.mahBuffer[pIDX];
//
bool isCrossedOverMah = isOverMah &&
!isOverMahPrev;
bool isCrossedUnderMah = isUnderMah &&
!isUnderMahPrev;
//
bool isCloseOverMah = cBar.close > conditions.mahBuffer[cIDX];
bool isCloseOverMahPrev = pBar.close > conditions.mahBuffer[pIDX];
bool isCloseUnderMah = cBar.close < conditions.mahBuffer[cIDX];
bool isCloseUnderMahPrev = pBar.close < conditions.mahBuffer[pIDX];
//
bool isCloseCrossedOverMah = isCloseOverMah &&
!isCloseOverMahPrev;
bool isCloseCrossedUnderMah = isCloseUnderMah &&
!isCloseUnderMahPrev;
//
bool isMahBullishRejected = cBar.IsRejected(
conditions.mahBuffer[cIDX],
X_DIRECTION_BULLISH,
false,
false //
);
bool isMahBearishRejected = cBar.IsRejected(
conditions.mahBuffer[cIDX],
X_DIRECTION_BEARISH,
false,
false //
);
//
// MAL ...
//
bool isOverMal = cBar.low > conditions.malBuffer[cIDX];
bool isOverMalPrev = pBar.low > conditions.malBuffer[pIDX];
//
bool isUnderMal = cBar.high < conditions.malBuffer[cIDX];
bool isUnderMalPrev = pBar.high < conditions.malBuffer[pIDX];
//
bool isCrossedOverMal = isOverMal &&
!isOverMalPrev;
bool isCrossedUnderMal = isUnderMal &&
!isUnderMalPrev;
//
bool isCloseOverMal = cBar.close > conditions.malBuffer[cIDX];
bool isCloseOverMalPrev = pBar.close > conditions.malBuffer[pIDX];
bool isCloseUnderMal = cBar.close < conditions.malBuffer[cIDX];
bool isCloseUnderMalPrev = pBar.close < conditions.malBuffer[pIDX];
//
bool isCloseCrossedOverMal = isCloseOverMal &&
!isCloseOverMalPrev;
bool isCloseCrossedUnderMal = isCloseUnderMal &&
!isCloseUnderMalPrev;
//
bool isMalBullishRejected = cBar.IsRejected(
conditions.malBuffer[cIDX],
X_DIRECTION_BULLISH,
false,
false //
);
bool isMalBearishRejected = cBar.IsRejected(
conditions.malBuffer[cIDX],
X_DIRECTION_BEARISH,
false,
false //
);
//
// MAC ...
//
bool isOverMac = cBar.low > conditions.macBuffer[cIDX];
bool isOverMacPrev = pBar.low > conditions.macBuffer[pIDX];
//
bool isUnderMac = cBar.high < conditions.macBuffer[cIDX];
bool isUnderMacPrev = pBar.high < conditions.macBuffer[pIDX];
//
bool isCrossedOverMac = isOverMac &&
!isOverMacPrev;
bool isCrossedUnderMac = isUnderMac &&
!isUnderMacPrev;
//
bool isCloseOverMac = cBar.close > conditions.macBuffer[cIDX];
bool isCloseOverMacPrev = pBar.close > conditions.macBuffer[pIDX];
bool isCloseUnderMac = cBar.close < conditions.macBuffer[cIDX];
bool isCloseUnderMacPrev = pBar.close < conditions.macBuffer[pIDX];
//
bool isCloseCrossedOverMac = isCloseOverMac &&
!isCloseOverMacPrev;
bool isCloseCrossedUnderMac = isCloseUnderMac &&
!isCloseUnderMacPrev;
//
bool isMacBullishRejected = cBar.IsRejected(
conditions.macBuffer[cIDX],
X_DIRECTION_BULLISH,
false,
false //
);
bool isMacBearishRejected = cBar.IsRejected(
conditions.macBuffer[cIDX],
X_DIRECTION_BEARISH,
false,
false //
);
//
// PEAK ...
//
double cPeak = conditions.peakBuffer[cIDX];
double pPeak = conditions.peakBuffer[pIDX];
//
bool isPeakSameLast = cPeak == pPeak;
bool isPeakOverLast = cPeak > pPeak;
bool isPeakUnderLast = cPeak < pPeak;
//
// VALE ...
//
double cVale = conditions.valeBuffer[cIDX];
double pVale = conditions.valeBuffer[pIDX];
//
bool isValeSameLast = cVale == pVale;
bool isValeOverLast = cVale > pVale;
bool isValeUnderLast = cVale < pVale;
//
// TREND ...
//
double cTrend = conditions.trendBuffer[cIDX];
double pTrend = conditions.trendBuffer[pIDX];
//
double cTrendState = conditions.trendStateBuffer[cIDX];
double pTrendState = conditions.trendStateBuffer[pIDX];
//
bool isTrendRejectUp = cBar.IsRejected(
cTrend,
X_DIRECTION_BULLISH,
false,
false //
);
bool isTrendRejectDown = cBar.IsRejected(
cTrend,
X_DIRECTION_BEARISH,
false,
false //
);
//
bool isTrendBullish = cTrendState > 0;
bool isTrendBullishPrev = pTrendState > 0;
//
bool isTrendBearish = cTrendState < 0;
bool isTrendBearishPrev = pTrendState < 0;
//
bool isTrendSwitchedToBullish = isTrendBullish &&
!isTrendBullishPrev;
bool isTrendFinishedFromBullish = !isTrendBullish &&
isTrendBullishPrev;
//
bool isTrendSwitchedToBearish = isTrendBearish &&
!isTrendBearishPrev;
bool isTrendFinishedFromBearish = !isTrendBearish &&
isTrendBearishPrev;
//
// SUPPORT ...
//
double cSupport = conditions.supportBuffer[cIDX];
double pSupport = conditions.supportBuffer[pIDX];
//
bool isSupportSameLast = cSupport == pSupport;
bool isSupportOverLast = cSupport > pSupport;
bool isSupportUnderLast = cSupport < pSupport;
//
bool isLastSupportBreaked = cBar.IsBreaked(
pSupport,
X_DIRECTION_BEARISH //
);
bool isLastSupportRejected = cBar.IsRejected(
pSupport,
X_DIRECTION_BULLISH,
false,
false //
);
//
// RESISTANCE ...
//
double cResistance = conditions.resistanceBuffer[cIDX];
double pResistance = conditions.resistanceBuffer[pIDX];
//
bool isResistanceSameLast = cResistance == pResistance;
bool isResistanceOverLast = cResistance > pResistance;
bool isResistanceUnderLast = cResistance < pResistance;
//
bool isLastResistanceBreaked = cBar.IsBreaked(
pResistance,
X_DIRECTION_BULLISH //
);
bool isLastResistanceRejected = cBar.IsRejected(
pResistance,
X_DIRECTION_BEARISH,
false,
false //
);
//
// SWING Low ...
//
double cSwingLow = conditions.swingLowBuffer[cIDX];
double pSwingLow = conditions.swingLowBuffer[pIDX];
//
bool isSwingLowSameLast = cSwingLow == pSwingLow;
bool isSwingLowOverLast = cSwingLow > pSwingLow;
bool isSwingLowUnderLast = cSwingLow < pSwingLow;
//
bool isLastSwingLowBreaked = cBar.IsBreaked(
pSwingLow,
X_DIRECTION_BEARISH //
);
bool isLastSwingLowRejected = cBar.IsRejected(
pSwingLow,
X_DIRECTION_BULLISH,
false,
false //
);
//
// SWING High ...
//
double cSwingHigh = conditions.swingHighBuffer[cIDX];
double pSwingHigh = conditions.swingHighBuffer[pIDX];
//
bool isSwingHighSameLast = cSwingHigh == pSwingHigh;
bool isSwingHighOverLast = cSwingHigh > pSwingHigh;
bool isSwingHighUnderLast = cSwingHigh < pSwingHigh;
//
bool isLastSwingHighBreaked = cBar.IsBreaked(
pSwingHigh,
X_DIRECTION_BULLISH //
);
bool isLastSwingHighRejected = cBar.IsRejected(
pSwingHigh,
X_DIRECTION_BEARISH,
false,
false //
);
//
// COMPLEX Conditions ...
//
bool isSwingLowSameAsVale = cSwingLow == cVale;
bool isSwingLowSameAsValePrev = pSwingLow == pVale;
//
bool isSwingHighSameAsPeak = cSwingHigh == cPeak;
bool isSwingHighSameAsPeakPrev = pSwingHigh == pPeak;
//
bool isSupportSameAsVale = cSupport == cVale;
bool isSupportSameAsValePrev = pSupport == pVale;
//
bool isResistanceSameAsPeak = cResistance == cPeak;
bool isResistanceSameAsPeakPrev = pResistance == pPeak;
//
bool isSupportSameAsSwingLow = cSupport == cSwingLow;
bool isSupportSameAsSwingLowPrev = pSupport == pSwingLow;
//
bool isResistanceSameAsSwingHigh = cResistance == cSwingHigh;
bool isResistanceSameAsSwingHighPrev = pResistance == pSwingHigh;
//
bool isPeakIsPivot = isSwingHighSameAsPeak &&
isResistanceSameAsPeak &&
isResistanceSameAsSwingHigh;
bool isPeakIsPivotPrev = isSwingHighSameAsPeakPrev &&
isResistanceSameAsPeakPrev &&
isResistanceSameAsSwingHighPrev;
//
bool isPeakSwitchedToPivot = isPeakIsPivot &&
!isPeakIsPivotPrev;
//
bool isPeakFinishedFromPivot = !isPeakIsPivot &&
isPeakIsPivotPrev;
//
bool isValeIsPivot = isSwingLowSameAsVale &&
isSupportSameAsVale &&
isSupportSameAsSwingLow;
bool isValeIsPivotPrev = isSwingLowSameAsValePrev &&
isSupportSameAsValePrev &&
isSupportSameAsSwingLowPrev;
//
bool isValeSwitchedToPivot = isValeIsPivot &&
!isValeIsPivotPrev;
bool isValeFinishedFromPivot = !isValeIsPivot &&
isValeIsPivotPrev;
//
// Attached ...
//
conditions.isOverMah = isOverMah;
conditions.isOverMal = isOverMal;
conditions.isOverMac = isOverMac;
conditions.isUnderMah = isUnderMah;
conditions.isUnderMal = isUnderMal;
conditions.isUnderMac = isUnderMac;
conditions.isKIBullish = isKIBullish;
conditions.isKIBearish = isKIBearish;
conditions.isKIRejectUp = isKIRejectUp;
conditions.isTKIBullish = isTKIBullish;
conditions.isTKIBearish = isTKIBearish;
conditions.isSarBullish = isSarBullish;
conditions.isSarBearish = isSarBearish;
conditions.isTKIRejectUp = isTKIRejectUp;
conditions.isPeakIsPivot = isPeakIsPivot;
conditions.isValeIsPivot = isValeIsPivot;
conditions.isCloseOverMah = isCloseOverMah;
conditions.isCloseOverMal = isCloseOverMal;
conditions.isCloseOverMac = isCloseOverMac;
conditions.isVidyaBullish = isVidyaBullish;
conditions.isVidyaBearish = isVidyaBearish;
conditions.isKIRejectDown = isKIRejectDown;
conditions.isPeakSameLast = isPeakSameLast;
conditions.isPeakOverLast = isPeakOverLast;
conditions.isValeSameLast = isValeSameLast;
conditions.isValeOverLast = isValeOverLast;
conditions.isTrendBullish = isTrendBullish;
conditions.isTrendBearish = isTrendBearish;
conditions.isCloseUnderMah = isCloseUnderMah;
conditions.isCloseUnderMal = isCloseUnderMal;
conditions.isCloseUnderMac = isCloseUnderMac;
conditions.isTKIRejectDown = isTKIRejectDown;
conditions.isPeakUnderLast = isPeakUnderLast;
conditions.isValeUnderLast = isValeUnderLast;
conditions.isTrendRejectUp = isTrendRejectUp;
conditions.isCrossedOverMah = isCrossedOverMah;
conditions.isCrossedOverMal = isCrossedOverMal;
conditions.isCrossedOverMac = isCrossedOverMac;
conditions.isCrossedUnderMah = isCrossedUnderMah;
conditions.isCrossedUnderMal = isCrossedUnderMal;
conditions.isCrossedUnderMac = isCrossedUnderMac;
conditions.isTrendRejectDown = isTrendRejectDown;
conditions.isSupportSameLast = isSupportSameLast;
conditions.isSupportOverLast = isSupportOverLast;
conditions.isSupportUnderLast = isSupportUnderLast;
conditions.isSwingLowSameLast = isSwingLowSameLast;
conditions.isSwingLowOverLast = isSwingLowOverLast;
conditions.isSwingLowUnderLast = isSwingLowUnderLast;
conditions.isSwingHighSameLast = isSwingHighSameLast;
conditions.isSwingHighOverLast = isSwingHighOverLast;
conditions.isSupportSameAsVale = isSupportSameAsVale;
conditions.isMahBullishRejected = isMahBullishRejected;
conditions.isMahBearishRejected = isMahBearishRejected;
conditions.isMalBullishRejected = isMalBullishRejected;
conditions.isMalBearishRejected = isMalBearishRejected;
conditions.isMacBullishRejected = isMacBullishRejected;
conditions.isMacBearishRejected = isMacBearishRejected;
conditions.isLastSupportBreaked = isLastSupportBreaked;
conditions.isResistanceSameLast = isResistanceSameLast;
conditions.isResistanceOverLast = isResistanceOverLast;
conditions.isSwingHighUnderLast = isSwingHighUnderLast;
conditions.isSwingLowSameAsVale = isSwingLowSameAsVale;
conditions.isCloseCrossedOverMah = isCloseCrossedOverMah;
conditions.isCloseCrossedOverMal = isCloseCrossedOverMal;
conditions.isCloseCrossedOverMac = isCloseCrossedOverMac;
conditions.isLastSupportRejected = isLastSupportRejected;
conditions.isResistanceUnderLast = isResistanceUnderLast;
conditions.isKISwitchedToBullish = isKISwitchedToBullish;
conditions.isKISwitchedToBearish = isKISwitchedToBearish;
conditions.isLastSwingLowBreaked = isLastSwingLowBreaked;
conditions.isSwingHighSameAsPeak = isSwingHighSameAsPeak;
conditions.isPeakSwitchedToPivot = isPeakSwitchedToPivot;
conditions.isValeSwitchedToPivot = isValeSwitchedToPivot;
conditions.isCloseCrossedUnderMah = isCloseCrossedUnderMah;
conditions.isCloseCrossedUnderMal = isCloseCrossedUnderMal;
conditions.isCloseCrossedUnderMac = isCloseCrossedUnderMac;
conditions.isTKISwitchedToBullish = isTKISwitchedToBullish;
conditions.isTKISwitchedToBearish = isTKISwitchedToBearish;
conditions.isLastSwingLowRejected = isLastSwingLowRejected;
conditions.isSarSwitchedToBullish = isSarSwitchedToBullish;
conditions.isSarSwitchedToBearish = isSarSwitchedToBearish;
conditions.isLastSwingHighBreaked = isLastSwingHighBreaked;
conditions.isResistanceSameAsPeak = isResistanceSameAsPeak;
conditions.isPeakFinishedFromPivot = isPeakFinishedFromPivot;
conditions.isValeFinishedFromPivot = isValeFinishedFromPivot;
conditions.isLastSwingHighRejected = isLastSwingHighRejected;
conditions.isLastResistanceBreaked = isLastResistanceBreaked;
conditions.isSupportSameAsSwingLow = isSupportSameAsSwingLow;
conditions.isKIFinishedFromBullish = isKIFinishedFromBullish;
conditions.isKIFinishedFromBearish = isKIFinishedFromBearish;
conditions.isTKIFinishedFromBullish = isTKIFinishedFromBullish;
conditions.isTKIFinishedFromBearish = isTKIFinishedFromBearish;
conditions.isSarFinishedFromBullish = isSarFinishedFromBullish;
conditions.isSarFinishedFromBearish = isSarFinishedFromBearish;
conditions.isVidyaSwitchedToBullish = isVidyaSwitchedToBullish;
conditions.isVidyaSwitchedToBearish = isVidyaSwitchedToBearish;
conditions.isLastResistanceRejected = isLastResistanceRejected;
conditions.isTrendSwitchedToBullish = isTrendSwitchedToBullish;
conditions.isTrendSwitchedToBearish = isTrendSwitchedToBearish;
conditions.isVidyaFinishedFromBullish = isVidyaFinishedFromBullish;
conditions.isVidyaFinishedFromBearish = isVidyaFinishedFromBearish;
conditions.isTrendFinishedFromBullish = isTrendFinishedFromBullish;
conditions.isTrendFinishedFromBearish = isTrendFinishedFromBearish;
conditions.isResistanceSameAsSwingHigh = isResistanceSameAsSwingHigh;
//
Cleanup();
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
//
return result;
}
//
// Protected ...
protected:
//
// Private ...
private:
//
// Props ...
X121XCAInputs mInputs; // Inputs ...
//
// Buffers ...
double kiBuffer[];
double tkiBuffer[];
double sHHBuffer[];
double sLLBuffer[];
double mHHBuffer[];
double mLLBuffer[];
double lHHBuffer[];
double lLLBuffer[];
double hHHBuffer[];
double hLLBuffer[];
double sarBuffer[];
double mahBuffer[];
double malBuffer[];
double macBuffer[];
double peakBuffer[];
double valeBuffer[];
double vidyaBuffer[];
double trendBuffer[];
double kiStateBuffer[];
double supportBuffer[];
double tkiStateBuffer[];
double swingLowBuffer[];
double swingHighBuffer[];
double resistanceBuffer[];
double peakGoldenBuffer[];
double valeGoldenBuffer[];
double fiboLevel1Buffer[];
double fiboLevel2Buffer[];
double fiboLevel3Buffer[];
double fiboLevel4Buffer[];
double fiboLevel5Buffer[];
double vidyaStateBuffer[];
double trendStateBuffer[];
//
void Calculate(
int barIndex = 0,
int maxRequiredBars = 100 //
)
{
//
// Buffers ...
if (barIndex < 0)
{
barIndex = 0;
}
//
CopyBuffer(
mHandler,
X121_XCA_KI_LINE,
barIndex,
maxRequiredBars,
kiBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_TKI_LINE,
barIndex,
maxRequiredBars,
tkiBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_VIDYA_LINE,
barIndex,
maxRequiredBars,
vidyaBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_S_HH_LINE,
barIndex,
maxRequiredBars,
sHHBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_S_LL_LINE,
barIndex,
maxRequiredBars,
sLLBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_M_HH_LINE,
barIndex,
maxRequiredBars,
mHHBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_M_LL_LINE,
barIndex,
maxRequiredBars,
mLLBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_L_HH_LINE,
barIndex,
maxRequiredBars,
lHHBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_L_LL_LINE,
barIndex,
maxRequiredBars,
lLLBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_H_HH_LINE,
barIndex,
maxRequiredBars,
hHHBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_H_LL_LINE,
barIndex,
maxRequiredBars,
hLLBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_SAR_LINE,
barIndex,
maxRequiredBars,
sarBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_MAH_LINE,
barIndex,
maxRequiredBars,
mahBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_MAL_LINE,
barIndex,
maxRequiredBars,
malBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_MAC_LINE,
barIndex,
maxRequiredBars,
macBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_PEAK_LINE,
barIndex,
maxRequiredBars,
peakBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_VALE_LINE,
barIndex,
maxRequiredBars,
valeBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_TREND_LINE,
barIndex,
maxRequiredBars,
trendBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_KI_STATE_LINE,
barIndex,
maxRequiredBars,
kiStateBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_TKI_STATE_LINE,
barIndex,
maxRequiredBars,
tkiStateBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_VIDYA_STATE_LINE,
barIndex,
maxRequiredBars,
vidyaStateBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_SUPPORT_LINE,
barIndex,
maxRequiredBars,
supportBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_SWING_LOW_LINE,
barIndex,
maxRequiredBars,
swingLowBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_SWING_HIGH_LINE,
barIndex,
maxRequiredBars,
swingHighBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_RESISTANCE_LINE,
barIndex,
maxRequiredBars,
resistanceBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_PEAK_GOLDEN_LINE,
barIndex,
maxRequiredBars,
peakGoldenBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_VALE_GOLDEN_LINE,
barIndex,
maxRequiredBars,
valeGoldenBuffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_FIBO_L1_LINE,
barIndex,
maxRequiredBars,
fiboLevel1Buffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_FIBO_L2_LINE,
barIndex,
maxRequiredBars,
fiboLevel2Buffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_FIBO_L3_LINE,
barIndex,
maxRequiredBars,
fiboLevel3Buffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_FIBO_L4_LINE,
barIndex,
maxRequiredBars,
fiboLevel4Buffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_FIBO_L5_LINE,
barIndex,
maxRequiredBars,
fiboLevel5Buffer //
);
//
CopyBuffer(
mHandler,
X121_XCA_TREND_STATE_LINE,
barIndex,
maxRequiredBars,
trendStateBuffer //
);
}
//
void Cleanup(
int maxAllowed = 100 //
)
{
//
CleanupArray(
kiBuffer,
maxAllowed //
);
//
CleanupArray(
tkiBuffer,
maxAllowed //
);
//
CleanupArray(
vidyaBuffer,
maxAllowed //
);
//
CleanupArray(
sHHBuffer,
maxAllowed //
);
//
CleanupArray(
sLLBuffer,
maxAllowed //
);
//
CleanupArray(
mHHBuffer,
maxAllowed //
);
//
CleanupArray(
mLLBuffer,
maxAllowed //
);
//
CleanupArray(
lHHBuffer,
maxAllowed //
);
//
CleanupArray(
lLLBuffer,
maxAllowed //
);
//
CleanupArray(
hHHBuffer,
maxAllowed //
);
//
CleanupArray(
hLLBuffer,
maxAllowed //
);
//
CleanupArray(
sarBuffer,
maxAllowed //
);
//
CleanupArray(
mahBuffer,
maxAllowed //
);
//
CleanupArray(
malBuffer,
maxAllowed //
);
//
CleanupArray(
macBuffer,
maxAllowed //
);
//
CleanupArray(
peakBuffer,
maxAllowed //
);
//
CleanupArray(
valeBuffer,
maxAllowed //
);
//
CleanupArray(
trendBuffer,
maxAllowed //
);
//
CleanupArray(
kiStateBuffer,
maxAllowed //
);
//
CleanupArray(
tkiStateBuffer,
maxAllowed //
);
//
CleanupArray(
vidyaStateBuffer,
maxAllowed //
);
//
CleanupArray(
supportBuffer,
maxAllowed //
);
//
CleanupArray(
swingLowBuffer,
maxAllowed //
);
//
CleanupArray(
swingHighBuffer,
maxAllowed //
);
//
CleanupArray(
resistanceBuffer,
maxAllowed //
);
//
CleanupArray(
peakGoldenBuffer,
maxAllowed //
);
//
CleanupArray(
valeGoldenBuffer,
maxAllowed //
);
//
CleanupArray(
fiboLevel1Buffer,
maxAllowed //
);
//
CleanupArray(
fiboLevel2Buffer,
maxAllowed //
);
//
CleanupArray(
fiboLevel3Buffer,
maxAllowed //
);
//
CleanupArray(
fiboLevel4Buffer,
maxAllowed //
);
//
CleanupArray(
fiboLevel5Buffer,
maxAllowed //
);
//
CleanupArray(
trendStateBuffer,
maxAllowed //
);
}
//
};
//
// Tools ...