Files
xMQL5/BKPS/14030823/BKPs/14030802-X121/Indicators/x-saherelm.xchdon.mq5
T
2024-11-15 10:50:11 +03:30

1603 lines
42 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Indicator
// -------------------------------------------------
// Name: XCHDON
// Description: Donchain on Cycles ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm XCHDON Indicator"
#property strict
//
#define ShortName "XCHDON"
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
//
// Inputs ...
//
input group "Market";
input int length = 52; // Market Length
//
input group "Cycles";
//
input group "Short";
input ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period
input ENUM_TIMEFRAMES scPeriod = NULL; // Time Period
//
input group "Medium";
input ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // How to Find Period
input ENUM_TIMEFRAMES mcPeriod = NULL; // Time Period
//
input group "Long";
input ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // How to Find Period
input ENUM_TIMEFRAMES lcPeriod = NULL; // Time Period
//
input group "Hind";
input ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Period
input ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period
//
input group "Presentation";
//
input bool showUpper = true; // Show Upper Band
input bool showLower = true; // Show Lower Band
//
input bool showOpen = true; // Show Open
input bool showHigh = true; // Show High
input bool showClose = true; // Show Close
input bool showLow = true; // Show Low
//
input bool showCurrent = true; // Show Current Cycle
input bool showShort = true; // Show Short Cycle
input bool showMedium = true; // Show Medium Cycle
input bool showLong = true; // Show Long Cycle
input bool showHind = true; // Show Hind Cycle
//
// Buffers ...
//
#property indicator_chart_window
//
#property indicator_buffers 40
#property indicator_plots 40
//
// Current ...
//
// Open ...
//
#define cOpenUpperBufferIndex 0
double cOpenUpperBuffer[];
//
#property indicator_label1 "XCHDON C O U"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrCornflowerBlue
#property indicator_width1 1
//
#define cOpenLowerBufferIndex 1
double cOpenLowerBuffer[];
//
#property indicator_label2 "XCHDON C O L"
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrCornflowerBlue
#property indicator_width2 1
//
// High ...
//
#define cHighUpperBufferIndex 2
double cHighUpperBuffer[];
//
#property indicator_label3 "XCHDON C H U"
#property indicator_type3 DRAW_LINE
#property indicator_color3 clrAquamarine
#property indicator_width3 1
//
#define cHighLowerBufferIndex 3
double cHighLowerBuffer[];
//
#property indicator_label4 "XCHDON C H L"
#property indicator_type4 DRAW_LINE
#property indicator_color4 clrAquamarine
#property indicator_width4 1
//
// Low ...
//
#define cLowUpperBufferIndex 4
double cLowUpperBuffer[];
//
#property indicator_label5 "XCHDON C L U"
#property indicator_type5 DRAW_LINE
#property indicator_color5 clrDarkOrchid
#property indicator_width5 1
//
#define cLowLowerBufferIndex 5
double cLowLowerBuffer[];
//
#property indicator_label6 "XCHDON C L L"
#property indicator_type6 DRAW_LINE
#property indicator_color6 clrDarkOrchid
#property indicator_width6 1
//
// Close ...
//
#define cCloseUpperBufferIndex 6
double cCloseUpperBuffer[];
//
#property indicator_label7 "XCHDON C C U"
#property indicator_type7 DRAW_LINE
#property indicator_color7 clrCoral
#property indicator_width7 1
//
#define cCloseLowerBufferIndex 7
double cCloseLowerBuffer[];
//
#property indicator_label8 "XCHDON C C L"
#property indicator_type8 DRAW_LINE
#property indicator_color8 clrCoral
#property indicator_width8 1
//
// Short ...
//
// Open ...
//
#define sOpenUpperBufferIndex 8
double sOpenUpperBuffer[];
//
#property indicator_label9 "XCHDON S O U"
#property indicator_type9 DRAW_LINE
#property indicator_color9 clrCornflowerBlue
#property indicator_width9 1
//
#define sOpenLowerBufferIndex 9
double sOpenLowerBuffer[];
//
#property indicator_label10 "XCHDON S O L"
#property indicator_type10 DRAW_LINE
#property indicator_color10 clrCornflowerBlue
#property indicator_width10 1
//
// High ...
//
#define sHighUpperBufferIndex 10
double sHighUpperBuffer[];
//
#property indicator_label11 "XCHDON S H U"
#property indicator_type11 DRAW_LINE
#property indicator_color11 clrAquamarine
#property indicator_width11 1
//
#define sHighLowerBufferIndex 11
double sHighLowerBuffer[];
//
#property indicator_label12 "XCHDON S H L"
#property indicator_type12 DRAW_LINE
#property indicator_color12 clrAquamarine
#property indicator_width12 1
//
// Low ...
//
#define sLowUpperBufferIndex 12
double sLowUpperBuffer[];
//
#property indicator_label13 "XCHDON S L U"
#property indicator_type13 DRAW_LINE
#property indicator_color13 clrDarkOrchid
#property indicator_width13 1
//
#define sLowLowerBufferIndex 13
double sLowLowerBuffer[];
//
#property indicator_label14 "XCHDON S L L"
#property indicator_type14 DRAW_LINE
#property indicator_color14 clrDarkOrchid
#property indicator_width14 1
//
// Close ...
//
#define sCloseUpperBufferIndex 14
double sCloseUpperBuffer[];
//
#property indicator_label15 "XCHDON S C U"
#property indicator_type15 DRAW_LINE
#property indicator_color15 clrCoral
#property indicator_width15 1
//
#define sCloseLowerBufferIndex 15
double sCloseLowerBuffer[];
//
#property indicator_label16 "XCHDON S C L"
#property indicator_type16 DRAW_LINE
#property indicator_color16 clrCoral
#property indicator_width16 1
//
// Medium ...
//
// Open ...
//
#define mOpenUpperBufferIndex 16
double mOpenUpperBuffer[];
//
#property indicator_label17 "XCHDON M O U"
#property indicator_type17 DRAW_LINE
#property indicator_color17 clrCornflowerBlue
#property indicator_width17 1
//
#define mOpenLowerBufferIndex 17
double mOpenLowerBuffer[];
//
#property indicator_label18 "XCHDON M O L"
#property indicator_type18 DRAW_LINE
#property indicator_color18 clrCornflowerBlue
#property indicator_width18 1
//
// High ...
//
#define mHighUpperBufferIndex 18
double mHighUpperBuffer[];
//
#property indicator_label19 "XCHDON M H U"
#property indicator_type19 DRAW_LINE
#property indicator_color19 clrAquamarine
#property indicator_width19 1
//
#define mHighLowerBufferIndex 19
double mHighLowerBuffer[];
//
#property indicator_label20 "XCHDON M H L"
#property indicator_type20 DRAW_LINE
#property indicator_color20 clrAquamarine
#property indicator_width20 1
//
// Low ...
//
#define mLowUpperBufferIndex 20
double mLowUpperBuffer[];
//
#property indicator_label21 "XCHDON M L U"
#property indicator_type21 DRAW_LINE
#property indicator_color21 clrDarkOrchid
#property indicator_width21 1
//
#define mLowLowerBufferIndex 21
double mLowLowerBuffer[];
//
#property indicator_label22 "XCHDON M L L"
#property indicator_type22 DRAW_LINE
#property indicator_color22 clrDarkOrchid
#property indicator_width22 1
//
// Close ...
//
#define mCloseUpperBufferIndex 22
double mCloseUpperBuffer[];
//
#property indicator_label23 "XCHDON M C U"
#property indicator_type23 DRAW_LINE
#property indicator_color23 clrCoral
#property indicator_width23 1
//
#define mCloseLowerBufferIndex 23
double mCloseLowerBuffer[];
//
#property indicator_label24 "XCHDON M C L"
#property indicator_type24 DRAW_LINE
#property indicator_color24 clrCoral
#property indicator_width24 1
//
// Long ...
//
// Open ...
//
#define lOpenUpperBufferIndex 24
double lOpenUpperBuffer[];
//
#property indicator_label25 "XCHDON L O U"
#property indicator_type25 DRAW_LINE
#property indicator_color25 clrCornflowerBlue
#property indicator_width25 1
//
#define lOpenLowerBufferIndex 25
double lOpenLowerBuffer[];
//
#property indicator_label26 "XCHDON L O L"
#property indicator_type26 DRAW_LINE
#property indicator_color26 clrCornflowerBlue
#property indicator_width26 1
//
// High ...
//
#define lHighUpperBufferIndex 26
double lHighUpperBuffer[];
//
#property indicator_label27 "XCHDON L H U"
#property indicator_type27 DRAW_LINE
#property indicator_color27 clrAquamarine
#property indicator_width27 1
//
#define lHighLowerBufferIndex 27
double lHighLowerBuffer[];
//
#property indicator_label28 "XCHDON L H L"
#property indicator_type28 DRAW_LINE
#property indicator_color28 clrAquamarine
#property indicator_width28 1
//
// Low ...
//
#define lLowUpperBufferIndex 28
double lLowUpperBuffer[];
//
#property indicator_label29 "XCHDON L L U"
#property indicator_type29 DRAW_LINE
#property indicator_color29 clrDarkOrchid
#property indicator_width29 1
//
#define lLowLowerBufferIndex 29
double lLowLowerBuffer[];
//
#property indicator_label30 "XCHDON L L L"
#property indicator_type30 DRAW_LINE
#property indicator_color30 clrDarkOrchid
#property indicator_width30 1
//
// Close ...
//
#define lCloseUpperBufferIndex 30
double lCloseUpperBuffer[];
//
#property indicator_label31 "XCHDON L C U"
#property indicator_type31 DRAW_LINE
#property indicator_color31 clrCoral
#property indicator_width31 1
//
#define lCloseLowerBufferIndex 31
double lCloseLowerBuffer[];
//
#property indicator_label32 "XCHDON L C L"
#property indicator_type32 DRAW_LINE
#property indicator_color32 clrCoral
#property indicator_width32 1
//
// Hind ...
//
// Open ...
//
#define hOpenUpperBufferIndex 32
double hOpenUpperBuffer[];
//
#property indicator_label33 "XCHDON H O U"
#property indicator_type33 DRAW_LINE
#property indicator_color33 clrCornflowerBlue
#property indicator_width33 1
//
#define hOpenLowerBufferIndex 33
double hOpenLowerBuffer[];
//
#property indicator_label34 "XCHDON H O L"
#property indicator_type34 DRAW_LINE
#property indicator_color34 clrCornflowerBlue
#property indicator_width34 1
//
// High ...
//
#define hHighUpperBufferIndex 34
double hHighUpperBuffer[];
//
#property indicator_label35 "XCHDON H H U"
#property indicator_type35 DRAW_LINE
#property indicator_color35 clrAquamarine
#property indicator_width35 1
//
#define hHighLowerBufferIndex 35
double hHighLowerBuffer[];
//
#property indicator_label36 "XCHDON H H L"
#property indicator_type36 DRAW_LINE
#property indicator_color36 clrAquamarine
#property indicator_width36 1
//
// Low ...
//
#define hLowUpperBufferIndex 36
double hLowUpperBuffer[];
//
#property indicator_label37 "XCHDON H L U"
#property indicator_type37 DRAW_LINE
#property indicator_color37 clrDarkOrchid
#property indicator_width37 1
//
#define hLowLowerBufferIndex 37
double hLowLowerBuffer[];
//
#property indicator_label38 "XCHDON H L L"
#property indicator_type38 DRAW_LINE
#property indicator_color38 clrDarkOrchid
#property indicator_width38 1
//
// Close ...
//
#define hCloseUpperBufferIndex 38
double hCloseUpperBuffer[];
//
#property indicator_label39 "XCHDON H C U"
#property indicator_type39 DRAW_LINE
#property indicator_color39 clrCoral
#property indicator_width39 1
//
#define hCloseLowerBufferIndex 39
double hCloseLowerBuffer[];
//
#property indicator_label40 "XCHDON H C L"
#property indicator_type40 DRAW_LINE
#property indicator_color40 clrCoral
#property indicator_width40 1
//
// Variables, Properties and etc ...
//
int maxLength;
//
// Current ...
int mCMarketLength = length;
//
// Short ...
int mSCycleLength = 0;
int mSMarketLength = 0;
ENUM_TIMEFRAMES mSCPeriod = NULL;
//
// Medium ...
int mMCycleLength = 0;
int mMMarketLength = 0;
ENUM_TIMEFRAMES mMCPeriod = NULL;
//
// Long ...
int mLCycleLength = 0;
int mLMarketLength = 0;
ENUM_TIMEFRAMES mLCPeriod = NULL;
//
// Hind ...
int mHCycleLength = 0;
int mHMarketLength = 0;
ENUM_TIMEFRAMES mHCPeriod = NULL;
//
// Event Handlers ...
//
// Initialization ...
int OnInit()
{
//
// Validate Inputs ...
if (!ValidateInputs())
{
return INIT_PARAMETERS_INCORRECT;
}
//
if (!InitMarketCycles())
{
return INIT_PARAMETERS_INCORRECT;
}
//
// because in some cases we may have more than one input for
// calculation and we must prevent any calculation
// untill we pass the biggest input length, here we get max Input length
// and then wait until pass it ...
maxLength = ExtractMaxLengthOfInputs();
//
// Define Index Buffers ...
DefineBuffers();
//
// Set Indicator ShortName ...
SetIndicatorName();
//
// Init Succeed ...
return INIT_SUCCEEDED;
}
//
// DeInitialization ...
void OnDeinit(const int reason)
{
//
// REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function
// REASON_REMOVE 1 Program removed from a chart
// REASON_RECOMPILE 2 Program recompiled
// REASON_CHARTCHANGE 3 A symbol or a chart period is changed
// REASON_CHARTCLOSE 4 Chart closed
// REASON_PARAMETERS 5 Inputs changed by a user
// REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings
// REASON_TEMPLATE 7 Another chart template applied
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
// REASON_CLOSE 9 Terminal closed
}
//
// Calculating what we want ...
int OnCalculate(
const int rates_total, // Total Bars on Chart ...
const int prev_calculated, // Total Calculated Bars on Charts ...
const datetime &time[], // History of Open Time ...
const double &open[], // History of Open Price ...
const double &high[], // History of High Price ...
const double &low[], // History of Low Price ...
const double &close[], // History of Close Price ...
const long &tick_volume[], // History of Tick Volumes on Bar ...
const long &volume[], // History of Trade Volumes ...
const int &spread[] // History of Spread Price ...
)
{
//
if (rates_total < maxLength - 1)
{
return prev_calculated;
}
//
int start = prev_calculated == 0
? maxLength
: prev_calculated - 1;
//
// Main Loop ...
for (int i = start; i < rates_total; i++)
{
//
CalculateBuffers(
//
i,
prev_calculated,
rates_total,
//
open,
high,
close,
low,
tick_volume
//
);
}
//
return rates_total;
}
//
// Functions ...
//
// Validate Input Args for Initialization ...
bool ValidateInputs()
{
//
bool result = false;
//
result =
//
length > 2
//
&&
//
(IsValid(scMethod, scPeriod) &&
IsValid(mcMethod, mcPeriod) &&
IsValid(lcMethod, lcPeriod) &&
IsValid(hcMethod, hcPeriod))
//
;
//
return result;
}
//
// Initialize Market Cycles ...
bool InitMarketCycles()
{
//
bool result = false;
//
// Current Cycle Initialization ...
//
int cPeriodSeconds = PeriodSeconds(_Period);
//
// Short Cycle Initialization ...
//
// Find Cycle Period ...
if (scMethod == X_PERIOD_AUTO)
{
//
// Select Period ...
mSCPeriod = GetCyclePeriod(
X_MARKET_CYCLE_SHORT,
_Period //
);
}
else
{
mSCPeriod = scPeriod;
}
//
result = IsValid(mSCPeriod);
if (!result)
{
return result;
}
//
mSCycleLength = PeriodSeconds(mSCPeriod) / cPeriodSeconds;
mSMarketLength = mSCycleLength * mCMarketLength;
result = mSCycleLength > 0;
if (!result)
{
return result;
}
//
// Medium Cycle Initialization ...
//
// Find Cycle Period ...
if (mcMethod == X_PERIOD_AUTO)
{
//
// Select Period ...
mMCPeriod = GetCyclePeriod(
X_MARKET_CYCLE_MEDIUM,
_Period //
);
}
else
{
mMCPeriod = mcPeriod;
}
//
result = IsValid(mMCPeriod);
if (!result)
{
return result;
}
//
mMCycleLength = PeriodSeconds(mMCPeriod) / cPeriodSeconds;
mMMarketLength = mMCycleLength * mCMarketLength;
result = mMCycleLength > 0;
if (!result)
{
return result;
}
//
// Long Cycle Initialization ...
//
// Find Cycle Period ...
if (lcMethod == X_PERIOD_AUTO)
{
//
// Select Period ...
mLCPeriod = GetCyclePeriod(
X_MARKET_CYCLE_LONG,
_Period //
);
}
else
{
mLCPeriod = lcPeriod;
}
//
result = IsValid(mLCPeriod);
if (!result)
{
return result;
}
//
mLCycleLength = PeriodSeconds(mLCPeriod) / cPeriodSeconds;
mLMarketLength = mLCycleLength * mCMarketLength;
result = mLCycleLength > 0;
if (!result)
{
return result;
}
//
// Hind Cycle Initialization ...
//
// Find Cycle Period ...
if (hcMethod == X_PERIOD_AUTO)
{
//
// Select Period ...
mHCPeriod = GetCyclePeriod(
X_MARKET_CYCLE_HIND,
_Period //
);
}
else
{
mHCPeriod = hcPeriod;
}
//
result = IsValid(mHCPeriod);
if (!result)
{
return result;
}
//
mHCycleLength = PeriodSeconds(mHCPeriod) / cPeriodSeconds;
mHMarketLength = mHCycleLength * mCMarketLength;
result = mHCycleLength > 0;
if (!result)
{
return result;
}
//
return result;
}
//
// Retrieve all Exists Input Max Length ...
// use for Start Of Drawing ...
int ExtractMaxLengthOfInputs()
{
//
int result = 0;
//
// Current ...
result = MathMax(mCMarketLength, mSMarketLength);
result = MathMax(result, mMMarketLength);
result = MathMax(result, mLMarketLength);
result = MathMax(result, mHMarketLength);
//
return result;
}
//
// Set Indicator Short Name and also we can define Buffers Labels ...
void SetIndicatorName()
{
//
IndicatorSetString(INDICATOR_SHORTNAME, ShortName);
IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
}
//
// Define Indexes and Styles ...
void DefineBuffers()
{
//
// CURRENT ...
//
// Open ...
//
// UPPER ...
bool canShowCOpenUpper = showUpper && showOpen && showCurrent;
ENUM_DRAW_TYPE cOpenUpperDrawType = canShowCOpenUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(cOpenUpperBufferIndex, cOpenUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(cOpenUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(cOpenUpperBufferIndex, PLOT_SHOW_DATA, canShowCOpenUpper);
PlotIndexSetInteger(cOpenUpperBufferIndex, PLOT_DRAW_TYPE, cOpenUpperDrawType);
//
// LOWER ...
bool canShowCOpenLower = showLower && showOpen && showCurrent;
ENUM_DRAW_TYPE cOpenLowerDrawType = canShowCOpenLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(cOpenLowerBufferIndex, cOpenLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(cOpenLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(cOpenLowerBufferIndex, PLOT_SHOW_DATA, canShowCOpenLower);
PlotIndexSetInteger(cOpenLowerBufferIndex, PLOT_DRAW_TYPE, cOpenLowerDrawType);
//
// Close ...
//
// UPPER ...
bool canShowCCloseUpper = showUpper && showClose && showCurrent;
ENUM_DRAW_TYPE cCloseUpperDrawType = canShowCCloseUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(cCloseUpperBufferIndex, cCloseUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(cCloseUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(cCloseUpperBufferIndex, PLOT_SHOW_DATA, canShowCCloseUpper);
PlotIndexSetInteger(cCloseUpperBufferIndex, PLOT_DRAW_TYPE, cCloseUpperDrawType);
//
// LOWER ...
bool canShowCCloseLower = showLower && showClose && showCurrent;
ENUM_DRAW_TYPE cCloseLowerDrawType = canShowCCloseLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(cCloseLowerBufferIndex, cCloseLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(cCloseLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(cCloseLowerBufferIndex, PLOT_SHOW_DATA, canShowCCloseLower);
PlotIndexSetInteger(cCloseLowerBufferIndex, PLOT_DRAW_TYPE, cCloseLowerDrawType);
//
// High ...
//
// UPPER ...
bool canShowCHighUpper = showUpper && showHigh && showCurrent;
ENUM_DRAW_TYPE cHighUpperDrawType = canShowCHighUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(cHighUpperBufferIndex, cHighUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(cHighUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(cHighUpperBufferIndex, PLOT_SHOW_DATA, canShowCHighUpper);
PlotIndexSetInteger(cHighUpperBufferIndex, PLOT_DRAW_TYPE, cHighUpperDrawType);
//
// LOWER ...
bool canShowCHighLower = showLower && showHigh && showCurrent;
ENUM_DRAW_TYPE cHighLowerDrawType = canShowCHighLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(cHighLowerBufferIndex, cHighLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(cHighLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(cHighLowerBufferIndex, PLOT_SHOW_DATA, canShowCHighLower);
PlotIndexSetInteger(cHighLowerBufferIndex, PLOT_DRAW_TYPE, cHighLowerDrawType);
//
// Low ...
//
// UPPER ...
bool canShowCLowUpper = showUpper && showLow && showCurrent;
ENUM_DRAW_TYPE cLowUpperDrawType = canShowCLowUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(cLowUpperBufferIndex, cLowUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(cLowUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(cLowUpperBufferIndex, PLOT_SHOW_DATA, canShowCLowUpper);
PlotIndexSetInteger(cLowUpperBufferIndex, PLOT_DRAW_TYPE, cLowUpperDrawType);
//
// LOWER ...
bool canShowCLowLower = showLower && showLow && showCurrent;
ENUM_DRAW_TYPE cLowLowerDrawType = canShowCLowLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(cLowLowerBufferIndex, cLowLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(cLowLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(cLowLowerBufferIndex, PLOT_SHOW_DATA, canShowCLowLower);
PlotIndexSetInteger(cLowLowerBufferIndex, PLOT_DRAW_TYPE, cLowLowerDrawType);
//
// SHORT ...
//
// Open ...
//
// UPPER ...
bool canShowSOpenUpper = showUpper && showOpen && showShort;
ENUM_DRAW_TYPE sOpenUpperDrawType = canShowSOpenUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(sOpenUpperBufferIndex, sOpenUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(sOpenUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(sOpenUpperBufferIndex, PLOT_SHOW_DATA, canShowSOpenUpper);
PlotIndexSetInteger(sOpenUpperBufferIndex, PLOT_DRAW_TYPE, sOpenUpperDrawType);
//
// LOWER ...
bool canShowSOpenLower = showLower && showOpen && showShort;
ENUM_DRAW_TYPE sOpenLowerDrawType = canShowSOpenLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(sOpenLowerBufferIndex, sOpenLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(sOpenLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(sOpenLowerBufferIndex, PLOT_SHOW_DATA, canShowSOpenLower);
PlotIndexSetInteger(sOpenLowerBufferIndex, PLOT_DRAW_TYPE, sOpenLowerDrawType);
//
// Close ...
//
// UPPER ...
bool canShowSCloseUpper = showUpper && showClose && showShort;
ENUM_DRAW_TYPE sCloseUpperDrawType = canShowSCloseUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(sCloseUpperBufferIndex, sCloseUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(sCloseUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(sCloseUpperBufferIndex, PLOT_SHOW_DATA, canShowSCloseUpper);
PlotIndexSetInteger(sCloseUpperBufferIndex, PLOT_DRAW_TYPE, sCloseUpperDrawType);
//
// LOWER ...
bool canShowSCloseLower = showLower && showClose && showShort;
ENUM_DRAW_TYPE sCloseLowerDrawType = canShowSCloseLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(sCloseLowerBufferIndex, sCloseLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(sCloseLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(sCloseLowerBufferIndex, PLOT_SHOW_DATA, canShowSCloseLower);
PlotIndexSetInteger(sCloseLowerBufferIndex, PLOT_DRAW_TYPE, sCloseLowerDrawType);
//
// High ...
//
// UPPER ...
bool canShowSHighUpper = showUpper && showHigh && showShort;
ENUM_DRAW_TYPE sHighUpperDrawType = canShowSHighUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(sHighUpperBufferIndex, sHighUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(sHighUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(sHighUpperBufferIndex, PLOT_SHOW_DATA, canShowSHighUpper);
PlotIndexSetInteger(sHighUpperBufferIndex, PLOT_DRAW_TYPE, sHighUpperDrawType);
//
// LOWER ...
bool canShowSHighLower = showLower && showHigh && showShort;
ENUM_DRAW_TYPE sHighLowerDrawType = canShowSHighLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(sHighLowerBufferIndex, sHighLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(sHighLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(sHighLowerBufferIndex, PLOT_SHOW_DATA, canShowSHighLower);
PlotIndexSetInteger(sHighLowerBufferIndex, PLOT_DRAW_TYPE, sHighLowerDrawType);
//
// Low ...
//
// UPPER ...
bool canShowSLowUpper = showUpper && showLow && showShort;
ENUM_DRAW_TYPE sLowUpperDrawType = canShowSLowUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(sLowUpperBufferIndex, sLowUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(sLowUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(sLowUpperBufferIndex, PLOT_SHOW_DATA, canShowSLowUpper);
PlotIndexSetInteger(sLowUpperBufferIndex, PLOT_DRAW_TYPE, sLowUpperDrawType);
//
// LOWER ...
bool canShowSLowLower = showLower && showLow && showShort;
ENUM_DRAW_TYPE sLowLowerDrawType = canShowSLowLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(sLowLowerBufferIndex, sLowLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(sLowLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(sLowLowerBufferIndex, PLOT_SHOW_DATA, canShowSLowLower);
PlotIndexSetInteger(sLowLowerBufferIndex, PLOT_DRAW_TYPE, sLowLowerDrawType);
//
// MEDIUM ...
//
// Open ...
//
// UPPER ...
bool canShowMOpenUpper = showUpper && showOpen && showMedium;
ENUM_DRAW_TYPE mOpenUpperDrawType = canShowMOpenUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(mOpenUpperBufferIndex, mOpenUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(mOpenUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(mOpenUpperBufferIndex, PLOT_SHOW_DATA, canShowMOpenUpper);
PlotIndexSetInteger(mOpenUpperBufferIndex, PLOT_DRAW_TYPE, mOpenUpperDrawType);
//
// LOWER ...
bool canShowMOpenLower = showLower && showOpen && showMedium;
ENUM_DRAW_TYPE mOpenLowerDrawType = canShowMOpenLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(mOpenLowerBufferIndex, mOpenLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(mOpenLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(mOpenLowerBufferIndex, PLOT_SHOW_DATA, canShowMOpenLower);
PlotIndexSetInteger(mOpenLowerBufferIndex, PLOT_DRAW_TYPE, mOpenLowerDrawType);
//
// Close ...
//
// UPPER ...
bool canShowMCloseUpper = showUpper && showClose && showMedium;
ENUM_DRAW_TYPE mCloseUpperDrawType = canShowMCloseUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(mCloseUpperBufferIndex, mCloseUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(mCloseUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(mCloseUpperBufferIndex, PLOT_SHOW_DATA, canShowMCloseUpper);
PlotIndexSetInteger(mCloseUpperBufferIndex, PLOT_DRAW_TYPE, mCloseUpperDrawType);
//
// LOWER ...
bool canShowMCloseLower = showLower && showClose && showMedium;
ENUM_DRAW_TYPE mCloseLowerDrawType = canShowMCloseLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(mCloseLowerBufferIndex, mCloseLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(mCloseLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(mCloseLowerBufferIndex, PLOT_SHOW_DATA, canShowMCloseLower);
PlotIndexSetInteger(mCloseLowerBufferIndex, PLOT_DRAW_TYPE, mCloseLowerDrawType);
//
// High ...
//
// UPPER ...
bool canShowMHighUpper = showUpper && showHigh && showMedium;
ENUM_DRAW_TYPE mHighUpperDrawType = canShowMHighUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(mHighUpperBufferIndex, mHighUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(mHighUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(mHighUpperBufferIndex, PLOT_SHOW_DATA, canShowMHighUpper);
PlotIndexSetInteger(mHighUpperBufferIndex, PLOT_DRAW_TYPE, mHighUpperDrawType);
//
// LOWER ...
bool canShowMHighLower = showLower && showHigh && showMedium;
ENUM_DRAW_TYPE mHighLowerDrawType = canShowMHighLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(mHighLowerBufferIndex, mHighLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(mHighLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(mHighLowerBufferIndex, PLOT_SHOW_DATA, canShowMHighLower);
PlotIndexSetInteger(mHighLowerBufferIndex, PLOT_DRAW_TYPE, mHighLowerDrawType);
//
// Low ...
//
// UPPER ...
bool canShowMLowUpper = showUpper && showLow && showMedium;
ENUM_DRAW_TYPE mLowUpperDrawType = canShowMLowUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(mLowUpperBufferIndex, mLowUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(mLowUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(mLowUpperBufferIndex, PLOT_SHOW_DATA, canShowMLowUpper);
PlotIndexSetInteger(mLowUpperBufferIndex, PLOT_DRAW_TYPE, mLowUpperDrawType);
//
// LOWER ...
bool canShowMLowLower = showLower && showLow && showMedium;
ENUM_DRAW_TYPE mLowLowerDrawType = canShowMLowLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(mLowLowerBufferIndex, mLowLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(mLowLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(mLowLowerBufferIndex, PLOT_SHOW_DATA, canShowMLowLower);
PlotIndexSetInteger(mLowLowerBufferIndex, PLOT_DRAW_TYPE, mLowLowerDrawType);
//
// LONG ...
//
// Open ...
//
// UPPER ...
bool canShowLOpenUpper = showUpper && showOpen && showLong;
ENUM_DRAW_TYPE lOpenUpperDrawType = canShowLOpenUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(lOpenUpperBufferIndex, lOpenUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(lOpenUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(lOpenUpperBufferIndex, PLOT_SHOW_DATA, canShowLOpenUpper);
PlotIndexSetInteger(lOpenUpperBufferIndex, PLOT_DRAW_TYPE, lOpenUpperDrawType);
//
// LOWER ...
bool canShowLOpenLower = showLower && showOpen && showLong;
ENUM_DRAW_TYPE lOpenLowerDrawType = canShowLOpenLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(lOpenLowerBufferIndex, lOpenLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(lOpenLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(lOpenLowerBufferIndex, PLOT_SHOW_DATA, canShowLOpenLower);
PlotIndexSetInteger(lOpenLowerBufferIndex, PLOT_DRAW_TYPE, lOpenLowerDrawType);
//
// Close ...
//
// UPPER ...
bool canShowLCloseUpper = showUpper && showClose && showLong;
ENUM_DRAW_TYPE lCloseUpperDrawType = canShowLCloseUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(lCloseUpperBufferIndex, lCloseUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(lCloseUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(lCloseUpperBufferIndex, PLOT_SHOW_DATA, canShowLCloseUpper);
PlotIndexSetInteger(lCloseUpperBufferIndex, PLOT_DRAW_TYPE, lCloseUpperDrawType);
//
// LOWER ...
bool canShowLCloseLower = showLower && showClose && showLong;
ENUM_DRAW_TYPE lCloseLowerDrawType = canShowLCloseLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(lCloseLowerBufferIndex, lCloseLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(lCloseLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(lCloseLowerBufferIndex, PLOT_SHOW_DATA, canShowLCloseLower);
PlotIndexSetInteger(lCloseLowerBufferIndex, PLOT_DRAW_TYPE, lCloseLowerDrawType);
//
// High ...
//
// UPPER ...
bool canShowLHighUpper = showUpper && showHigh && showLong;
ENUM_DRAW_TYPE lHighUpperDrawType = canShowLHighUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(lHighUpperBufferIndex, lHighUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(lHighUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(lHighUpperBufferIndex, PLOT_SHOW_DATA, canShowLHighUpper);
PlotIndexSetInteger(lHighUpperBufferIndex, PLOT_DRAW_TYPE, lHighUpperDrawType);
//
// LOWER ...
bool canShowLHighLower = showLower && showHigh && showLong;
ENUM_DRAW_TYPE lHighLowerDrawType = canShowLHighLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(lHighLowerBufferIndex, lHighLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(lHighLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(lHighLowerBufferIndex, PLOT_SHOW_DATA, canShowLHighLower);
PlotIndexSetInteger(lHighLowerBufferIndex, PLOT_DRAW_TYPE, lHighLowerDrawType);
//
// Low ...
//
// UPPER ...
bool canShowLLowUpper = showUpper && showLow && showLong;
ENUM_DRAW_TYPE lLowUpperDrawType = canShowLLowUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(lLowUpperBufferIndex, lLowUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(lLowUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(lLowUpperBufferIndex, PLOT_SHOW_DATA, canShowLLowUpper);
PlotIndexSetInteger(lLowUpperBufferIndex, PLOT_DRAW_TYPE, lLowUpperDrawType);
//
// LOWER ...
bool canShowLLowLower = showLower && showLow && showLong;
ENUM_DRAW_TYPE lLowLowerDrawType = canShowLLowLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(lLowLowerBufferIndex, lLowLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(lLowLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(lLowLowerBufferIndex, PLOT_SHOW_DATA, canShowLLowLower);
PlotIndexSetInteger(lLowLowerBufferIndex, PLOT_DRAW_TYPE, lLowLowerDrawType);
//
// HIND ...
//
// Open ...
//
// UPPER ...
bool canShowHOpenUpper = showUpper && showOpen && showHind;
ENUM_DRAW_TYPE hOpenUpperDrawType = canShowHOpenUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(hOpenUpperBufferIndex, hOpenUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(hOpenUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(hOpenUpperBufferIndex, PLOT_SHOW_DATA, canShowHOpenUpper);
PlotIndexSetInteger(hOpenUpperBufferIndex, PLOT_DRAW_TYPE, hOpenUpperDrawType);
//
// LOWER ...
bool canShowHOpenLower = showLower && showOpen && showHind;
ENUM_DRAW_TYPE hOpenLowerDrawType = canShowHOpenLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(hOpenLowerBufferIndex, hOpenLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(hOpenLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(hOpenLowerBufferIndex, PLOT_SHOW_DATA, canShowHOpenLower);
PlotIndexSetInteger(hOpenLowerBufferIndex, PLOT_DRAW_TYPE, hOpenLowerDrawType);
//
// Close ...
//
// UPPER ...
bool canShowHCloseUpper = showUpper && showClose && showHind;
ENUM_DRAW_TYPE hCloseUpperDrawType = canShowHCloseUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(hCloseUpperBufferIndex, hCloseUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(hCloseUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(hCloseUpperBufferIndex, PLOT_SHOW_DATA, canShowHCloseUpper);
PlotIndexSetInteger(hCloseUpperBufferIndex, PLOT_DRAW_TYPE, hCloseUpperDrawType);
//
// LOWER ...
bool canShowHCloseLower = showLower && showClose && showHind;
ENUM_DRAW_TYPE hCloseLowerDrawType = canShowHCloseLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(hCloseLowerBufferIndex, hCloseLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(hCloseLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(hCloseLowerBufferIndex, PLOT_SHOW_DATA, canShowHCloseLower);
PlotIndexSetInteger(hCloseLowerBufferIndex, PLOT_DRAW_TYPE, hCloseLowerDrawType);
//
// High ...
//
// UPPER ...
bool canShowHHighUpper = showUpper && showHigh && showHind;
ENUM_DRAW_TYPE hHighUpperDrawType = canShowHHighUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(hHighUpperBufferIndex, hHighUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(hHighUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(hHighUpperBufferIndex, PLOT_SHOW_DATA, canShowHHighUpper);
PlotIndexSetInteger(hHighUpperBufferIndex, PLOT_DRAW_TYPE, hHighUpperDrawType);
//
// LOWER ...
bool canShowHHighLower = showLower && showHigh && showHind;
ENUM_DRAW_TYPE hHighLowerDrawType = canShowHHighLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(hHighLowerBufferIndex, hHighLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(hHighLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(hHighLowerBufferIndex, PLOT_SHOW_DATA, canShowHHighLower);
PlotIndexSetInteger(hHighLowerBufferIndex, PLOT_DRAW_TYPE, hHighLowerDrawType);
//
// Low ...
//
// UPPER ...
bool canShowHLowUpper = showUpper && showLow && showHind;
ENUM_DRAW_TYPE hLowUpperDrawType = canShowHLowUpper ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(hLowUpperBufferIndex, hLowUpperBuffer, INDICATOR_DATA);
PlotIndexSetDouble(hLowUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(hLowUpperBufferIndex, PLOT_SHOW_DATA, canShowHLowUpper);
PlotIndexSetInteger(hLowUpperBufferIndex, PLOT_DRAW_TYPE, hLowUpperDrawType);
//
// LOWER ...
bool canShowHLowLower = showLower && showLow && showHind;
ENUM_DRAW_TYPE hLowLowerDrawType = canShowHLowLower ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(hLowLowerBufferIndex, hLowLowerBuffer, INDICATOR_DATA);
PlotIndexSetDouble(hLowLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(hLowLowerBufferIndex, PLOT_SHOW_DATA, canShowHLowLower);
PlotIndexSetInteger(hLowLowerBufferIndex, PLOT_DRAW_TYPE, hLowLowerDrawType);
}
//
// Calculations ...
//
// Calculate Buffers ...
void CalculateBuffers(
int bar_index, // Selected Bar Index
const int prevCalculated,
const int ratesTotal,
const double &open[],
const double &high[],
const double &close[],
const double &low[],
const long &tickVolume[] //
)
{
//
CalculateCycles(
bar_index,
prevCalculated,
ratesTotal,
open,
high,
close,
low,
tickVolume //
);
}
//
void CalculateCycles(
int bar_index, // Selected Bar Index
const int prevCalculated,
const int ratesTotal,
const double &open[],
const double &high[],
const double &close[],
const double &low[],
const long &tickVolume[] //
)
{
//
// CURRENT ...
CalculateCycle(
//
bar_index,
prevCalculated,
ratesTotal,
//
open,
high,
close,
low,
tickVolume,
//
mCMarketLength,
//
cOpenUpperBuffer,
cOpenLowerBuffer,
cHighUpperBuffer,
cHighLowerBuffer,
cLowUpperBuffer,
cLowLowerBuffer,
cCloseUpperBuffer,
cCloseLowerBuffer //
);
//
// SHORT ...
CalculateCycle(
//
bar_index,
prevCalculated,
ratesTotal,
//
open,
high,
close,
low,
tickVolume,
//
mSMarketLength,
//
sOpenUpperBuffer,
sOpenLowerBuffer,
sHighUpperBuffer,
sHighLowerBuffer,
sLowUpperBuffer,
sLowLowerBuffer,
sCloseUpperBuffer,
sCloseLowerBuffer //
);
//
// MEDIUM ...
CalculateCycle(
//
bar_index,
prevCalculated,
ratesTotal,
//
open,
high,
close,
low,
tickVolume,
//
mMMarketLength,
//
mOpenUpperBuffer,
mOpenLowerBuffer,
mHighUpperBuffer,
mHighLowerBuffer,
mLowUpperBuffer,
mLowLowerBuffer,
mCloseUpperBuffer,
mCloseLowerBuffer //
);
//
// LONG ...
CalculateCycle(
//
bar_index,
prevCalculated,
ratesTotal,
//
open,
high,
close,
low,
tickVolume,
//
mLMarketLength,
//
lOpenUpperBuffer,
lOpenLowerBuffer,
lHighUpperBuffer,
lHighLowerBuffer,
lLowUpperBuffer,
lLowLowerBuffer,
lCloseUpperBuffer,
lCloseLowerBuffer //
);
//
// HIND ...
CalculateCycle(
//
bar_index,
prevCalculated,
ratesTotal,
//
open,
high,
close,
low,
tickVolume,
//
mHMarketLength,
//
hOpenUpperBuffer,
hOpenLowerBuffer,
hHighUpperBuffer,
hHighLowerBuffer,
hLowUpperBuffer,
hLowLowerBuffer,
hCloseUpperBuffer,
hCloseLowerBuffer //
);
}
//
void CalculateCycle(
int bar_index, // Selected Bar Index
const int prevCalculated,
const int ratesTotal,
//
const double &open[],
const double &high[],
const double &close[],
const double &low[],
const long &tickVolume[],
//
int _length,
//
double &_ouBuffer[],
double &_olBuffer[],
double &_huBuffer[],
double &_hlBuffer[],
double &_luBuffer[],
double &_llBuffer[],
double &_cuBuffer[],
double &_clBuffer[] //
)
{
//
double iUpper = 0;
double iLower = 0;
//
// OPEN ...
//
iUpper = open[ArrayMaximum(open, bar_index - _length + 1, _length)];
iLower = open[ArrayMinimum(open, bar_index - _length + 1, _length)];
//
_ouBuffer[bar_index] = iUpper;
_olBuffer[bar_index] = iLower;
//
// HIGH ...
//
iUpper = high[ArrayMaximum(high, bar_index - _length + 1, _length)];
iLower = high[ArrayMinimum(high, bar_index - _length + 1, _length)];
//
_huBuffer[bar_index] = iUpper;
_hlBuffer[bar_index] = iLower;
//
// LOW ...
//
iUpper = low[ArrayMaximum(low, bar_index - _length + 1, _length)];
iLower = low[ArrayMinimum(low, bar_index - _length + 1, _length)];
//
_luBuffer[bar_index] = iUpper;
_llBuffer[bar_index] = iLower;
//
// CLOSE ...
//
iUpper = close[ArrayMaximum(close, bar_index - _length + 1, _length)];
iLower = close[ArrayMinimum(close, bar_index - _length + 1, _length)];
//
_cuBuffer[bar_index] = iUpper;
_clBuffer[bar_index] = iLower;
}
//