Files
xMQL5/MQLTestWorkspace/BKPS/x-saherelm.x121.xman.helper.class.mq5
T
2024-05-05 18:17:11 +03:30

3420 lines
83 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Helper Class Library
// ----------------------------------------------
// Name: XSCXMANHelper
// 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
//
// START Definitions ...
//
//
// All Extractable Buffers ...
enum ENUM_XMAN_BUFFERS
{
//
// Peaks and Vales ...
XMAN_PEAKS_LINE = 0, // Peaks
XMAN_VALES_LINE = 1, // Vales
XMAN_PEAKS_STATE_LINE = 69, // New Peak
XMAN_VALES_STATE_LINE = 70, // New Vales
//
// Fibonacci Retracement ...
XMAN_FIB_L1_LINE = 6, // Fibo Level 1
XMAN_FIB_L2_LINE = 8, // Fibo Level 2
XMAN_FIB_L3_LINE = 10, // Fibo Level 3
XMAN_FIB_L4_LINE = 12, // Fibo Level 3
XMAN_FIB_L5_LINE = 14, // Fibo Level 3
//
// Period Cycles ...
//
// Short Cycle ...
XMAN_SC_HH_LINE = 16, // High
XMAN_SC_LL_LINE = 18, // Low
XMAN_SC_HH_STATE_LINE = 71, // High State
XMAN_SC_LL_STATE_LINE = 72, // Low State
//
// Medium ...
XMAN_MC_HH_LINE = 20, // High
XMAN_MC_LL_LINE = 22, // Low
XMAN_MC_HH_STATE_LINE = 73, // High State
XMAN_MC_LL_STATE_LINE = 74, // Low State
//
// Long ...
XMAN_LC_HH_LINE = 24, // High
XMAN_LC_LL_LINE = 26, // Low
XMAN_LC_HH_STATE_LINE = 75, // High State
XMAN_LC_LL_STATE_LINE = 76, // Low State
//
// Hind ...
XMAN_HC_HH_LINE = 28, // High
XMAN_HC_LL_LINE = 30, // Low
XMAN_HC_HH_STATE_LINE = 77, // High State
XMAN_HC_LL_STATE_LINE = 78, // Low State
//
// XSTR ...
XMAN_TREND_LINE = 34, // Trend Value
XMAN_TREND_STATE_LINE = 79, // Trend Direction
//
// XMRB ...
//
// RIBBON 1 _ HIGH ...
XMAN_RB1_LINE = 36, // Value
XMAN_RB1_STATE_LINE = 80, // State
//
// RIBBON 2 _ OPEN ...
XMAN_RB2_LINE = 38, // Value
XMAN_RB2_STATE_LINE = 81, // State
//
// RIBBON 3 _ CLOSE ...
XMAN_RB3_LINE = 40, // Value
XMAN_RB3_STATE_LINE = 82, // State
//
// RIBBON 4 _ MEDIAN ...
XMAN_RB4_LINE = 42, // Value
XMAN_RB4_STATE_LINE = 83, // State
//
// RIBBON 5 _ TYPICAL ...
XMAN_RB5_LINE = 44, // Value
XMAN_RB5_STATE_LINE = 84, // State
//
// RIBBON 6 _ LOW ...
XMAN_RB6_LINE = 46, // Value
XMAN_RB6_STATE_LINE = 85, // State
//
// XSSLC ...
XMAN_SSLC_UP_LINE = 48, // Up
XMAN_SSLC_DOWN_LINE = 50, // Down
//
// XHULL ...
XMAN_HULL_UP_LINE = 52, // Up
XMAN_HULL_DOWN_LINE = 54, // Down
XMAN_HULL_UP_STATE_LINE = 86, // Up State
XMAN_HULL_DOWN_STATE_LINE = 87, // Down State
//
// XHK ...
XMAN_HK_OPEN_LINE = 56, // Open
XMAN_HK_HIGH_LINE = 57, // High
XMAN_HK_LOW_LINE = 58, // Low
XMAN_HK_CLOSE_LINE = 59, // Close
XMAN_HK_STATE_LINE = 88, // State
};
//
// Define States On XMAN ...
enum ENUM_XMAN_STATES
{
XMAN_STATE_BULLISH = 2,
XMAN_STATE_STRONG_BULLISH = 8,
XMAN_STATE_BEARISH = 3,
XMAN_STATE_STRONG_BEARISH = 9,
XMAN_STATE_NEUTURAL = 1,
XMAN_STATE_STRONG_NEUTURAL = 7,
};
//
// XPERIOD Calculation Method ...
// USED For Multiple Time Frames ...
enum ENUM_X_PERIOD_METHOD
{
//
X_PERIOD_NOTHING, // Nothing
X_PERIOD_AUTO, // Auto Select
X_PERIOD_MANUALLY // Manually
};
//
enum ENUM_X_MA_METHOD
{
X_MA_NOTHING, // Nothing
X_MA_SMA, // Simple
X_MA_EMA, // Expotential
X_MA_SMMA, // Smoothed Simple
X_MA_LWMA, // Linear Weighted
X_MA_AMA // Adaptive
};
//
// Model all required info as a Model for Instancing Helper Class ...
struct XMANInputs
{
//
// Candle Timer ...
color candleTimerColor; // Text Color
ENUM_BASE_CORNER candleTimerCorner; // Text Position
//
// Chart Style ...
color upColor; // Up Color
color downColor; // Down Color
color lineColor; // Line mode and Doji candlestick Color
color bearishColor; // Bullish Color
color bullishColor; // Bearish Color
color volumesColor; // Volumes Color
ENUM_CHART_MODE chartMode; // Chart Mode
//
// Market Cycles ...
//
// Level 1 ...
ENUM_X_PERIOD_METHOD l1Method; // How to Find Period
ENUM_TIMEFRAMES l1Period; // Time Period
//
// Level 2 ...
ENUM_X_PERIOD_METHOD l2Method; // How to Find Period
ENUM_TIMEFRAMES l2Period; // Time Period
//
// Level 3 ...
ENUM_X_PERIOD_METHOD l3Method; // How to Find Period
ENUM_TIMEFRAMES l3Period; // Time Period
//
// Level 4 ...
ENUM_X_PERIOD_METHOD l4Method; // How to Find Period
ENUM_TIMEFRAMES l4Period; // Time Period
//
// Fibonacci ...
double fiboLevel1; // Fibio 1st Level
double fiboLevel2; // Fibio 2st Level
double fiboLevel3; // Fibio 3rd Level
double fiboLevel4; // Fibio 4th Level
double fiboLevel5; // Fibio 5th Level
//
// Boundary Detection Modes ...
ENUM_SERIESMODE hhMode; // Highest High Calculation Method
ENUM_SERIESMODE llMode; // Lowest Low Calculation Method
//
// Trend Detection
double trendMultiplier; // Multiplier
ENUM_APPLIED_PRICE trendPriceAppliedTo; // Applied To
//
// Ribbon Detection ...
ENUM_X_MA_METHOD ribbonMode; // How to Calculate
//
// Hull Trend Detection ...
double hullDivisor; // Divisor (Speed)
ENUM_APPLIED_PRICE hullUpAppliedTo; // Up Zone Applied to
ENUM_APPLIED_PRICE hullDownAppliedTo; // Down Zone Applied to
//
// SSL Channel Detection ...
ENUM_X_MA_METHOD sslcMode; // How to Calculate
ENUM_APPLIED_PRICE sslcUpAppliedTo; // Up Applied To
ENUM_APPLIED_PRICE sslcDownAppliedTo; // Down Applied To
//
// Presentation ...
bool showCandleTimer; // Show Candle Time
bool showCandles; // Show Candles
bool showHKCandles; // Draw Hiken Ashi Candle
bool showPeaksAndVales; // Show Peaks and Vales
bool showTrends; // Show Trends
bool fillTrends; // Fill Trends
bool showLevels; // Show Levels
bool showConsolidations; // Show Consolidations
bool showRibbons; // Show Ribbons
bool showHull; // Show Hull
bool showSSLChannel; // Show SSL Channel
bool showFibo1Levels; // Show Fibo 1st Level
bool showFibo2Levels; // Show Fibo 2nd Level
bool showFibo3Levels; // Show Fibo 3rd Level
bool showFibo4Levels; // Show Fibo 4th Level
bool showFibo5Levels; // Show Fibo 5th Level
};
//
// Model all Extractable Info as a Model for Market Analyzing ...
struct XMANInfo
{
//
// COMMONS ...
//
// Symbol ...
string symbol;
//
// Period ...
ENUM_TIMEFRAMES period;
//
// Bar Time ...
datetime barTime;
//
// Bar Index ...
int barIndex;
//
// SPECIALS ...
//
// Buffers ...
//
// Peaks and Vales ...
double peaks[];
double peaksStates[];
double vales[];
double valesStates[];
//
// Fibonacci ...
double fibLevel1s[];
double fibLevel2s[];
double fibLevel3s[];
double fibLevel4s[];
double fibLevel5s[];
//
// Cycles ...
//
// Short ...
double sHHs[];
double sHHStates[];
double sLLs[];
double sLLStates[];
//
// Medium ...
double mHHs[];
double mHHStates[];
double mLLs[];
double mLLStates[];
//
// Long ...
double lHHs[];
double lHHStates[];
double lLLs[];
double lLLStates[];
//
// Hind ...
double hHHs[];
double hHHStates[];
double hLLs[];
double hLLStates[];
//
// Trends ...
double trends[];
double trendStates[];
//
// Ribbons ...
//
// 1 _ High ...
double ribbon1s[];
double ribbon1States[];
//
// 2 _ Open ...
double ribbon2s[];
double ribbon2States[];
//
// 3 _ Close ...
double ribbon3s[];
double ribbon3States[];
//
// 4 _ Median ...
double ribbon4s[];
double ribbon4States[];
//
// 5 _ Typical ...
double ribbon5s[];
double ribbon5States[];
//
// 6 _ Low ...
double ribbon6s[];
double ribbon6States[];
//
// SSL Channel ...
double sslcUps[];
double sslcDowns[];
//
// Hull Trend ...
double hullUps[];
double hullUpStates[];
double hullDowns[];
double hullDownStates[];
//
// Hiken Ashi ...
double hkOpens[];
double hkHighs[];
double hkLows[];
double hkCloses[];
double hkStates[];
//
// Conditions ...
//
// Peaks and Vales ...
bool isNewPeak;
bool isNewVale;
//
// Trend ...
bool isTrendBullish;
bool isTrendSwitchedToBullish;
bool isTrendBearish;
bool isTrendSwitchedToBearish;
bool isTrendNeutural;
bool isTrendSwitchedToNeutural;
//
// SSL Channel ...
bool isSSLCBullish;
bool isSSLCSwitchedToBullish;
bool isSSLCBearish;
bool isSSLCSwitchedToBearish;
bool isSSLCNeutural;
bool isSSLCSwitchedToNeutural;
//
// Hull Trend ...
//
bool isHullBullish;
bool isHullUpBullish;
bool isHullDownBullish;
bool isHullSwitchedToBullish;
//
bool isHullBearish;
bool isHullUpBearish;
bool isHullDownBearish;
bool isHullSwitchedToBearish;
//
bool isHullNeutural;
bool isHullUpNeutural;
bool isHullDownNeutural;
bool isHullSwitchedToNeutural;
//
// HK ...
bool isHKBullish;
bool isHKBearish;
//
// Market Cycles ...
//
// Short ...
//
bool isSCBullish;
bool isSCHBullish;
bool isSCLBullish;
bool isSCSwitchedToBullish;
bool isSCHSwitchedToBullish;
bool isSCLSwitchedToBullish;
//
bool isSCBearish;
bool isSCHBearish;
bool isSCLBearish;
bool isSCSwitchedToBearish;
bool isSCHSwitchedToBearish;
bool isSCLSwitchedToBearish;
//
bool isSCNeutural;
bool isSCHNeutural;
bool isSCLNeutural;
bool isSCSwitchedToNeutural;
bool isSCHSwitchedToNeutural;
bool isSCLSwitchedToNeutural;
//
// Medium ...
//
bool isMCBullish;
bool isMCHBullish;
bool isMCLBullish;
bool isMCSwitchedToBullish;
bool isMCHSwitchedToBullish;
bool isMCLSwitchedToBullish;
//
bool isMCBearish;
bool isMCHBearish;
bool isMCLBearish;
bool isMCSwitchedToBearish;
bool isMCHSwitchedToBearish;
bool isMCLSwitchedToBearish;
//
bool isMCNeutural;
bool isMCHNeutural;
bool isMCLNeutural;
bool isMCSwitchedToNeutural;
bool isMCHSwitchedToNeutural;
bool isMCLSwitchedToNeutural;
//
// Long ...
//
bool isLCBullish;
bool isLCHBullish;
bool isLCLBullish;
bool isLCSwitchedToBullish;
bool isLCHSwitchedToBullish;
bool isLCLSwitchedToBullish;
//
bool isLCBearish;
bool isLCHBearish;
bool isLCLBearish;
bool isLCSwitchedToBearish;
bool isLCHSwitchedToBearish;
bool isLCLSwitchedToBearish;
//
bool isLCNeutural;
bool isLCHNeutural;
bool isLCLNeutural;
bool isLCSwitchedToNeutural;
bool isLCHSwitchedToNeutural;
bool isLCLSwitchedToNeutural;
//
// Hind ...
//
bool isHCBullish;
bool isHCHBullish;
bool isHCLBullish;
bool isHCSwitchedToBullish;
bool isHCHSwitchedToBullish;
bool isHCLSwitchedToBullish;
//
bool isHCBearish;
bool isHCHBearish;
bool isHCLBearish;
bool isHCSwitchedToBearish;
bool isHCHSwitchedToBearish;
bool isHCLSwitchedToBearish;
//
bool isHCNeutural;
bool isHCHNeutural;
bool isHCLNeutural;
bool isHCSwitchedToNeutural;
bool isHCHSwitchedToNeutural;
bool isHCLSwitchedToNeutural;
//
// Ribbons ...
//
// R1 ...
//
bool isRibbon1Bullish;
bool isRibbon2Bullish;
bool isRibbon3Bullish;
bool isRibbon4Bullish;
bool isRibbon5Bullish;
bool isRibbon6Bullish;
//
bool isRibbon1Bearish;
bool isRibbon2Bearish;
bool isRibbon3Bearish;
bool isRibbon4Bearish;
bool isRibbon5Bearish;
bool isRibbon6Bearish;
//
bool isRibbon1Neutural;
bool isRibbon2Neutural;
bool isRibbon3Neutural;
bool isRibbon4Neutural;
bool isRibbon5Neutural;
bool isRibbon6Neutural;
//
bool isRibbonBullish;
bool isRibbonSwitchedToBullish;
//
bool isRibbonBearish;
bool isRibbonSwitchedToBearish;
//
bool isRibbonNeutural;
bool isRibbonSwitchedToNeutural;
};
//
// END Definitions ...
//
//
// START Import and Inclused requirements ...
//
//
// Includes ...
#include "../Libraries/x-saherelm.common.lib.mq5"
#include "../Classes/x-saherelm.xhelper.class.mq5"
//
// END Import and Inclused requirements ...
//
//
// START Overrides ...
//
//
// END Overrides ...
//
//
class XSCXMANHelper : public XSCBaseHelper
{
//
// Public ...
public:
//
// Props ...
//
// Peaks and Vales ...
double peaksBuffer[];
double peaksStateBuffer[];
double valesBuffer[];
double valesStateBuffer[];
//
// Fibonacci ...
double fibLevel1Buffer[];
double fibLevel2Buffer[];
double fibLevel3Buffer[];
double fibLevel4Buffer[];
double fibLevel5Buffer[];
//
// Cycles ...
//
// Short ...
double sHHBuffer[];
double sHHStateBuffer[];
double sLLBuffer[];
double sLLStateBuffer[];
//
// Medium ...
double mHHBuffer[];
double mHHStateBuffer[];
double mLLBuffer[];
double mLLStateBuffer[];
//
// Long ...
double lHHBuffer[];
double lHHStateBuffer[];
double lLLBuffer[];
double lLLStateBuffer[];
//
// Hind ...
double hHHBuffer[];
double hHHStateBuffer[];
double hLLBuffer[];
double hLLStateBuffer[];
//
// Trends ...
double trendBuffer[];
double trendStateBuffer[];
//
// Ribbons ...
//
// 1 _ High ...
double ribbon1Buffer[];
double ribbon1StateBuffer[];
//
// 2 _ Open ...
double ribbon2Buffer[];
double ribbon2StateBuffer[];
//
// 3 _ Close ...
double ribbon3Buffer[];
double ribbon3StateBuffer[];
//
// 4 _ Median ...
double ribbon4Buffer[];
double ribbon4StateBuffer[];
//
// 5 _ Typical ...
double ribbon5Buffer[];
double ribbon5StateBuffer[];
//
// 6 _ Low ...
double ribbon6Buffer[];
double ribbon6StateBuffer[];
//
// SSL Channel ...
double sslUpBuffer[];
double sslDownBuffer[];
//
// Hull Trend ...
double hullUpBuffer[];
double hullUpStateBuffer[];
double hullDownBuffer[];
double hullDownStateBuffer[];
//
// Hiken Ashi ...
double hkOpenBuffer[];
double hkHighBuffer[];
double hkLowBuffer[];
double hkCloseBuffer[];
double hkStateBuffer[];
//
// Constructor ...
void XSCXMANHelper(
string symbol, // Trading Symbol
ENUM_TIMEFRAMES period // Trading Time Frame
) : XSCBaseHelper(symbol, period)
{
PrepareTag();
}
//
// Deconstructor ...
void ~XSCXMANHelper()
{
}
//
// START Properties ...
//
//
// END Properties ...
//
//
// START Provided Functions ...
//
//
// Prepare Tag ...
virtual void PrepareTag()
{
mTag = "XMAN" + GetTagPrefix();
}
//
virtual int GetMaxLength()
{
//
int result = 1;
//
result = 1;
//
return result;
}
//
// Initial Indicator Handler ...
bool Init()
{
//
bool result = false;
//
// Validate Args ...
result =
//
// L1 ...
// Short Cycle ...
(
//
mL1Method == X_PERIOD_AUTO
? mL1Period == NULL
: mL1Period != NULL && mL1Method != X_PERIOD_NOTHING
//
)
//
&&
//
// L2 ...
// Medium Cycle ...
(
//
mL2Method == X_PERIOD_AUTO
? mL2Period == NULL
: mL2Period != NULL && mL2Method != X_PERIOD_NOTHING
//
)
//
&&
//
// L3 ...
// Long Cycle ...
(
//
mL3Method == X_PERIOD_AUTO
? mL3Period == NULL
: mL3Period != NULL && mL3Method != X_PERIOD_NOTHING
//
)
//
&&
//
// L4 ...
// Hind Cycle ...
(
//
mL4Method == X_PERIOD_AUTO
? mL4Period == NULL
: mL4Period != NULL && mL4Method != X_PERIOD_NOTHING
//
)
//
&&
//
// Validate Ribbon ...
(
//
mRibbonMode != X_MA_NOTHING
//
)
//
;
if (!result)
{
return false;
}
//
// Initialize Handler ...
mHandler = iCustom(
//
mSymbol,
mPeriod,
"x-saherelm.x121.xman",
//
// Inputs ...
//
// Candle Timer ...
"",
//
mCandleTimerColor, // Text Color
mCandleTimerCorner, // Text Position
//
// Chart Style ...
// "",
//
mUpColor, // Up Color
mDownColor, // Down Color
mLineColor, // Line mode and Doji candlestick Color
mBearishColor, // Bullish Color
mBullishColor, // Bearish Color
mVolumesColor, // Volumes Color
mChartMode, // Chart Mode
//
// Market Cycles ...
// "",
//
// Level 1 ...
"",
//
mL1Method, // How to Find Period
mL1Period, // Time Period
//
// Level 2 ...
"",
//
mL2Method, // How to Find Period
mL2Period, // Time Period
//
// Level 3 ...
"",
//
mL3Method, // How to Find Period
mL3Period, // Time Period
//
// Level 4 ...
"",
//
mL4Method, // How to Find Period
mL4Period, // Time Period
//
// Fibonacci ...
"",
//
mFiboLevel1, // Fibio 1st Level
mFiboLevel2, // Fibio 2st Level
mFiboLevel3, // Fibio 3rd Level
mFiboLevel4, // Fibio 4th Level
mFiboLevel5, // Fibio 5th Level
//
// Boundary Detection Modes ...
"",
//
mHHMode, // Highest High Calculation Method
mLLMode, // Lowest Low Calculation Method
//
// Trend Detection
"",
//
mTrendMultiplier, // Multiplier
mTrendPriceAppliedTo, // Applied To
//
// Ribbon Detection ...
"",
//
mRibbonMode, // How to Calculate
//
// Hull Trend Detection ...
"",
//
mHullDivisor, // Divisor (Speed)
mHullUpAppliedTo, // Up Zone Applied to
mHullDownAppliedTo, // Down Zone Applied to
//
// SSL Channel Detection ...
"",
//
mSslcMode, // How to Calculate
mSslcUpAppliedTo, // Up Applied To
mSslcDownAppliedTo, // Down Applied To
//
// Presentation ...
"",
//
mShowCandleTimer, // Show Candle Timer
mShowCandles, // Show Candles
mShowHKCandles, // Draw Hiken Ashi Candle
mShowPeaksAndVales, // Show Peaks and Vales
mShowTrends, // Show Trends
mSillTrends, // Fill Trends
mShowLevels, // Show Levels
mShowConsolidations, // Show Consolidations
mShowRibbons, // Show Ribbons
mShowHull, // Show Hull
mShowSSLChannel, // Show SSL Channel
mShowFibo1Levels, // Show Fibo 1st Level
mShowFibo2Levels, // Show Fibo 2nd Level
mShowFibo3Levels, // Show Fibo 3rd Level
mShowFibo4Levels, // Show Fibo 4th Level
mShowFibo5Levels // Show Fibo 5th Level
//
);
result = mHandler != INVALID_HANDLE;
//
return result;
}
//
// Retrieve Current Config ...
XMANInputs GetConfig()
{
//
XMANInputs result;
//
result.candleTimerColor = mCandleTimerColor;
result.candleTimerCorner = mCandleTimerCorner;
result.upColor = mUpColor;
result.downColor = mDownColor;
result.lineColor = mLineColor;
result.bearishColor = mBearishColor;
result.bullishColor = mBullishColor;
result.volumesColor = mVolumesColor;
result.chartMode = mChartMode;
result.l1Method = mL1Method;
result.l1Period = mL1Period;
result.l2Method = mL2Method;
result.l2Period = mL2Period;
result.l3Method = mL3Method;
result.l3Period = mL3Period;
result.l4Method = mL4Method;
result.l4Period = mL4Period;
result.fiboLevel1 = mFiboLevel1;
result.fiboLevel2 = mFiboLevel2;
result.fiboLevel3 = mFiboLevel3;
result.fiboLevel4 = mFiboLevel4;
result.fiboLevel5 = mFiboLevel5;
result.hhMode = mHHMode;
result.llMode = mLLMode;
result.trendMultiplier = mTrendMultiplier;
result.trendPriceAppliedTo = mTrendPriceAppliedTo;
result.ribbonMode = mRibbonMode;
result.hullDivisor = mHullDivisor;
result.hullUpAppliedTo = mHullUpAppliedTo;
result.hullDownAppliedTo = mHullDownAppliedTo;
result.sslcMode = mSslcMode;
result.sslcUpAppliedTo = mSslcUpAppliedTo;
result.sslcDownAppliedTo = mSslcDownAppliedTo;
result.showCandleTimer = mShowCandleTimer;
result.showCandles = mShowCandles;
result.showHKCandles = mShowHKCandles;
result.showPeaksAndVales = mShowPeaksAndVales;
result.showTrends = mShowTrends;
result.fillTrends = mSillTrends;
result.showLevels = mShowLevels;
result.showConsolidations = mShowConsolidations;
result.showRibbons = mShowRibbons;
result.showHull = mShowHull;
result.showSSLChannel = mShowSSLChannel;
result.showFibo1Levels = mShowFibo1Levels;
result.showFibo2Levels = mShowFibo2Levels;
result.showFibo3Levels = mShowFibo3Levels;
result.showFibo4Levels = mShowFibo4Levels;
result.showFibo5Levels = mShowFibo5Levels;
//
return result;
}
//
// Set Config ...
bool SetConfig(XMANInputs &config)
{
//
bool result = false;
//
mCandleTimerColor = config.candleTimerColor;
mCandleTimerCorner = config.candleTimerCorner;
mUpColor = config.upColor;
mDownColor = config.downColor;
mLineColor = config.lineColor;
mBearishColor = config.bearishColor;
mBullishColor = config.bullishColor;
mVolumesColor = config.volumesColor;
mChartMode = config.chartMode;
mL1Method = config.l1Method;
mL1Period = config.l1Period;
mL2Method = config.l2Method;
mL2Period = config.l2Period;
mL3Method = config.l3Method;
mL3Period = config.l3Period;
mL4Method = config.l4Method;
mL4Period = config.l4Period;
mFiboLevel1 = config.fiboLevel1;
mFiboLevel2 = config.fiboLevel2;
mFiboLevel3 = config.fiboLevel3;
mFiboLevel4 = config.fiboLevel4;
mFiboLevel5 = config.fiboLevel5;
mHHMode = config.hhMode;
mLLMode = config.llMode;
mTrendMultiplier = config.trendMultiplier;
mTrendPriceAppliedTo = config.trendPriceAppliedTo;
mRibbonMode = config.ribbonMode;
mHullDivisor = config.hullDivisor;
mHullUpAppliedTo = config.hullUpAppliedTo;
mHullDownAppliedTo = config.hullDownAppliedTo;
mSslcMode = config.sslcMode;
mSslcUpAppliedTo = config.sslcUpAppliedTo;
mSslcDownAppliedTo = config.sslcDownAppliedTo;
mShowCandleTimer = config.showCandleTimer;
mShowCandles = config.showCandles;
mShowHKCandles = config.showHKCandles;
mShowPeaksAndVales = config.showPeaksAndVales;
mShowTrends = config.showTrends;
mSillTrends = config.fillTrends;
mShowLevels = config.showLevels;
mShowConsolidations = config.showConsolidations;
mShowRibbons = config.showRibbons;
mShowHull = config.showHull;
mShowSSLChannel = config.showSSLChannel;
mShowFibo1Levels = config.showFibo1Levels;
mShowFibo2Levels = config.showFibo2Levels;
mShowFibo3Levels = config.showFibo3Levels;
mShowFibo4Levels = config.showFibo4Levels;
mShowFibo5Levels = config.showFibo5Levels;
//
result = Init();
//
return result;
}
//
// Reading Buffers based on Given Bar Index ...
virtual void Calculate(
int barIndex // Given Bar Index
)
{
//
// Peaks ...
ArraySetAsSeries(peaksBuffer, true);
CopyBuffer(
mHandler,
XMAN_PEAKS_LINE,
barIndex,
mLoopbackBars,
peaksBuffer);
//
// Peaks State ...
ArraySetAsSeries(peaksStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_PEAKS_STATE_LINE,
barIndex,
mLoopbackBars,
peaksStateBuffer);
//
// Vales ...
ArraySetAsSeries(valesBuffer, true);
CopyBuffer(
mHandler,
XMAN_VALES_LINE,
barIndex,
mLoopbackBars,
valesBuffer);
//
// Vales State ...
ArraySetAsSeries(valesStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_VALES_STATE_LINE,
barIndex,
mLoopbackBars,
valesStateBuffer);
//
// Fibo 1 ...
ArraySetAsSeries(fibLevel1Buffer, true);
CopyBuffer(
mHandler,
XMAN_FIB_L1_LINE,
barIndex,
mLoopbackBars,
fibLevel1Buffer);
//
// Fibo 2 ...
ArraySetAsSeries(fibLevel2Buffer, true);
CopyBuffer(
mHandler,
XMAN_FIB_L2_LINE,
barIndex,
mLoopbackBars,
fibLevel2Buffer);
//
// Fibo 3 ...
ArraySetAsSeries(fibLevel3Buffer, true);
CopyBuffer(
mHandler,
XMAN_FIB_L3_LINE,
barIndex,
mLoopbackBars,
fibLevel3Buffer);
//
// Fibo 4 ...
ArraySetAsSeries(fibLevel4Buffer, true);
CopyBuffer(
mHandler,
XMAN_FIB_L4_LINE,
barIndex,
mLoopbackBars,
fibLevel4Buffer);
//
// Fibo 5 ...
ArraySetAsSeries(fibLevel5Buffer, true);
CopyBuffer(
mHandler,
XMAN_FIB_L5_LINE,
barIndex,
mLoopbackBars,
fibLevel5Buffer);
//
// Cycles ...
//
// Short ...
//
// High ...
ArraySetAsSeries(sHHBuffer, true);
CopyBuffer(
mHandler,
XMAN_SC_HH_LINE,
barIndex,
mLoopbackBars,
sHHBuffer);
//
// High State ...
ArraySetAsSeries(sHHStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_SC_HH_STATE_LINE,
barIndex,
mLoopbackBars,
sHHStateBuffer);
//
// High ...
ArraySetAsSeries(sLLBuffer, true);
CopyBuffer(
mHandler,
XMAN_SC_LL_LINE,
barIndex,
mLoopbackBars,
sLLBuffer);
//
// High State ...
ArraySetAsSeries(sLLStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_SC_LL_STATE_LINE,
barIndex,
mLoopbackBars,
sLLStateBuffer);
//
// Medium ...
//
// High ...
ArraySetAsSeries(mHHBuffer, true);
CopyBuffer(
mHandler,
XMAN_MC_HH_LINE,
barIndex,
mLoopbackBars,
mHHBuffer);
//
// High State ...
ArraySetAsSeries(mHHStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_MC_HH_STATE_LINE,
barIndex,
mLoopbackBars,
mHHStateBuffer);
//
// High ...
ArraySetAsSeries(mLLBuffer, true);
CopyBuffer(
mHandler,
XMAN_MC_LL_LINE,
barIndex,
mLoopbackBars,
mLLBuffer);
//
// High State ...
ArraySetAsSeries(mLLStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_MC_LL_STATE_LINE,
barIndex,
mLoopbackBars,
mLLStateBuffer);
//
// Long ...
//
// High ...
ArraySetAsSeries(lHHBuffer, true);
CopyBuffer(
mHandler,
XMAN_LC_HH_LINE,
barIndex,
mLoopbackBars,
lHHBuffer);
//
// High State ...
ArraySetAsSeries(lHHStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_LC_HH_STATE_LINE,
barIndex,
mLoopbackBars,
lHHStateBuffer);
//
// High ...
ArraySetAsSeries(lLLBuffer, true);
CopyBuffer(
mHandler,
XMAN_LC_LL_LINE,
barIndex,
mLoopbackBars,
lLLBuffer);
//
// High State ...
ArraySetAsSeries(lLLStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_LC_LL_STATE_LINE,
barIndex,
mLoopbackBars,
lLLStateBuffer);
//
// Hind ...
//
// High ...
ArraySetAsSeries(hHHBuffer, true);
CopyBuffer(
mHandler,
XMAN_HC_HH_LINE,
barIndex,
mLoopbackBars,
hHHBuffer);
//
// High State ...
ArraySetAsSeries(hHHStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_HC_HH_STATE_LINE,
barIndex,
mLoopbackBars,
hHHStateBuffer);
//
// High ...
ArraySetAsSeries(hLLBuffer, true);
CopyBuffer(
mHandler,
XMAN_HC_LL_LINE,
barIndex,
mLoopbackBars,
hLLBuffer);
//
// High State ...
ArraySetAsSeries(hLLStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_HC_LL_STATE_LINE,
barIndex,
mLoopbackBars,
hLLStateBuffer);
//
// Trend ...
//
// Trend ...
ArraySetAsSeries(trendBuffer, true);
CopyBuffer(
mHandler,
XMAN_TREND_LINE,
barIndex,
mLoopbackBars,
trendBuffer);
//
// Trend State ...
ArraySetAsSeries(trendStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_TREND_STATE_LINE,
barIndex,
mLoopbackBars,
trendStateBuffer);
//
// Ribbons ...
//
// 1 ...
//
// R1 ...
ArraySetAsSeries(ribbon1Buffer, true);
CopyBuffer(
mHandler,
XMAN_RB1_LINE,
barIndex,
mLoopbackBars,
ribbon1Buffer);
//
// R1 State ...
ArraySetAsSeries(ribbon1StateBuffer, true);
CopyBuffer(
mHandler,
XMAN_RB1_STATE_LINE,
barIndex,
mLoopbackBars,
ribbon1StateBuffer);
//
// 2 ...
//
// R2 ...
ArraySetAsSeries(ribbon2Buffer, true);
CopyBuffer(
mHandler,
XMAN_RB2_LINE,
barIndex,
mLoopbackBars,
ribbon2Buffer);
//
// R2 State ...
ArraySetAsSeries(ribbon2StateBuffer, true);
CopyBuffer(
mHandler,
XMAN_RB2_STATE_LINE,
barIndex,
mLoopbackBars,
ribbon2StateBuffer);
//
// 3 ...
//
// R3 ...
ArraySetAsSeries(ribbon3Buffer, true);
CopyBuffer(
mHandler,
XMAN_RB3_LINE,
barIndex,
mLoopbackBars,
ribbon3Buffer);
//
// R3 State ...
ArraySetAsSeries(ribbon3StateBuffer, true);
CopyBuffer(
mHandler,
XMAN_RB3_STATE_LINE,
barIndex,
mLoopbackBars,
ribbon3StateBuffer);
//
// 4 ...
//
// R4 ...
ArraySetAsSeries(ribbon4Buffer, true);
CopyBuffer(
mHandler,
XMAN_RB4_LINE,
barIndex,
mLoopbackBars,
ribbon4Buffer);
//
// R4 State ...
ArraySetAsSeries(ribbon4StateBuffer, true);
CopyBuffer(
mHandler,
XMAN_RB4_STATE_LINE,
barIndex,
mLoopbackBars,
ribbon4StateBuffer);
//
// 5 ...
//
// R5 ...
ArraySetAsSeries(ribbon5Buffer, true);
CopyBuffer(
mHandler,
XMAN_RB5_LINE,
barIndex,
mLoopbackBars,
ribbon5Buffer);
//
// R5 State ...
ArraySetAsSeries(ribbon5StateBuffer, true);
CopyBuffer(
mHandler,
XMAN_RB5_STATE_LINE,
barIndex,
mLoopbackBars,
ribbon5StateBuffer);
//
// 6 ...
//
// R6 ...
ArraySetAsSeries(ribbon6Buffer, true);
CopyBuffer(
mHandler,
XMAN_RB6_LINE,
barIndex,
mLoopbackBars,
ribbon6Buffer);
//
// R6 State ...
ArraySetAsSeries(ribbon6StateBuffer, true);
CopyBuffer(
mHandler,
XMAN_RB6_STATE_LINE,
barIndex,
mLoopbackBars,
ribbon6StateBuffer);
//
// SSL Channel ...
//
// UP ...
ArraySetAsSeries(sslUpBuffer, true);
CopyBuffer(
mHandler,
XMAN_SSLC_UP_LINE,
barIndex,
mLoopbackBars,
sslUpBuffer);
//
// DOWN ...
ArraySetAsSeries(sslDownBuffer, true);
CopyBuffer(
mHandler,
XMAN_SSLC_DOWN_LINE,
barIndex,
mLoopbackBars,
sslDownBuffer);
//
// HULL Trend ...
//
// UP ...
ArraySetAsSeries(hullUpBuffer, true);
CopyBuffer(
mHandler,
XMAN_HULL_UP_LINE,
barIndex,
mLoopbackBars,
hullUpBuffer);
//
// UP State ...
ArraySetAsSeries(hullUpStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_HULL_UP_STATE_LINE,
barIndex,
mLoopbackBars,
hullUpStateBuffer);
//
// DOWN ...
ArraySetAsSeries(hullDownBuffer, true);
CopyBuffer(
mHandler,
XMAN_HULL_DOWN_LINE,
barIndex,
mLoopbackBars,
hullDownBuffer);
//
// DOWN State ...
ArraySetAsSeries(hullDownStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_HULL_DOWN_STATE_LINE,
barIndex,
mLoopbackBars,
hullDownStateBuffer);
//
// Hiken Ashi ...
//
// Open ...
ArraySetAsSeries(hkOpenBuffer, true);
CopyBuffer(
mHandler,
XMAN_HK_OPEN_LINE,
barIndex,
mLoopbackBars,
hkOpenBuffer);
//
// High ...
ArraySetAsSeries(hkHighBuffer, true);
CopyBuffer(
mHandler,
XMAN_HK_HIGH_LINE,
barIndex,
mLoopbackBars,
hkHighBuffer);
//
// Low ...
ArraySetAsSeries(hkLowBuffer, true);
CopyBuffer(
mHandler,
XMAN_HK_LOW_LINE,
barIndex,
mLoopbackBars,
hkLowBuffer);
//
// Close ...
ArraySetAsSeries(hkCloseBuffer, true);
CopyBuffer(
mHandler,
XMAN_HK_CLOSE_LINE,
barIndex,
mLoopbackBars,
hkCloseBuffer);
//
// Close ...
ArraySetAsSeries(hkStateBuffer, true);
CopyBuffer(
mHandler,
XMAN_HK_STATE_LINE,
barIndex,
mLoopbackBars,
hkStateBuffer);
}
//
// Retrieve Info at Specific Bar Index ...
XMANInfo GetInfo(
int barIndex // Given Bar Index
)
{
//
XMANInfo result;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
// Do Calculations ...
Calculate(barIndex);
//
// Generate Candle Time ...
datetime barTime = GetCandleTime(
mSymbol,
mPeriod,
barIndex);
//
// Fill Result ...
result.symbol = mSymbol;
result.period = mPeriod;
result.barTime = barTime;
result.barIndex = barIndex;
//
// Buffers ...
//
Copy(peaksBuffer,
result.peaks);
Copy(peaksStateBuffer,
result.peaksStates);
Copy(valesBuffer,
result.vales);
Copy(valesStateBuffer,
result.valesStates);
//
Copy(fibLevel1Buffer,
result.fibLevel1s);
Copy(fibLevel2Buffer,
result.fibLevel2s);
Copy(fibLevel3Buffer,
result.fibLevel3s);
Copy(fibLevel4Buffer,
result.fibLevel4s);
Copy(fibLevel5Buffer,
result.fibLevel5s);
//
Copy(sHHBuffer,
result.sHHs);
Copy(sHHStateBuffer,
result.sHHStates);
Copy(sLLBuffer,
result.sLLs);
Copy(sLLStateBuffer,
result.sLLStates);
//
Copy(mHHBuffer,
result.mHHs);
Copy(mHHStateBuffer,
result.mHHStates);
Copy(mLLBuffer,
result.mLLs);
Copy(mLLStateBuffer,
result.mLLStates);
//
Copy(lHHBuffer,
result.lHHs);
Copy(lHHStateBuffer,
result.lHHStates);
Copy(lLLBuffer,
result.lLLs);
Copy(lLLStateBuffer,
result.lLLStates);
//
Copy(hHHBuffer,
result.hHHs);
Copy(hHHStateBuffer,
result.hHHStates);
Copy(hLLBuffer,
result.hLLs);
Copy(hLLStateBuffer,
result.hLLStates);
//
Copy(trendBuffer,
result.trends);
Copy(trendStateBuffer,
result.trendStates);
//
Copy(ribbon1Buffer,
result.ribbon1s);
Copy(ribbon1StateBuffer,
result.ribbon1States);
//
Copy(ribbon2Buffer,
result.ribbon2s);
Copy(ribbon2StateBuffer,
result.ribbon2States);
//
Copy(ribbon3Buffer,
result.ribbon3s);
Copy(ribbon3StateBuffer,
result.ribbon3States);
//
Copy(ribbon4Buffer,
result.ribbon4s);
Copy(ribbon4StateBuffer,
result.ribbon4States);
//
Copy(ribbon5Buffer,
result.ribbon5s);
Copy(ribbon5StateBuffer,
result.ribbon5States);
//
Copy(ribbon6Buffer,
result.ribbon6s);
Copy(ribbon6StateBuffer,
result.ribbon6States);
//
Copy(sslUpBuffer,
result.sslcUps);
Copy(sslDownBuffer,
result.sslcDowns);
//
Copy(hullUpBuffer,
result.hullUps);
Copy(hullUpStateBuffer,
result.hullUpStates);
Copy(hullDownBuffer,
result.hullDowns);
Copy(hullDownStateBuffer,
result.hullDownStates);
//
Copy(hkOpenBuffer,
result.hkOpens);
Copy(hkHighBuffer,
result.hkHighs);
Copy(hkLowBuffer,
result.hkLows);
Copy(hkCloseBuffer,
result.hkCloses);
Copy(hkStateBuffer,
result.hkStates);
//
int idx = 0;
//
// Conditions ...
bool isNewPeak =
//
peaksStateBuffer[idx] != EMPTY_VALUE
//
;
bool isNewVale =
//
valesStateBuffer[idx] != EMPTY_VALUE
//
;
//
// XSTR ...
//
// Reading Temp ...
ENUM_XMAN_STATES trendState = (ENUM_XMAN_STATES)trendStateBuffer[idx];
ENUM_XMAN_STATES trendStatePrev = (ENUM_XMAN_STATES)trendStateBuffer[idx + 1];
//
bool isTrendBullish =
//
trendState == XMAN_STATE_BULLISH
//
;
//
bool isTrendPrevBullish =
//
trendStatePrev == XMAN_STATE_BULLISH
//
;
//
bool isTrendSwitchedToBullish =
//
isTrendBullish &&
!isTrendPrevBullish
//
;
//
bool isTrendBearish =
//
trendState == XMAN_STATE_BEARISH
//
;
//
bool isTrendPrevBearish =
//
trendStatePrev == XMAN_STATE_BEARISH
//
;
//
bool isTrendSwitchedToBearish =
//
isTrendBearish &&
!isTrendPrevBearish
//
;
//
bool isTrendNeutural =
//
!isTrendBullish &&
!isTrendBearish
//
;
//
bool isTrendPrevNeutural =
//
!isTrendPrevBullish &&
!isTrendPrevBearish
//
;
//
bool isTrendSwitchedToNeutural =
//
isTrendNeutural &&
!isTrendPrevNeutural
//
;
//
// XSSLC ...
//
bool isSSLCBullish =
//
sslUpBuffer[idx] > sslDownBuffer[idx]
//
;
//
bool isSSLPrevBullish =
//
sslUpBuffer[idx + 1] > sslDownBuffer[idx + 1]
//
;
//
bool isSSLCSwitchedToBullish =
//
isSSLCBullish &&
!isSSLPrevBullish
//
;
//
bool isSSLCBearish =
//
sslUpBuffer[idx] < sslDownBuffer[idx]
//
;
//
bool isSSLPrevBearish =
//
sslUpBuffer[idx + 1] < sslDownBuffer[idx + 1]
//
;
//
bool isSSLCSwitchedToBearish =
//
isSSLCBearish &&
!isSSLPrevBearish
//
;
//
bool isSSLCNeutural =
//
!isSSLCBullish &&
!isSSLCBearish
//
;
//
bool isSSLPrevNeutural =
//
!isSSLPrevBullish &&
!isSSLPrevBearish
//
;
//
bool isSSLCSwitchedToNeutural =
//
isSSLCNeutural &&
!isSSLPrevNeutural
//
;
//
// XHULL ...
//
bool isHullUpBullish =
//
hullUpStateBuffer[idx] == XMAN_STATE_BULLISH
//
;
//
bool isHullUpPrevBullish =
//
hullUpStateBuffer[idx + 1] == XMAN_STATE_BULLISH
//
;
//
bool isHullDownBullish =
//
hullDownStateBuffer[idx] == XMAN_STATE_BULLISH
//
;
//
bool isHullDownPrevBullish =
//
hullDownStateBuffer[idx + 1] == XMAN_STATE_BULLISH
//
;
//
bool isHullBullish =
//
isHullUpBullish &&
isHullDownBullish
//
;
//
bool isHullPrevBullish =
//
isHullUpPrevBullish &&
isHullDownPrevBullish
//
;
//
bool isHullSwitchedToBullish =
//
isHullBullish &&
!isHullPrevBullish
//
;
//
bool isHullUpBearish =
//
hullUpStateBuffer[idx] == XMAN_STATE_BEARISH
//
;
//
bool isHullUpPrevBearish =
//
hullUpStateBuffer[idx + 1] == XMAN_STATE_BEARISH
//
;
//
bool isHullDownBearish =
//
hullDownStateBuffer[idx] == XMAN_STATE_BEARISH
//
;
//
bool isHullDownPrevBearish =
//
hullDownStateBuffer[idx + 1] == XMAN_STATE_BEARISH
//
;
//
bool isHullBearish =
//
isHullUpBearish &&
isHullDownBearish
//
;
//
bool isHullPrevBearish =
//
isHullUpPrevBearish &&
isHullDownPrevBearish
//
;
//
bool isHullSwitchedToBearish =
//
isHullBearish &&
!isHullPrevBearish
//
;
//
bool isHullUpNeutural =
//
!isHullUpBullish &&
!isHullUpBearish
//
;
//
bool isHullUpPrevNeutural =
//
!isHullUpPrevBullish &&
!isHullUpPrevBearish
//
;
//
bool isHullDownNeutural =
//
!isHullDownBullish &&
!isHullDownBearish
//
;
//
bool isHullDownPrevNeutural =
//
!isHullDownPrevBullish &&
!isHullDownPrevBearish
//
;
//
bool isHullNeutural =
//
isHullUpNeutural &&
isHullDownNeutural
//
;
//
bool isHullPrevNeutural =
//
isHullUpPrevNeutural &&
isHullDownPrevNeutural
//
;
//
bool isHullSwitchedToNeutural =
//
isHullNeutural &&
!isHullPrevNeutural
//
;
//
// XHK ...
//
// Hiken Ashi ...
bool isHKBullish =
//
hkStateBuffer[idx] == XMAN_STATE_BULLISH
//
;
bool isHKBearish =
//
hkStateBuffer[idx] == XMAN_STATE_BEARISH
//
;
//
// Cycles ...
//
// Level 1 ...
//
ENUM_XMAN_STATES scHState = (ENUM_XMAN_STATES)sHHStateBuffer[idx];
ENUM_XMAN_STATES scHStatePrev = (ENUM_XMAN_STATES)sHHStateBuffer[idx + 1];
ENUM_XMAN_STATES scLState = (ENUM_XMAN_STATES)sLLStateBuffer[idx];
ENUM_XMAN_STATES scLStatePrev = (ENUM_XMAN_STATES)sLLStateBuffer[idx + 1];
//
// Bullish ...
//
bool isSCHBullish = scHState == XMAN_STATE_BULLISH;
bool isSCHPrevBullish = scHStatePrev == XMAN_STATE_BULLISH;
//
bool isSCLBullish = scLState == XMAN_STATE_BULLISH;
bool isSCLPrevBullish = scLStatePrev == XMAN_STATE_BULLISH;
//
bool isSCBullish =
isSCHBullish &&
isSCLBullish;
//
bool isSCPrevBullish =
isSCHPrevBullish &&
isSCLPrevBullish;
//
bool isSCHSwitchedToBullish =
isSCHBullish &&
!isSCHPrevBullish;
//
bool isSCLSwitchedToBullish =
isSCLBullish &&
!isSCLPrevBullish;
//
bool isSCSwitchedToBullish =
isSCBullish &&
!isSCPrevBullish;
//
// Bearish ...
//
bool isSCHBearish = scHState == XMAN_STATE_BEARISH;
bool isSCHPrevBearish = scHStatePrev == XMAN_STATE_BEARISH;
//
bool isSCLBearish = scLState == XMAN_STATE_BEARISH;
bool isSCLPrevBearish = scLStatePrev == XMAN_STATE_BEARISH;
//
bool isSCBearish =
isSCHBearish &&
isSCLBearish;
//
bool isSCPrevBearish =
isSCHPrevBearish &&
isSCLPrevBearish;
//
bool isSCHSwitchedToBearish =
isSCHBearish &&
!isSCHPrevBearish;
//
bool isSCLSwitchedToBearish =
isSCLBearish &&
!isSCLPrevBearish;
//
bool isSCSwitchedToBearish =
isSCBearish &&
!isSCPrevBearish;
//
// Neutural ...
//
bool isSCHNeutural =
!isSCHBullish &&
!isSCHBearish;
//
bool isSCHPrevNeutural =
!isSCHPrevBullish &&
!isSCHPrevBearish;
//
bool isSCLNeutural =
!isSCLBullish &&
!isSCLBearish;
//
bool isSCLPrevNeutural =
!isSCLPrevBullish &&
!isSCLPrevBearish;
//
bool isSCNeutural =
isSCHNeutural &&
isSCLNeutural;
//
bool isSCPrevNeutural =
isSCHPrevNeutural &&
isSCLPrevNeutural;
//
bool isSCHSwitchedToNeutural =
isSCHNeutural &&
!isSCHPrevNeutural;
//
bool isSCLSwitchedToNeutural =
isSCLNeutural &&
!isSCLPrevNeutural;
//
bool isSCSwitchedToNeutural =
isSCNeutural &&
!isSCPrevNeutural;
//
// Level 2 ...
//
ENUM_XMAN_STATES mcHState = (ENUM_XMAN_STATES)mHHStateBuffer[idx];
ENUM_XMAN_STATES mcHStatePrev = (ENUM_XMAN_STATES)mHHStateBuffer[idx + 1];
ENUM_XMAN_STATES mcLState = (ENUM_XMAN_STATES)mLLStateBuffer[idx];
ENUM_XMAN_STATES mcLStatePrev = (ENUM_XMAN_STATES)mLLStateBuffer[idx + 1];
//
// Bullish ...
//
bool isMCHBullish = mcHState == XMAN_STATE_BULLISH;
bool isMCHPrevBullish = mcHStatePrev == XMAN_STATE_BULLISH;
//
bool isMCLBullish = mcLState == XMAN_STATE_BULLISH;
bool isMCLPrevBullish = mcLStatePrev == XMAN_STATE_BULLISH;
//
bool isMCBullish =
isMCHBullish &&
isMCLBullish;
//
bool isMCPrevBullish =
isMCHPrevBullish &&
isMCLPrevBullish;
//
bool isMCHSwitchedToBullish =
isMCHBullish &&
!isMCHPrevBullish;
//
bool isMCLSwitchedToBullish =
isMCLBullish &&
!isMCLPrevBullish;
//
bool isMCSwitchedToBullish =
isMCBullish &&
!isMCPrevBullish;
//
// Bearish ...
//
bool isMCHBearish = mcHState == XMAN_STATE_BEARISH;
bool isMCHPrevBearish = mcHStatePrev == XMAN_STATE_BEARISH;
//
bool isMCLBearish = mcLState == XMAN_STATE_BEARISH;
bool isMCLPrevBearish = mcLStatePrev == XMAN_STATE_BEARISH;
//
bool isMCBearish =
isMCHBearish &&
isMCLBearish;
//
bool isMCPrevBearish =
isMCHPrevBearish &&
isMCLPrevBearish;
//
bool isMCHSwitchedToBearish =
isMCHBearish &&
!isMCHPrevBearish;
//
bool isMCLSwitchedToBearish =
isMCLBearish &&
!isMCLPrevBearish;
//
bool isMCSwitchedToBearish =
isMCBearish &&
!isMCPrevBearish;
//
// Neutural ...
//
bool isMCHNeutural =
!isMCHBullish &&
!isMCHBearish;
//
bool isMCHPrevNeutural =
!isMCHPrevBullish &&
!isMCHPrevBearish;
//
bool isMCLNeutural =
!isMCLBullish &&
!isMCLBearish;
//
bool isMCLPrevNeutural =
!isMCLPrevBullish &&
!isMCLPrevBearish;
//
bool isMCNeutural =
isMCHNeutural &&
isMCLNeutural;
//
bool isMCPrevNeutural =
isMCHPrevNeutural &&
isMCLPrevNeutural;
//
bool isMCHSwitchedToNeutural =
isMCHNeutural &&
!isMCHPrevNeutural;
//
bool isMCLSwitchedToNeutural =
isMCLNeutural &&
!isMCLPrevNeutural;
//
bool isMCSwitchedToNeutural =
isMCNeutural &&
!isMCPrevNeutural;
//
// Level 3 ...
//
ENUM_XMAN_STATES lcHState = (ENUM_XMAN_STATES)lHHStateBuffer[idx];
ENUM_XMAN_STATES lcHStatePrev = (ENUM_XMAN_STATES)lHHStateBuffer[idx + 1];
ENUM_XMAN_STATES lcLState = (ENUM_XMAN_STATES)lLLStateBuffer[idx];
ENUM_XMAN_STATES lcLStatePrev = (ENUM_XMAN_STATES)lLLStateBuffer[idx + 1];
//
// Bullish ...
//
bool isLCHBullish = lcHState == XMAN_STATE_BULLISH;
bool isLCHPrevBullish = lcHStatePrev == XMAN_STATE_BULLISH;
//
bool isLCLBullish = lcLState == XMAN_STATE_BULLISH;
bool isLCLPrevBullish = lcLStatePrev == XMAN_STATE_BULLISH;
//
bool isLCBullish =
isLCHBullish &&
isLCLBullish;
//
bool isLCPrevBullish =
isLCHPrevBullish &&
isLCLPrevBullish;
//
bool isLCHSwitchedToBullish =
isLCHBullish &&
!isLCHPrevBullish;
//
bool isLCLSwitchedToBullish =
isLCLBullish &&
!isLCLPrevBullish;
//
bool isLCSwitchedToBullish =
isLCBullish &&
!isLCPrevBullish;
//
// Bearish ...
//
bool isLCHBearish = lcHState == XMAN_STATE_BEARISH;
bool isLCHPrevBearish = lcHStatePrev == XMAN_STATE_BEARISH;
//
bool isLCLBearish = lcLState == XMAN_STATE_BEARISH;
bool isLCLPrevBearish = lcLStatePrev == XMAN_STATE_BEARISH;
//
bool isLCBearish =
isLCHBearish &&
isLCLBearish;
//
bool isLCPrevBearish =
isLCHPrevBearish &&
isLCLPrevBearish;
//
bool isLCHSwitchedToBearish =
isLCHBearish &&
!isLCHPrevBearish;
//
bool isLCLSwitchedToBearish =
isLCLBearish &&
!isLCLPrevBearish;
//
bool isLCSwitchedToBearish =
isLCBearish &&
!isLCPrevBearish;
//
// Neutural ...
//
bool isLCHNeutural =
!isLCHBullish &&
!isLCHBearish;
//
bool isLCHPrevNeutural =
!isLCHPrevBullish &&
!isLCHPrevBearish;
//
bool isLCLNeutural =
!isLCLBullish &&
!isLCLBearish;
//
bool isLCLPrevNeutural =
!isLCLPrevBullish &&
!isLCLPrevBearish;
//
bool isLCNeutural =
isLCHNeutural &&
isLCLNeutural;
//
bool isLCPrevNeutural =
isLCHPrevNeutural &&
isLCLPrevNeutural;
//
bool isLCHSwitchedToNeutural =
isLCHNeutural &&
!isLCHPrevNeutural;
//
bool isLCLSwitchedToNeutural =
isLCLNeutural &&
!isLCLPrevNeutural;
//
bool isLCSwitchedToNeutural =
isLCNeutural &&
!isLCPrevNeutural;
//
// Level 4 ...
//
ENUM_XMAN_STATES hcHState = (ENUM_XMAN_STATES)hHHStateBuffer[idx];
ENUM_XMAN_STATES hcHStatePrev = (ENUM_XMAN_STATES)hHHStateBuffer[idx + 1];
ENUM_XMAN_STATES hcLState = (ENUM_XMAN_STATES)hLLStateBuffer[idx];
ENUM_XMAN_STATES hcLStatePrev = (ENUM_XMAN_STATES)hLLStateBuffer[idx + 1];
//
// Bullish ...
//
bool isHCHBullish = hcHState == XMAN_STATE_BULLISH;
bool isHCHPrevBullish = hcHStatePrev == XMAN_STATE_BULLISH;
//
bool isHCLBullish = hcLState == XMAN_STATE_BULLISH;
bool isHCLPrevBullish = hcLStatePrev == XMAN_STATE_BULLISH;
//
bool isHCBullish =
isHCHBullish &&
isHCLBullish;
//
bool isHCPrevBullish =
isHCHPrevBullish &&
isHCLPrevBullish;
//
bool isHCHSwitchedToBullish =
isHCHBullish &&
!isHCHPrevBullish;
//
bool isHCLSwitchedToBullish =
isHCLBullish &&
!isHCLPrevBullish;
//
bool isHCSwitchedToBullish =
isHCBullish &&
!isHCPrevBullish;
//
// Bearish ...
//
bool isHCHBearish = hcHState == XMAN_STATE_BEARISH;
bool isHCHPrevBearish = hcHStatePrev == XMAN_STATE_BEARISH;
//
bool isHCLBearish = hcLState == XMAN_STATE_BEARISH;
bool isHCLPrevBearish = hcLStatePrev == XMAN_STATE_BEARISH;
//
bool isHCBearish =
isHCHBearish &&
isHCLBearish;
//
bool isHCPrevBearish =
isHCHPrevBearish &&
isHCLPrevBearish;
//
bool isHCHSwitchedToBearish =
isHCHBearish &&
!isHCHPrevBearish;
//
bool isHCLSwitchedToBearish =
isHCLBearish &&
!isHCLPrevBearish;
//
bool isHCSwitchedToBearish =
isHCBearish &&
!isHCPrevBearish;
//
// Neutural ...
//
bool isHCHNeutural =
!isHCHBullish &&
!isHCHBearish;
//
bool isHCHPrevNeutural =
!isHCHPrevBullish &&
!isHCHPrevBearish;
//
bool isHCLNeutural =
!isHCLBullish &&
!isHCLBearish;
//
bool isHCLPrevNeutural =
!isHCLPrevBullish &&
!isHCLPrevBearish;
//
bool isHCNeutural =
isHCHNeutural &&
isHCLNeutural;
//
bool isHCPrevNeutural =
isHCHPrevNeutural &&
isHCLPrevNeutural;
//
bool isHCHSwitchedToNeutural =
isHCHNeutural &&
!isHCHPrevNeutural;
//
bool isHCLSwitchedToNeutural =
isHCLNeutural &&
!isHCLPrevNeutural;
//
bool isHCSwitchedToNeutural =
isHCNeutural &&
!isHCPrevNeutural;
//
// Ribbons ...
//
// R1 ...
ENUM_XMAN_STATES r1State = (ENUM_XMAN_STATES)ribbon1StateBuffer[idx];
ENUM_XMAN_STATES r1StatePrev = (ENUM_XMAN_STATES)ribbon1StateBuffer[idx + 1];
//
// R2 ...
ENUM_XMAN_STATES r2State = (ENUM_XMAN_STATES)ribbon2StateBuffer[idx];
ENUM_XMAN_STATES r2StatePrev = (ENUM_XMAN_STATES)ribbon2StateBuffer[idx + 1];
//
// R3 ...
ENUM_XMAN_STATES r3State = (ENUM_XMAN_STATES)ribbon3StateBuffer[idx];
ENUM_XMAN_STATES r3StatePrev = (ENUM_XMAN_STATES)ribbon3StateBuffer[idx + 1];
//
// R4 ...
ENUM_XMAN_STATES r4State = (ENUM_XMAN_STATES)ribbon4StateBuffer[idx];
ENUM_XMAN_STATES r4StatePrev = (ENUM_XMAN_STATES)ribbon4StateBuffer[idx + 1];
//
// R5 ...
ENUM_XMAN_STATES r5State = (ENUM_XMAN_STATES)ribbon5StateBuffer[idx];
ENUM_XMAN_STATES r5StatePrev = (ENUM_XMAN_STATES)ribbon5StateBuffer[idx + 1];
//
// R6 ...
ENUM_XMAN_STATES r6State = (ENUM_XMAN_STATES)ribbon6StateBuffer[idx];
ENUM_XMAN_STATES r6StatePrev = (ENUM_XMAN_STATES)ribbon6StateBuffer[idx + 1];
//
// Bullish ...
//
bool isRibbon1Bullish = r1State == XMAN_STATE_BULLISH;
bool isRibbon2Bullish = r2State == XMAN_STATE_BULLISH;
bool isRibbon3Bullish = r3State == XMAN_STATE_BULLISH;
bool isRibbon4Bullish = r4State == XMAN_STATE_BULLISH;
bool isRibbon5Bullish = r5State == XMAN_STATE_BULLISH;
bool isRibbon6Bullish = r6State == XMAN_STATE_BULLISH;
//
bool isRibbon1PrevBullish = r1StatePrev == XMAN_STATE_BULLISH;
bool isRibbon2PrevBullish = r2StatePrev == XMAN_STATE_BULLISH;
bool isRibbon3PrevBullish = r3StatePrev == XMAN_STATE_BULLISH;
bool isRibbon4PrevBullish = r4StatePrev == XMAN_STATE_BULLISH;
bool isRibbon5PrevBullish = r5StatePrev == XMAN_STATE_BULLISH;
bool isRibbon6PrevBullish = r6StatePrev == XMAN_STATE_BULLISH;
//
// Bearish ...
//
bool isRibbon1Bearish = r1State == XMAN_STATE_BEARISH;
bool isRibbon2Bearish = r2State == XMAN_STATE_BEARISH;
bool isRibbon3Bearish = r3State == XMAN_STATE_BEARISH;
bool isRibbon4Bearish = r4State == XMAN_STATE_BEARISH;
bool isRibbon5Bearish = r5State == XMAN_STATE_BEARISH;
bool isRibbon6Bearish = r6State == XMAN_STATE_BEARISH;
//
bool isRibbon1PrevBearish = r1StatePrev == XMAN_STATE_BEARISH;
bool isRibbon2PrevBearish = r2StatePrev == XMAN_STATE_BEARISH;
bool isRibbon3PrevBearish = r3StatePrev == XMAN_STATE_BEARISH;
bool isRibbon4PrevBearish = r4StatePrev == XMAN_STATE_BEARISH;
bool isRibbon5PrevBearish = r5StatePrev == XMAN_STATE_BEARISH;
bool isRibbon6PrevBearish = r6StatePrev == XMAN_STATE_BEARISH;
//
// Neutural ...
//
bool isRibbon1Neutural =
!isRibbon1Bullish &&
!isRibbon1Bearish;
//
bool isRibbon2Neutural =
!isRibbon2Bullish &&
!isRibbon2Bearish;
//
bool isRibbon3Neutural =
!isRibbon3Bullish &&
!isRibbon3Bearish;
//
bool isRibbon4Neutural =
!isRibbon4Bullish &&
!isRibbon4Bearish;
//
bool isRibbon5Neutural =
!isRibbon5Bullish &&
!isRibbon5Bearish;
//
bool isRibbon6Neutural =
!isRibbon6Bullish &&
!isRibbon6Bearish;
//
bool isRibbon1PrevNeutural =
!isRibbon1PrevBullish &&
!isRibbon1PrevBearish;
//
bool isRibbon2PrevNeutural =
!isRibbon2PrevBullish &&
!isRibbon2PrevBearish;
//
bool isRibbon3PrevNeutural =
!isRibbon3PrevBullish &&
!isRibbon3PrevBearish;
//
bool isRibbon4PrevNeutural =
!isRibbon4PrevBullish &&
!isRibbon4PrevBearish;
//
bool isRibbon5PrevNeutural =
!isRibbon5PrevBullish &&
!isRibbon5PrevBearish;
//
bool isRibbon6PrevNeutural =
!isRibbon6PrevBullish &&
!isRibbon6PrevBearish;
//
// All Ribbons ...
//
bool isRibbonBullish =
isRibbon1Bullish &&
isRibbon2Bullish &&
isRibbon3Bullish &&
isRibbon4Bullish &&
isRibbon5Bullish &&
isRibbon6Bullish;
//
bool isRibbonPrevBullish =
isRibbon1PrevBullish &&
isRibbon2PrevBullish &&
isRibbon3PrevBullish &&
isRibbon4PrevBullish &&
isRibbon5PrevBullish &&
isRibbon6PrevBullish;
//
bool isRibbonSwitchedToBullish =
isRibbonBullish &&
!isRibbonPrevBullish;
//
bool isRibbonBearish =
isRibbon1Bearish &&
isRibbon2Bearish &&
isRibbon3Bearish &&
isRibbon4Bearish &&
isRibbon5Bearish &&
isRibbon6Bearish;
//
bool isRibbonPrevBearish =
isRibbon1PrevBearish &&
isRibbon2PrevBearish &&
isRibbon3PrevBearish &&
isRibbon4PrevBearish &&
isRibbon5PrevBearish &&
isRibbon6PrevBearish;
//
bool isRibbonSwitchedToBearish =
isRibbonBearish &&
!isRibbonPrevBearish;
//
bool isRibbonNeutural =
isRibbon1Neutural &&
isRibbon2Neutural &&
isRibbon3Neutural &&
isRibbon4Neutural &&
isRibbon5Neutural &&
isRibbon6Neutural;
//
bool isRibbonPrevNeutural =
isRibbon1PrevNeutural &&
isRibbon2PrevNeutural &&
isRibbon3PrevNeutural &&
isRibbon4PrevNeutural &&
isRibbon5PrevNeutural &&
isRibbon6PrevNeutural;
//
bool isRibbonSwitchedToNeutural =
isRibbonNeutural &&
!isRibbonPrevNeutural;
//
result.isNewPeak = isNewPeak;
result.isNewVale = isNewVale;
result.isTrendBullish = isTrendBullish;
result.isTrendSwitchedToBullish = isTrendSwitchedToBullish;
result.isTrendBearish = isTrendBearish;
result.isTrendSwitchedToBearish = isTrendSwitchedToBearish;
result.isTrendNeutural = isTrendNeutural;
result.isTrendSwitchedToNeutural = isTrendSwitchedToNeutural;
result.isSSLCBullish = isSSLCBullish;
result.isSSLCSwitchedToBullish = isSSLCSwitchedToBullish;
result.isSSLCBearish = isSSLCBearish;
result.isSSLCSwitchedToBearish = isSSLCSwitchedToBearish;
result.isSSLCNeutural = isSSLCNeutural;
result.isSSLCSwitchedToNeutural = isSSLCSwitchedToNeutural;
result.isHullBullish = isHullBullish;
result.isHullUpBullish = isHullUpBullish;
result.isHullDownBullish = isHullDownBullish;
result.isHullSwitchedToBullish = isHullSwitchedToBullish;
result.isHullBearish = isHullBearish;
result.isHullUpBearish = isHullUpBearish;
result.isHullDownBearish = isHullDownBearish;
result.isHullSwitchedToBearish = isHullSwitchedToBearish;
result.isHullNeutural = isHullNeutural;
result.isHullUpNeutural = isHullUpNeutural;
result.isHullDownNeutural = isHullDownNeutural;
result.isHullSwitchedToNeutural = isHullSwitchedToNeutural;
result.isHKBullish = isHKBullish;
result.isHKBearish = isHKBearish;
result.isSCBullish = isSCBullish;
result.isSCHBullish = isSCHBullish;
result.isSCLBullish = isSCLBullish;
result.isSCSwitchedToBullish = isSCSwitchedToBullish;
result.isSCHSwitchedToBullish = isSCHSwitchedToBullish;
result.isSCLSwitchedToBullish = isSCLSwitchedToBullish;
result.isSCBearish = isSCBearish;
result.isSCHBearish = isSCHBearish;
result.isSCLBearish = isSCLBearish;
result.isSCSwitchedToBearish = isSCSwitchedToBearish;
result.isSCHSwitchedToBearish = isSCHSwitchedToBearish;
result.isSCLSwitchedToBearish = isSCLSwitchedToBearish;
result.isSCNeutural = isSCNeutural;
result.isSCHNeutural = isSCHNeutural;
result.isSCLNeutural = isSCLNeutural;
result.isSCSwitchedToNeutural = isSCSwitchedToNeutural;
result.isSCHSwitchedToNeutural = isSCHSwitchedToNeutural;
result.isSCLSwitchedToNeutural = isSCLSwitchedToNeutural;
result.isMCBullish = isMCBullish;
result.isMCHBullish = isMCHBullish;
result.isMCLBullish = isMCLBullish;
result.isMCSwitchedToBullish = isMCSwitchedToBullish;
result.isMCHSwitchedToBullish = isMCHSwitchedToBullish;
result.isMCLSwitchedToBullish = isMCLSwitchedToBullish;
result.isMCBearish = isMCBearish;
result.isMCHBearish = isMCHBearish;
result.isMCLBearish = isMCLBearish;
result.isMCSwitchedToBearish = isMCSwitchedToBearish;
result.isMCHSwitchedToBearish = isMCHSwitchedToBearish;
result.isMCLSwitchedToBearish = isMCLSwitchedToBearish;
result.isMCNeutural = isMCNeutural;
result.isMCHNeutural = isMCHNeutural;
result.isMCLNeutural = isMCLNeutural;
result.isMCSwitchedToNeutural = isMCSwitchedToNeutural;
result.isMCHSwitchedToNeutural = isMCHSwitchedToNeutural;
result.isMCLSwitchedToNeutural = isMCLSwitchedToNeutural;
result.isLCBullish = isLCBullish;
result.isLCHBullish = isLCHBullish;
result.isLCLBullish = isLCLBullish;
result.isLCSwitchedToBullish = isLCSwitchedToBullish;
result.isLCHSwitchedToBullish = isLCHSwitchedToBullish;
result.isLCLSwitchedToBullish = isLCLSwitchedToBullish;
result.isLCBearish = isLCBearish;
result.isLCHBearish = isLCHBearish;
result.isLCLBearish = isLCLBearish;
result.isLCSwitchedToBearish = isLCSwitchedToBearish;
result.isLCHSwitchedToBearish = isLCHSwitchedToBearish;
result.isLCLSwitchedToBearish = isLCLSwitchedToBearish;
result.isLCNeutural = isLCNeutural;
result.isLCHNeutural = isLCHNeutural;
result.isLCLNeutural = isLCLNeutural;
result.isLCSwitchedToNeutural = isLCSwitchedToNeutural;
result.isLCHSwitchedToNeutural = isLCHSwitchedToNeutural;
result.isLCLSwitchedToNeutural = isLCLSwitchedToNeutural;
result.isHCBullish = isHCBullish;
result.isHCHBullish = isHCHBullish;
result.isHCLBullish = isHCLBullish;
result.isHCSwitchedToBullish = isHCSwitchedToBullish;
result.isHCHSwitchedToBullish = isHCHSwitchedToBullish;
result.isHCLSwitchedToBullish = isHCLSwitchedToBullish;
result.isHCBearish = isHCBearish;
result.isHCHBearish = isHCHBearish;
result.isHCLBearish = isHCLBearish;
result.isHCSwitchedToBearish = isHCSwitchedToBearish;
result.isHCHSwitchedToBearish = isHCHSwitchedToBearish;
result.isHCLSwitchedToBearish = isHCLSwitchedToBearish;
result.isHCNeutural = isHCNeutural;
result.isHCHNeutural = isHCHNeutural;
result.isHCLNeutural = isHCLNeutural;
result.isHCSwitchedToNeutural = isHCSwitchedToNeutural;
result.isHCHSwitchedToNeutural = isHCHSwitchedToNeutural;
result.isHCLSwitchedToNeutural = isHCLSwitchedToNeutural;
result.isRibbon1Bullish = isRibbon1Bullish;
result.isRibbon2Bullish = isRibbon2Bullish;
result.isRibbon3Bullish = isRibbon3Bullish;
result.isRibbon4Bullish = isRibbon4Bullish;
result.isRibbon5Bullish = isRibbon5Bullish;
result.isRibbon6Bullish = isRibbon6Bullish;
result.isRibbon1Bearish = isRibbon1Bearish;
result.isRibbon2Bearish = isRibbon2Bearish;
result.isRibbon3Bearish = isRibbon3Bearish;
result.isRibbon4Bearish = isRibbon4Bearish;
result.isRibbon5Bearish = isRibbon5Bearish;
result.isRibbon6Bearish = isRibbon6Bearish;
result.isRibbon1Neutural = isRibbon1Neutural;
result.isRibbon2Neutural = isRibbon2Neutural;
result.isRibbon3Neutural = isRibbon3Neutural;
result.isRibbon4Neutural = isRibbon4Neutural;
result.isRibbon5Neutural = isRibbon5Neutural;
result.isRibbon6Neutural = isRibbon6Neutural;
result.isRibbonBullish = isRibbonBullish;
result.isRibbonSwitchedToBullish = isRibbonSwitchedToBullish;
result.isRibbonBearish = isRibbonBearish;
result.isRibbonSwitchedToBearish = isRibbonSwitchedToBearish;
result.isRibbonNeutural = isRibbonNeutural;
result.isRibbonSwitchedToNeutural = isRibbonSwitchedToNeutural;
//
return result;
}
//
// TOOLS ...
//
bool IsValesTrendBearish(
int count = 10 // Number of Values Processed
)
{
//
bool result = false;
//
int calculatedVales = 0;
int verifier = 0;
//
int availableBars = Bars(
mSymbol,
mPeriod);
//
for (int i = 1; i < availableBars - 2; i++)
{
//
// Update Buffers ...
Calculate(i);
//
// Check New Vale Happens ...
bool isNewVale =
//
valesBuffer[0] != valesBuffer[1]
//
;
if (!isNewVale)
{
continue;
}
//
// Check New Vale is Over last or Under Last ...
bool isOverLastVale =
//
valesBuffer[0] > valesBuffer[1]
//
;
//
// Set Verifier Value based On New Vale State ...
if (isOverLastVale)
{
verifier++;
}
else
{
verifier--;
}
//
// Increase Number of Calculated Vales ...
calculatedVales++;
//
// Break when Calculating required Vales ...
if (calculatedVales >= count)
{
break;
}
}
//
result = verifier < 0;
//
return result;
}
//
bool IsValesTrendBullish(
int count = 10 // Number of Values Processed
)
{
//
bool result = false;
//
int calculatedVales = 0;
int verifier = 0;
//
int availableBars = Bars(
mSymbol,
mPeriod);
//
for (int i = 1; i < availableBars - 2; i++)
{
//
// Update Buffers ...
Calculate(i);
//
// Check New Vale Happens ...
bool isNewVale =
//
valesBuffer[0] != valesBuffer[1]
//
;
if (!isNewVale)
{
continue;
}
//
// Check New Vale is Over last or Under Last ...
bool isOverLastVale =
//
valesBuffer[0] > valesBuffer[1]
//
;
//
// Set Verifier Value based On New Vale State ...
if (isOverLastVale)
{
verifier++;
}
else
{
verifier--;
}
//
// Increase Number of Calculated Vales ...
calculatedVales++;
//
// Break when Calculating required Vales ...
if (calculatedVales >= count)
{
break;
}
}
//
result = verifier > 0;
//
return result;
}
//
bool IsPeaksTrendBearish(
int count = 10 // Number of Peaks Processed
)
{
//
bool result = false;
//
int calculatedPeaks = 0;
int verifier = 0;
//
int availableBars = Bars(
mSymbol,
mPeriod);
//
for (int i = 1; i < availableBars - 2; i++)
{
//
// Update Buffers ...
Calculate(i);
//
// Check New Peak Happens ...
bool isNewPeak =
//
peaksBuffer[0] != peaksBuffer[1]
//
;
if (!isNewPeak)
{
continue;
}
//
// Check New Peak is Over last or Under Last ...
bool isOverLastPeak =
//
peaksBuffer[0] > peaksBuffer[1]
//
;
//
// Set Verifier Value based On New Peak State ...
if (isOverLastPeak)
{
verifier++;
}
else
{
verifier--;
}
//
// Increase Number of Calculated Peaks ...
calculatedPeaks++;
//
// Break when Calculating required Peaks ...
if (calculatedPeaks >= count)
{
break;
}
}
//
result = verifier < 0;
//
return result;
}
//
bool IsPeaksTrendBullish(
int count = 10 // Number of Peaks Processed
)
{
//
bool result = false;
//
int calculatedPeaks = 0;
int verifier = 0;
//
int availableBars = Bars(
mSymbol,
mPeriod);
//
for (int i = 1; i < availableBars - 2; i++)
{
//
// Update Buffers ...
Calculate(i);
//
// Check New Peak Happens ...
bool isNewPeak =
//
peaksBuffer[0] != peaksBuffer[1]
//
;
if (!isNewPeak)
{
continue;
}
//
// Check New Peak is Over last or Under Last ...
bool isOverLastPeak =
//
peaksBuffer[0] > peaksBuffer[1]
//
;
//
// Set Verifier Value based On New Peak State ...
if (isOverLastPeak)
{
verifier++;
}
else
{
verifier--;
}
//
// Increase Number of Calculated Peaks ...
calculatedPeaks++;
//
// Break when Calculating required Peaks ...
if (calculatedPeaks >= count)
{
break;
}
}
//
result = verifier > 0;
//
return result;
}
//
// Protcted ...
protected:
//
// Private ...
private:
//
// Inputs ...
//
// Candle Timer ...
color mCandleTimerColor; // Text Color
ENUM_BASE_CORNER mCandleTimerCorner; // Text Position
//
// Chart Style ...
color mUpColor; // Up Color
color mDownColor; // Down Color
color mLineColor; // Line mode and Doji candlestick Color
color mBearishColor; // Bullish Color
color mBullishColor; // Bearish Color
color mVolumesColor; // Volumes Color
ENUM_CHART_MODE mChartMode; // Chart Mode
//
// Market Cycles ...
//
// Level 1 ...
ENUM_X_PERIOD_METHOD mL1Method; // How to Find Period
ENUM_TIMEFRAMES mL1Period; // Time Period
//
// Level 2 ...
ENUM_X_PERIOD_METHOD mL2Method; // How to Find Period
ENUM_TIMEFRAMES mL2Period; // Time Period
//
// Level 3 ...
ENUM_X_PERIOD_METHOD mL3Method; // How to Find Period
ENUM_TIMEFRAMES mL3Period; // Time Period
//
// Level 4 ...
ENUM_X_PERIOD_METHOD mL4Method; // How to Find Period
ENUM_TIMEFRAMES mL4Period; // Time Period
//
// Fibonacci ...
double mFiboLevel1; // Fibio 1st Level
double mFiboLevel2; // Fibio 2st Level
double mFiboLevel3; // Fibio 3rd Level
double mFiboLevel4; // Fibio 4th Level
double mFiboLevel5; // Fibio 5th Level
//
// Boundary Detection Modes ...
ENUM_SERIESMODE mHHMode; // Highest High Calculation Method
ENUM_SERIESMODE mLLMode; // Lowest Low Calculation Method
//
// Trend Detection
double mTrendMultiplier; // Multiplier
ENUM_APPLIED_PRICE mTrendPriceAppliedTo; // Applied To
//
// Ribbon Detection ...
ENUM_X_MA_METHOD mRibbonMode; // How to Calculate
//
// Hull Trend Detection ...
double mHullDivisor; // Divisor (Speed)
ENUM_APPLIED_PRICE mHullUpAppliedTo; // Up Zone Applied to
ENUM_APPLIED_PRICE mHullDownAppliedTo; // Down Zone Applied to
//
// SSL Channel Detection ...
ENUM_X_MA_METHOD mSslcMode; // How to Calculate
ENUM_APPLIED_PRICE mSslcUpAppliedTo; // Up Applied To
ENUM_APPLIED_PRICE mSslcDownAppliedTo; // Down Applied To
//
// Presentation ...
bool mShowCandleTimer; // Show Candle Time
bool mShowCandles; // Show Candles
bool mShowHKCandles; // Draw Hiken Ashi Candle
bool mShowPeaksAndVales; // Show Peaks and Vales
bool mShowTrends; // Show Trends
bool mSillTrends; // Fill Trends
bool mShowLevels; // Show Levels
bool mShowConsolidations; // Show Consolidations
bool mShowRibbons; // Show Ribbons
bool mShowHull; // Show Hull
bool mShowSSLChannel; // Show SSL Channel
bool mShowFibo1Levels; // Show Fibo 1st Level
bool mShowFibo2Levels; // Show Fibo 2nd Level
bool mShowFibo3Levels; // Show Fibo 3rd Level
bool mShowFibo4Levels; // Show Fibo 4th Level
bool mShowFibo5Levels; // Show Fibo 5th Level
};
//
// START Usefull Functions ...
//
//
// END Usefull Functions ...
//