2280 lines
47 KiB
Plaintext
2280 lines
47 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Indicator
|
|
// -------------------------------------------------
|
|
// Name: X121 XMA
|
|
// Description: Integrates All Requirements inside
|
|
// this indicator for analyse Markets ...
|
|
//
|
|
//
|
|
// 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 X121 XMA Indicator"
|
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
|
#property strict
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
#define ShortName "X121 XMA"
|
|
|
|
//
|
|
// Imports ...
|
|
#include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
|
#include "../Libraries/x-saherelm.common.lib.mq5"
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
input group "Cycles";
|
|
|
|
//
|
|
// Short ...
|
|
input ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Short Period
|
|
input ENUM_TIMEFRAMES scPeriod = NULL; // Short Period
|
|
|
|
//
|
|
// Medium ...
|
|
input ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // How to Find Medium Period
|
|
input ENUM_TIMEFRAMES mcPeriod = NULL; // Medium Period
|
|
|
|
//
|
|
// Long ...
|
|
input ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // How to Find Long Period
|
|
input ENUM_TIMEFRAMES lcPeriod = NULL; // Long Period
|
|
|
|
//
|
|
// Hind ...
|
|
input ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Hind Period
|
|
input ENUM_TIMEFRAMES hcPeriod = NULL; // Hind Period
|
|
|
|
//
|
|
input group "Calculation";
|
|
input ENUM_SERIESMODE upperMode = MODE_HIGH; // Cycles Rnage Upper Method
|
|
input ENUM_SERIESMODE lowerMode = MODE_LOW; // Cycles Rnage Lower Method
|
|
input ENUM_MA_METHOD maMethod = MODE_SMA; // Cycles MA Method
|
|
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // Cycles MA Applied To
|
|
input int maLength = 20; // Cycles MA Length
|
|
|
|
//
|
|
// Presentation ...
|
|
input group "Presentation";
|
|
input bool showBars = true; // Show Bars
|
|
input bool showShortCycle = false; // Show Short Cycle Range
|
|
input bool showMediumCycle = false; // Show Medium Cycle Range
|
|
input bool showLongCycle = false; // Show Long Cycle Range
|
|
input bool showHindCycle = false; // Show Hind Cycle Range
|
|
input bool showShortCycleMa = false; // Show Short Cycle Ma
|
|
input bool showMediumCycleMa = false; // Show Medium Cycle Ma
|
|
input bool showLongCycleMa = false; // Show Long Cycle Ma
|
|
input bool showHindCycleMa = false; // Show Hind Cycle Ma
|
|
|
|
//
|
|
input int startCalculationForLastBars = 1500; // Calculate Last n Bars
|
|
|
|
//
|
|
// Non Inputs ...
|
|
|
|
//
|
|
#define hideColorIDX 0
|
|
#define bullishColorIDX 1
|
|
#define bearishColorIDX 2
|
|
#define neuturalColorIDX 3
|
|
|
|
//
|
|
#define bullishState 1
|
|
#define neuturalState 0
|
|
#define bearishState -1
|
|
|
|
//
|
|
#define emptyValue 0.0
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
#property indicator_chart_window
|
|
|
|
//
|
|
#property indicator_buffers 20
|
|
#property indicator_plots 12
|
|
|
|
//
|
|
// Plot Buffers ...
|
|
|
|
//
|
|
// SC ...
|
|
|
|
//
|
|
#define scMaBufferIndex 0
|
|
#define scMaBufferPlotIndex 0
|
|
double scMaBuffer[];
|
|
|
|
//
|
|
#define scMaColorBufferIndex 1
|
|
double scMaColorBuffer[];
|
|
|
|
//
|
|
#property indicator_label1 "SCMA"
|
|
#property indicator_type1 DRAW_COLOR_LINE
|
|
#property indicator_color1 CLR_NONE, clrGreen, clrRed, clrGray
|
|
#property indicator_style1 STYLE_DASHDOTDOT
|
|
#property indicator_width1 2
|
|
|
|
//
|
|
// MC ...
|
|
|
|
//
|
|
#define mcMaBufferIndex 2
|
|
#define mcMaBufferPlotIndex 1
|
|
double mcMaBuffer[];
|
|
|
|
//
|
|
#define mcMaColorBufferIndex 3
|
|
double mcMaColorBuffer[];
|
|
|
|
//
|
|
#property indicator_label2 "MCMA"
|
|
#property indicator_type2 DRAW_COLOR_LINE
|
|
#property indicator_color2 CLR_NONE, clrGreen, clrRed, clrGray
|
|
#property indicator_style2 STYLE_DASHDOTDOT
|
|
#property indicator_width2 2
|
|
|
|
//
|
|
// LC ...
|
|
|
|
//
|
|
#define lcMaBufferIndex 4
|
|
#define lcMaBufferPlotIndex 2
|
|
double lcMaBuffer[];
|
|
|
|
//
|
|
#define lcMaColorBufferIndex 5
|
|
double lcMaColorBuffer[];
|
|
|
|
//
|
|
#property indicator_label3 "LCMA"
|
|
#property indicator_type3 DRAW_COLOR_LINE
|
|
#property indicator_color3 CLR_NONE, clrGreen, clrRed, clrGray
|
|
#property indicator_style3 STYLE_DASHDOTDOT
|
|
#property indicator_width3 2
|
|
|
|
//
|
|
// HC ...
|
|
|
|
//
|
|
#define hcMaBufferIndex 6
|
|
#define hcMaBufferPlotIndex 3
|
|
double hcMaBuffer[];
|
|
|
|
//
|
|
#define hcMaColorBufferIndex 7
|
|
double hcMaColorBuffer[];
|
|
|
|
//
|
|
#property indicator_label4 "HCMA"
|
|
#property indicator_type4 DRAW_COLOR_LINE
|
|
#property indicator_color4 CLR_NONE, clrGreen, clrRed, clrGray
|
|
#property indicator_style4 STYLE_DASHDOTDOT
|
|
#property indicator_width4 2
|
|
|
|
//
|
|
// CYCLES Range ...
|
|
|
|
//
|
|
// SHORT ...
|
|
|
|
//
|
|
#define sHHBufferIndex 8
|
|
#define sHHBufferPlotIndex 4
|
|
double sHHBuffer[];
|
|
|
|
//
|
|
#property indicator_label5 "SH"
|
|
#property indicator_type5 DRAW_LINE
|
|
#property indicator_color5 clrGray
|
|
#property indicator_style5 STYLE_DOT
|
|
#property indicator_width5 1
|
|
|
|
//
|
|
#define sLLBufferIndex 9
|
|
#define sLLBufferPlotIndex 5
|
|
double sLLBuffer[];
|
|
|
|
//
|
|
#property indicator_label6 "SL"
|
|
#property indicator_type6 DRAW_LINE
|
|
#property indicator_color6 clrGray
|
|
#property indicator_style6 STYLE_DOT
|
|
#property indicator_width6 1
|
|
|
|
//
|
|
// MEDIUM ...
|
|
|
|
//
|
|
#define mHHBufferIndex 10
|
|
#define mHHBufferPlotIndex 6
|
|
double mHHBuffer[];
|
|
|
|
//
|
|
#property indicator_label7 "MH"
|
|
#property indicator_type7 DRAW_LINE
|
|
#property indicator_color7 clrIndigo
|
|
#property indicator_style7 STYLE_DOT
|
|
#property indicator_width7 1
|
|
|
|
//
|
|
#define mLLBufferIndex 11
|
|
#define mLLBufferPlotIndex 7
|
|
double mLLBuffer[];
|
|
|
|
//
|
|
#property indicator_label8 "ML"
|
|
#property indicator_type8 DRAW_LINE
|
|
#property indicator_color8 clrIndigo
|
|
#property indicator_style8 STYLE_DOT
|
|
#property indicator_width8 1
|
|
|
|
//
|
|
// LONG ...
|
|
|
|
//
|
|
#define lHHBufferIndex 12
|
|
#define lHHBufferPlotIndex 8
|
|
double lHHBuffer[];
|
|
|
|
//
|
|
#property indicator_label9 "LH"
|
|
#property indicator_type9 DRAW_LINE
|
|
#property indicator_color9 clrGoldenrod
|
|
#property indicator_style9 STYLE_DOT
|
|
#property indicator_width9 1
|
|
|
|
//
|
|
#define lLLBufferIndex 13
|
|
#define lLLBufferPlotIndex 9
|
|
double lLLBuffer[];
|
|
|
|
//
|
|
#property indicator_label10 "LL"
|
|
#property indicator_type10 DRAW_LINE
|
|
#property indicator_color10 clrGoldenrod
|
|
#property indicator_style10 STYLE_DOT
|
|
#property indicator_width10 1
|
|
|
|
//
|
|
// HIND ...
|
|
|
|
//
|
|
#define hHHBufferIndex 14
|
|
#define hHHBufferPlotIndex 10
|
|
double hHHBuffer[];
|
|
|
|
//
|
|
#property indicator_label11 "HH"
|
|
#property indicator_type11 DRAW_LINE
|
|
#property indicator_color11 clrBrown
|
|
#property indicator_style11 STYLE_DOT
|
|
#property indicator_width11 1
|
|
|
|
//
|
|
#define hLLBufferIndex 15
|
|
#define hLLBufferPlotIndex 11
|
|
double hLLBuffer[];
|
|
|
|
//
|
|
#property indicator_label12 "HL"
|
|
#property indicator_type12 DRAW_LINE
|
|
#property indicator_color12 clrBrown
|
|
#property indicator_style12 STYLE_DOT
|
|
#property indicator_width12 1
|
|
|
|
//
|
|
// Data Buffers ...
|
|
|
|
//
|
|
#define mLastBufferIndex 15
|
|
|
|
//
|
|
#define scMaStateBufferIndex mLastBufferIndex + 1
|
|
double scMaStateBuffer[];
|
|
|
|
//
|
|
#define mcMaStateBufferIndex mLastBufferIndex + 2
|
|
double mcMaStateBuffer[];
|
|
|
|
//
|
|
#define lcMaStateBufferIndex mLastBufferIndex + 3
|
|
double lcMaStateBuffer[];
|
|
|
|
//
|
|
#define hcMaStateBufferIndex mLastBufferIndex + 4
|
|
double hcMaStateBuffer[];
|
|
|
|
//
|
|
// Variables, Properties and etc ...
|
|
|
|
//
|
|
// Bars Color Variables ...
|
|
color _upColor = clrLime;
|
|
color _downColor = clrRed;
|
|
color _lineColor = clrLime;
|
|
color _bullishColor = clrLime;
|
|
color _bearishColor = clrRed;
|
|
|
|
//
|
|
int limit;
|
|
|
|
//
|
|
int maxLength;
|
|
|
|
//
|
|
int firstBarIndex;
|
|
|
|
//
|
|
// XMarketCycle sc;
|
|
int mSCLength = 0;
|
|
int mSCMALength = 0;
|
|
ENUM_TIMEFRAMES mSCPeriod = NULL;
|
|
|
|
//
|
|
// XMarketCycle mc;
|
|
int mMCLength = 0;
|
|
int mMCMALength = 0;
|
|
ENUM_TIMEFRAMES mMCPeriod = NULL;
|
|
|
|
//
|
|
// XMarketCycle lc;
|
|
int mLCLength = 0;
|
|
int mLCMALength = 0;
|
|
ENUM_TIMEFRAMES mLCPeriod = NULL;
|
|
|
|
//
|
|
// XMarketCycle hc;
|
|
int mHCLength = 0;
|
|
int mHCMALength = 0;
|
|
ENUM_TIMEFRAMES mHCPeriod = NULL;
|
|
|
|
//
|
|
// Handlers ...
|
|
int scMaHandler = INVALID_HANDLE;
|
|
int mcMaHandler = INVALID_HANDLE;
|
|
int lcMaHandler = INVALID_HANDLE;
|
|
int hcMaHandler = INVALID_HANDLE;
|
|
|
|
//
|
|
// Requirements ...
|
|
CArrayObj mObjects;
|
|
XCPOIDrawer *mDrawer;
|
|
|
|
//
|
|
// Event Handlers ...
|
|
|
|
/**
|
|
* Initialize Indicator ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int OnInit()
|
|
{
|
|
//
|
|
bool has = false;
|
|
|
|
//
|
|
ReadBarStyle();
|
|
|
|
//
|
|
// Validate Inputs ...
|
|
has = ValidateInputs();
|
|
if (!has)
|
|
{
|
|
return INIT_PARAMETERS_INCORRECT;
|
|
}
|
|
|
|
//
|
|
has = InitCycles();
|
|
if (!has)
|
|
{
|
|
return INIT_FAILED;
|
|
}
|
|
|
|
//
|
|
// 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();
|
|
|
|
//
|
|
// Initial Requirements ...
|
|
has = InitRequirements();
|
|
if (!has)
|
|
{
|
|
return INIT_FAILED;
|
|
}
|
|
|
|
//
|
|
if (showBars)
|
|
{
|
|
ShowBars();
|
|
}
|
|
else
|
|
{
|
|
HideBars();
|
|
}
|
|
|
|
//
|
|
// Define Index Buffers ...
|
|
DefineBuffers();
|
|
|
|
//
|
|
// Set Indicator ShortName ...
|
|
SetIndicatorName();
|
|
|
|
//
|
|
// Init Succeed ...
|
|
return INIT_SUCCEEDED;
|
|
|
|
//
|
|
}
|
|
|
|
/**
|
|
* De Initialize Indicator ...
|
|
*
|
|
* @param reason: Integer, De Initialization Reason ...
|
|
*/
|
|
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
|
|
|
|
//
|
|
ShowBars();
|
|
|
|
//
|
|
delete mDrawer;
|
|
ZeroMemory(mDrawer);
|
|
|
|
//
|
|
mObjects.Clear();
|
|
|
|
//
|
|
// De Initialize all Handlers and etc ...
|
|
IndicatorRelease(scMaHandler);
|
|
IndicatorRelease(mcMaHandler);
|
|
IndicatorRelease(lcMaHandler);
|
|
IndicatorRelease(hcMaHandler);
|
|
}
|
|
|
|
/**
|
|
* Calculate Bars ...
|
|
*
|
|
* @param rates_total: Integer, Total Bars on Chart ...
|
|
* @param prev_calculated: Integer, Total Calculated Bars on Charts ...
|
|
* @param time: DateTime Array, History of Open Time ...
|
|
* @param open: Double Array, History of Open Prices ...
|
|
* @param high: Double Array, History of High Prices ...
|
|
* @param low: Double Array, History of Low Prices ...
|
|
* @param close: Double Array, History of Close Prices ...
|
|
* @param tick_volume: Long, History of Tick Volumes on Bar ...
|
|
* @param volume: Long, History of Trade Volumes ...
|
|
* @param spread: Double, History of Spread Price ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int OnCalculate(
|
|
const int rates_total,
|
|
const int prev_calculated,
|
|
const datetime &time[],
|
|
const double &open[],
|
|
const double &high[],
|
|
const double &low[],
|
|
const double &close[],
|
|
const long &tick_volume[],
|
|
const long &volume[],
|
|
const int &spread[] //
|
|
)
|
|
{
|
|
//
|
|
// Prepare Buffers ...
|
|
ArraySetAsSeries(time, true);
|
|
ArraySetAsSeries(open, true);
|
|
ArraySetAsSeries(high, true);
|
|
ArraySetAsSeries(low, true);
|
|
ArraySetAsSeries(close, true);
|
|
ArraySetAsSeries(tick_volume, true);
|
|
ArraySetAsSeries(volume, true);
|
|
ArraySetAsSeries(spread, true);
|
|
|
|
//
|
|
// Validate Calculated Bars ...
|
|
|
|
//
|
|
int scCalculatedBars = BarsCalculated(scMaHandler);
|
|
int mcCalculatedBars = BarsCalculated(mcMaHandler);
|
|
int lcCalculatedBars = BarsCalculated(lcMaHandler);
|
|
int hcCalculatedBars = BarsCalculated(hcMaHandler);
|
|
|
|
//
|
|
bool isPassedRequiredCalculatedBars =
|
|
//
|
|
// SC ...
|
|
scCalculatedBars >= maxLength &&
|
|
//
|
|
// MC ...
|
|
mcCalculatedBars >= maxLength &&
|
|
//
|
|
// LC ...
|
|
lcCalculatedBars >= maxLength &&
|
|
//
|
|
// HC ...
|
|
hcCalculatedBars >= maxLength
|
|
//
|
|
;
|
|
if (!isPassedRequiredCalculatedBars)
|
|
{
|
|
return prev_calculated;
|
|
}
|
|
|
|
//
|
|
limit = (prev_calculated > rates_total || prev_calculated <= 0)
|
|
? rates_total
|
|
: (rates_total - prev_calculated) + 1;
|
|
|
|
//
|
|
// Buffers Copy ...
|
|
|
|
//
|
|
int copiedSCs = CopyBuffer(scMaHandler, MAIN_LINE, 0, limit, scMaBuffer);
|
|
int copiedMCs = CopyBuffer(mcMaHandler, MAIN_LINE, 0, limit, mcMaBuffer);
|
|
int copiedLCs = CopyBuffer(lcMaHandler, MAIN_LINE, 0, limit, lcMaBuffer);
|
|
int copiedHCs = CopyBuffer(hcMaHandler, MAIN_LINE, 0, limit, hcMaBuffer);
|
|
|
|
//
|
|
// Validate Copied Items ...
|
|
bool isPassedRequiredCopiedItems =
|
|
//
|
|
// SC ...
|
|
copiedSCs >= limit &&
|
|
//
|
|
// MC ...
|
|
copiedMCs >= limit &&
|
|
//
|
|
// LC ...
|
|
copiedLCs >= limit &&
|
|
//
|
|
// HC ...
|
|
copiedHCs >= limit
|
|
//
|
|
;
|
|
if (!isPassedRequiredCopiedItems)
|
|
{
|
|
return prev_calculated;
|
|
}
|
|
|
|
//
|
|
// Main Loop ...
|
|
for (int i = limit - 1; i >= 0 && !IsStopped(); i--)
|
|
{
|
|
//
|
|
CalculateBuffers(
|
|
i,
|
|
prev_calculated,
|
|
rates_total,
|
|
//
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tick_volume //
|
|
);
|
|
}
|
|
|
|
//
|
|
return rates_total;
|
|
}
|
|
|
|
//
|
|
// Custom Functions ...
|
|
|
|
/**
|
|
* Set Indicator Short Name and also we can define Buffers Labels ...
|
|
*/
|
|
void SetIndicatorName()
|
|
{
|
|
//
|
|
IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
|
|
IndicatorSetString(INDICATOR_SHORTNAME, ShortName);
|
|
}
|
|
|
|
/**
|
|
* Validate Input Args for Initialization ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool ValidateInputs()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
// CYCLES ...
|
|
(IsValid(scMethod, scPeriod) &&
|
|
IsValid(mcMethod, mcPeriod) &&
|
|
IsValid(lcMethod, lcPeriod) &&
|
|
IsValid(hcMethod, hcPeriod))
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Extract Max Length of Inputs ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int ExtractMaxLengthOfInputs()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
result = MathMax(mSCLength, mMCLength);
|
|
result = MathMax(result, mLCLength);
|
|
result = MathMax(result, mHCLength);
|
|
result = MathMax(result, mSCMALength);
|
|
result = MathMax(result, mMCMALength);
|
|
result = MathMax(result, mLCMALength);
|
|
result = MathMax(result, mHCMALength);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Define Required Buffers ...
|
|
*/
|
|
void DefineBuffers()
|
|
{
|
|
//
|
|
// Plot Buffers ...
|
|
|
|
//
|
|
// SC ...
|
|
|
|
//
|
|
ArraySetAsSeries(scMaBuffer, true);
|
|
SetIndexBuffer(scMaBufferIndex, scMaBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(scMaBufferPlotIndex, PLOT_SHOW_DATA, showShortCycleMa);
|
|
PlotIndexSetDouble(scMaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
ArraySetAsSeries(scMaColorBuffer, true);
|
|
SetIndexBuffer(scMaColorBufferIndex, scMaColorBuffer, INDICATOR_COLOR_INDEX);
|
|
|
|
//
|
|
ArraySetAsSeries(scMaStateBuffer, true);
|
|
SetIndexBuffer(scMaStateBufferIndex, scMaStateBuffer, INDICATOR_CALCULATIONS);
|
|
|
|
//
|
|
// SC ...
|
|
|
|
//
|
|
ArraySetAsSeries(mcMaBuffer, true);
|
|
SetIndexBuffer(mcMaBufferIndex, mcMaBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(mcMaBufferPlotIndex, PLOT_SHOW_DATA, showMediumCycleMa);
|
|
PlotIndexSetDouble(mcMaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
ArraySetAsSeries(mcMaColorBuffer, true);
|
|
SetIndexBuffer(mcMaColorBufferIndex, mcMaColorBuffer, INDICATOR_COLOR_INDEX);
|
|
|
|
//
|
|
ArraySetAsSeries(scMaStateBuffer, true);
|
|
SetIndexBuffer(mcMaStateBufferIndex, mcMaStateBuffer, INDICATOR_CALCULATIONS);
|
|
|
|
//
|
|
// LC ...
|
|
|
|
//
|
|
ArraySetAsSeries(lcMaBuffer, true);
|
|
SetIndexBuffer(lcMaBufferIndex, lcMaBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(lcMaBufferPlotIndex, PLOT_SHOW_DATA, showLongCycleMa);
|
|
PlotIndexSetDouble(lcMaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
ArraySetAsSeries(lcMaColorBuffer, true);
|
|
SetIndexBuffer(lcMaColorBufferIndex, lcMaColorBuffer, INDICATOR_COLOR_INDEX);
|
|
|
|
//
|
|
ArraySetAsSeries(lcMaStateBuffer, true);
|
|
SetIndexBuffer(lcMaStateBufferIndex, lcMaStateBuffer, INDICATOR_CALCULATIONS);
|
|
|
|
//
|
|
// HC ...
|
|
|
|
//
|
|
ArraySetAsSeries(hcMaBuffer, true);
|
|
SetIndexBuffer(hcMaBufferIndex, hcMaBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(hcMaBufferPlotIndex, PLOT_SHOW_DATA, showHindCycleMa);
|
|
PlotIndexSetDouble(hcMaBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
ArraySetAsSeries(hcMaColorBuffer, true);
|
|
SetIndexBuffer(hcMaColorBufferIndex, hcMaColorBuffer, INDICATOR_COLOR_INDEX);
|
|
|
|
//
|
|
ArraySetAsSeries(hcMaStateBuffer, true);
|
|
SetIndexBuffer(hcMaStateBufferIndex, hcMaStateBuffer, INDICATOR_CALCULATIONS);
|
|
|
|
//
|
|
// CYCLES ...
|
|
|
|
//
|
|
// SHORT ...
|
|
|
|
//
|
|
ENUM_DRAW_TYPE sDrawType = showShortCycle ? DRAW_LINE : DRAW_NONE;
|
|
|
|
//
|
|
// HH ...
|
|
|
|
//
|
|
ArraySetAsSeries(sHHBuffer, true);
|
|
SetIndexBuffer(sHHBufferIndex, sHHBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(sHHBufferPlotIndex, PLOT_SHOW_DATA, showShortCycle);
|
|
PlotIndexSetInteger(sHHBufferPlotIndex, PLOT_DRAW_TYPE, sDrawType);
|
|
PlotIndexSetDouble(sHHBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
// LL ...
|
|
|
|
//
|
|
ArraySetAsSeries(sLLBuffer, true);
|
|
SetIndexBuffer(sLLBufferIndex, sLLBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(sLLBufferPlotIndex, PLOT_SHOW_DATA, showShortCycle);
|
|
PlotIndexSetInteger(sLLBufferPlotIndex, PLOT_DRAW_TYPE, sDrawType);
|
|
PlotIndexSetDouble(sLLBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
// MEDIUM ...
|
|
|
|
//
|
|
ENUM_DRAW_TYPE mDrawType = showMediumCycle ? DRAW_LINE : DRAW_NONE;
|
|
|
|
//
|
|
// HH ...
|
|
|
|
//
|
|
ArraySetAsSeries(mHHBuffer, true);
|
|
SetIndexBuffer(mHHBufferIndex, mHHBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(mHHBufferPlotIndex, PLOT_SHOW_DATA, showMediumCycle);
|
|
PlotIndexSetInteger(mHHBufferPlotIndex, PLOT_DRAW_TYPE, mDrawType);
|
|
PlotIndexSetDouble(mHHBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
// LL ...
|
|
|
|
//
|
|
ArraySetAsSeries(mLLBuffer, true);
|
|
SetIndexBuffer(mLLBufferIndex, mLLBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(mLLBufferPlotIndex, PLOT_SHOW_DATA, showMediumCycle);
|
|
PlotIndexSetInteger(mLLBufferPlotIndex, PLOT_DRAW_TYPE, mDrawType);
|
|
PlotIndexSetDouble(mLLBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
// LONG ...
|
|
|
|
//
|
|
ENUM_DRAW_TYPE lDrawType = showLongCycle ? DRAW_LINE : DRAW_NONE;
|
|
|
|
//
|
|
// HH ...
|
|
|
|
//
|
|
ArraySetAsSeries(lHHBuffer, true);
|
|
SetIndexBuffer(lHHBufferIndex, lHHBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(lHHBufferPlotIndex, PLOT_SHOW_DATA, showLongCycle);
|
|
PlotIndexSetInteger(lHHBufferPlotIndex, PLOT_DRAW_TYPE, lDrawType);
|
|
PlotIndexSetDouble(lHHBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
// LL ...
|
|
|
|
//
|
|
ArraySetAsSeries(lLLBuffer, true);
|
|
SetIndexBuffer(lLLBufferIndex, lLLBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(lLLBufferPlotIndex, PLOT_SHOW_DATA, showLongCycle);
|
|
PlotIndexSetInteger(lLLBufferPlotIndex, PLOT_DRAW_TYPE, lDrawType);
|
|
PlotIndexSetDouble(lLLBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
// HIND ...
|
|
|
|
//
|
|
ENUM_DRAW_TYPE hDrawType = showHindCycle ? DRAW_LINE : DRAW_NONE;
|
|
|
|
//
|
|
// HH ...
|
|
|
|
//
|
|
ArraySetAsSeries(hHHBuffer, true);
|
|
SetIndexBuffer(hHHBufferIndex, hHHBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(hHHBufferPlotIndex, PLOT_SHOW_DATA, showHindCycle);
|
|
PlotIndexSetInteger(hHHBufferPlotIndex, PLOT_DRAW_TYPE, hDrawType);
|
|
PlotIndexSetDouble(hHHBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
// LL ...
|
|
|
|
//
|
|
ArraySetAsSeries(hLLBuffer, true);
|
|
SetIndexBuffer(hLLBufferIndex, hLLBuffer, INDICATOR_DATA);
|
|
|
|
//
|
|
PlotIndexSetInteger(hLLBufferPlotIndex, PLOT_SHOW_DATA, showHindCycle);
|
|
PlotIndexSetInteger(hLLBufferPlotIndex, PLOT_DRAW_TYPE, hDrawType);
|
|
PlotIndexSetDouble(hLLBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
//
|
|
// Data Buffers ...
|
|
|
|
//
|
|
// SC ...
|
|
ArraySetAsSeries(scMaStateBuffer, true);
|
|
SetIndexBuffer(scMaStateBufferIndex, scMaStateBuffer, INDICATOR_CALCULATIONS);
|
|
|
|
//
|
|
// MC ...
|
|
ArraySetAsSeries(mcMaStateBuffer, true);
|
|
SetIndexBuffer(mcMaStateBufferIndex, mcMaStateBuffer, INDICATOR_CALCULATIONS);
|
|
|
|
//
|
|
// LC ...
|
|
ArraySetAsSeries(lcMaStateBuffer, true);
|
|
SetIndexBuffer(lcMaStateBufferIndex, lcMaStateBuffer, INDICATOR_CALCULATIONS);
|
|
|
|
//
|
|
// HC ...
|
|
ArraySetAsSeries(hcMaStateBuffer, true);
|
|
SetIndexBuffer(hcMaStateBufferIndex, hcMaStateBuffer, INDICATOR_CALCULATIONS);
|
|
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Initial Market Cycles ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool InitCycles()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int cPeriodSeconds = PeriodSeconds(_Period);
|
|
|
|
//
|
|
// Find Cycle Period ...
|
|
if (scMethod == X_PERIOD_AUTO)
|
|
{
|
|
//
|
|
// Select Period ...
|
|
mSCPeriod = GetCyclePeriod(
|
|
X_MARKET_CYCLE_SHORT,
|
|
_Period //
|
|
);
|
|
}
|
|
else
|
|
{
|
|
mSCPeriod = scPeriod;
|
|
}
|
|
|
|
//
|
|
if (IsValid(mSCPeriod))
|
|
{
|
|
mSCLength = PeriodSeconds(mSCPeriod) / cPeriodSeconds;
|
|
}
|
|
|
|
//
|
|
// Find Cycle Period ...
|
|
if (mcMethod == X_PERIOD_AUTO)
|
|
{
|
|
//
|
|
// Select Period ...
|
|
mMCPeriod = GetCyclePeriod(
|
|
X_MARKET_CYCLE_MEDIUM,
|
|
_Period //
|
|
);
|
|
}
|
|
else
|
|
{
|
|
mMCPeriod = mcPeriod;
|
|
}
|
|
|
|
//
|
|
if (IsValid(mMCPeriod))
|
|
{
|
|
mMCLength = PeriodSeconds(mMCPeriod) / cPeriodSeconds;
|
|
}
|
|
|
|
//
|
|
// Find Cycle Period ...
|
|
if (lcMethod == X_PERIOD_AUTO)
|
|
{
|
|
//
|
|
// Select Period ...
|
|
mLCPeriod = GetCyclePeriod(
|
|
X_MARKET_CYCLE_LONG,
|
|
_Period //
|
|
);
|
|
}
|
|
else
|
|
{
|
|
mLCPeriod = lcPeriod;
|
|
}
|
|
|
|
//
|
|
if (IsValid(mLCPeriod))
|
|
{
|
|
mLCLength = PeriodSeconds(mLCPeriod) / cPeriodSeconds;
|
|
}
|
|
|
|
//
|
|
// Find Cycle Period ...
|
|
if (hcMethod == X_PERIOD_AUTO)
|
|
{
|
|
//
|
|
// Select Period ...
|
|
mHCPeriod = GetCyclePeriod(
|
|
X_MARKET_CYCLE_HIND,
|
|
_Period //
|
|
);
|
|
}
|
|
else
|
|
{
|
|
mHCPeriod = hcPeriod;
|
|
}
|
|
|
|
//
|
|
if (IsValid(mHCPeriod))
|
|
{
|
|
mHCLength = PeriodSeconds(mHCPeriod) / cPeriodSeconds;
|
|
}
|
|
|
|
//
|
|
result = mSCLength > 0 &&
|
|
mMCLength > mSCLength &&
|
|
mLCLength > mMCLength &&
|
|
mHCLength > mLCLength;
|
|
|
|
//
|
|
// Selecte Applied Cycle ...
|
|
if (result)
|
|
{
|
|
//
|
|
int normalizedMALength = maLength > 0
|
|
? maLength
|
|
: 1;
|
|
|
|
//
|
|
mSCMALength =
|
|
mSCLength * normalizedMALength;
|
|
mMCMALength =
|
|
mMCLength * normalizedMALength;
|
|
mLCMALength =
|
|
mLCLength * normalizedMALength;
|
|
mHCMALength =
|
|
mHCLength * normalizedMALength;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Initial all Indicator Requirements ...
|
|
*
|
|
* @return ( false )
|
|
*
|
|
*/
|
|
bool InitRequirements()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Handlers ...
|
|
|
|
//
|
|
// SC ...
|
|
scMaHandler = iMA(
|
|
_Symbol,
|
|
_Period,
|
|
mSCMALength,
|
|
0,
|
|
maMethod,
|
|
maAppliedTo //
|
|
);
|
|
result = scMaHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// MC ...
|
|
mcMaHandler = iMA(
|
|
_Symbol,
|
|
_Period,
|
|
mMCMALength,
|
|
0,
|
|
maMethod,
|
|
maAppliedTo //
|
|
);
|
|
result = mcMaHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// LC ...
|
|
lcMaHandler = iMA(
|
|
_Symbol,
|
|
_Period,
|
|
mLCMALength,
|
|
0,
|
|
maMethod,
|
|
maAppliedTo //
|
|
);
|
|
result = lcMaHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// HC ...
|
|
hcMaHandler = iMA(
|
|
_Symbol,
|
|
_Period,
|
|
mHCMALength,
|
|
0,
|
|
maMethod,
|
|
maAppliedTo //
|
|
);
|
|
result = hcMaHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mDrawer = new XCPOIDrawer();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Calculate Custom Buffers ...
|
|
*
|
|
* @param barIndex: Integer, Represent Current Bar ...
|
|
* @param prevCalculated: Integer, Represent Previous Calculated Bars ...
|
|
* @param ratesTotal: Integer, Represents All Available Bars ...
|
|
* @param open: Double Array, History of Open Prices ...
|
|
* @param high: Double Array, History of High Prices ...
|
|
* @param close: Double Array, History of Close Prices ...
|
|
* @param low: Double Array, History of Low Prices ...
|
|
* @param tickVolume: Long, History of Tick Volumes on Bar ...
|
|
*/
|
|
void CalculateBuffers(
|
|
int barIndex,
|
|
const int prevCalculated,
|
|
const int ratesTotal,
|
|
const double &open[],
|
|
const double &high[],
|
|
const double &close[],
|
|
const double &low[],
|
|
const long &tickVolume[] //
|
|
)
|
|
{
|
|
//
|
|
int barsLimit = startCalculationForLastBars > 0
|
|
? startCalculationForLastBars
|
|
: 0;
|
|
if (barsLimit == 0)
|
|
{
|
|
//
|
|
barsLimit = ratesTotal;
|
|
firstBarIndex = barsLimit - 1;
|
|
}
|
|
else
|
|
{
|
|
firstBarIndex = startCalculationForLastBars;
|
|
}
|
|
|
|
//
|
|
// bool canCalculate = true;
|
|
bool canCalculate =
|
|
barIndex <= barsLimit;
|
|
if (canCalculate)
|
|
{
|
|
//
|
|
// Calculate Values ...
|
|
CalculateValues(
|
|
barIndex,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume //
|
|
);
|
|
}
|
|
else
|
|
{
|
|
FillBuffersZero(barIndex);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Fill All Bufers to Zero Vlue for Specified Bar Index ...
|
|
*
|
|
* @param barIndex: Integer ...
|
|
*/
|
|
void FillBuffersZero(int barIndex)
|
|
{
|
|
//
|
|
scMaColorBuffer[barIndex] = hideColorIDX;
|
|
mcMaColorBuffer[barIndex] = hideColorIDX;
|
|
lcMaColorBuffer[barIndex] = hideColorIDX;
|
|
hcMaColorBuffer[barIndex] = hideColorIDX;
|
|
}
|
|
|
|
/**
|
|
* Calculate Values ...
|
|
*
|
|
* @param barIndex: int, Specified Bar Index ...
|
|
* @param prevCalculated: int, Provides Previous Calculated Bars ...
|
|
* @param ratesTotal: int, Provides All Availabled Bars ...
|
|
* @param open: double Collection, Provides Open Prices Time Series ...
|
|
* @param high: double Collection, Provides High Prices Time Series ...
|
|
* @param close: double Collection, Provides Close Prices Time Series ...
|
|
* @param low: double Collection, Provides Low Prices Time Series ...
|
|
* @param tickVolume: long Collection, Provides Ticks Volume Prices Time Series ...
|
|
*/
|
|
void CalculateValues(
|
|
int barIndex,
|
|
const int prevCalculated,
|
|
const int ratesTotal,
|
|
const double &open[],
|
|
const double &high[],
|
|
const double &close[],
|
|
const double &low[],
|
|
const long &tickVolume[] //
|
|
)
|
|
{
|
|
//
|
|
int lastBarIndex = barIndex + 1;
|
|
int maxBarIndex = startCalculationForLastBars > 0
|
|
? startCalculationForLastBars
|
|
: ratesTotal;
|
|
bool isFirstBar =
|
|
startCalculationForLastBars > 0
|
|
? barIndex == startCalculationForLastBars
|
|
: barIndex == firstBarIndex;
|
|
|
|
//
|
|
// Cycle Ranges ...
|
|
CalculateCycleRanges(
|
|
barIndex,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume //
|
|
);
|
|
|
|
//
|
|
// Cycle MAs ...
|
|
CalculateCycleMAs(
|
|
barIndex,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume //
|
|
);
|
|
|
|
//
|
|
// Do Process if Required ...
|
|
DoProcess(
|
|
barIndex,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume //
|
|
);
|
|
}
|
|
|
|
//
|
|
void CalculateCycleRanges(
|
|
int barIndex,
|
|
const int prevCalculated,
|
|
const int ratesTotal,
|
|
const double &open[],
|
|
const double &high[],
|
|
const double &close[],
|
|
const double &low[],
|
|
const long &tickVolume[] //
|
|
)
|
|
{
|
|
//
|
|
// SHORT ...
|
|
CalculateCycleRange(
|
|
barIndex,
|
|
X_MARKET_CYCLE_SHORT,
|
|
sHHBuffer,
|
|
sLLBuffer //
|
|
);
|
|
|
|
//
|
|
// MEDIUM ...
|
|
CalculateCycleRange(
|
|
barIndex,
|
|
X_MARKET_CYCLE_MEDIUM,
|
|
mHHBuffer,
|
|
mLLBuffer //
|
|
);
|
|
|
|
//
|
|
// LONG ...
|
|
CalculateCycleRange(
|
|
barIndex,
|
|
X_MARKET_CYCLE_LONG,
|
|
lHHBuffer,
|
|
lLLBuffer //
|
|
);
|
|
|
|
//
|
|
// HIND ...
|
|
CalculateCycleRange(
|
|
barIndex,
|
|
X_MARKET_CYCLE_HIND,
|
|
hHHBuffer,
|
|
hLLBuffer //
|
|
);
|
|
}
|
|
|
|
//
|
|
void CalculateCycleMAs(
|
|
int barIndex,
|
|
const int prevCalculated,
|
|
const int ratesTotal,
|
|
const double &open[],
|
|
const double &high[],
|
|
const double &close[],
|
|
const double &low[],
|
|
const long &tickVolume[] //
|
|
)
|
|
{
|
|
//
|
|
// SHORT ...
|
|
CalculateCycleMA(
|
|
barIndex,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume,
|
|
showShortCycleMa,
|
|
scMaBuffer,
|
|
scMaColorBuffer,
|
|
scMaStateBuffer //
|
|
);
|
|
|
|
//
|
|
// MEDIUM ...
|
|
CalculateCycleMA(
|
|
barIndex,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume,
|
|
showMediumCycleMa,
|
|
mcMaBuffer,
|
|
mcMaColorBuffer,
|
|
mcMaStateBuffer //
|
|
);
|
|
|
|
//
|
|
// LONG ...
|
|
CalculateCycleMA(
|
|
barIndex,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume,
|
|
showLongCycleMa,
|
|
lcMaBuffer,
|
|
lcMaColorBuffer,
|
|
lcMaStateBuffer //
|
|
);
|
|
|
|
//
|
|
// HIND ...
|
|
CalculateCycleMA(
|
|
barIndex,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume,
|
|
showHindCycleMa,
|
|
hcMaBuffer,
|
|
hcMaColorBuffer,
|
|
hcMaStateBuffer //
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Calculate Specified Market Cycle Range ...
|
|
*
|
|
* @param barIndex: Integer, Bar Index ...
|
|
* @param cycle: ENUM_X_MARKET_CYCLES member, Specified Cycle ...
|
|
* @param hhBuffer: Highest High Buffer Reference ...
|
|
* @param llBuffer: Lowest Low Buffer Reference ...
|
|
*/
|
|
void CalculateCycleRange(
|
|
int barIndex,
|
|
ENUM_X_MARKET_CYCLES cycle,
|
|
double &hhBuffer[],
|
|
double &llBuffer[] //
|
|
)
|
|
{
|
|
//
|
|
XOHCL bar;
|
|
bool isBarInited = bar.Init(
|
|
_Symbol,
|
|
_Period,
|
|
barIndex
|
|
//
|
|
);
|
|
if (!isBarInited)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
int mLength = 0;
|
|
switch (cycle)
|
|
{
|
|
//
|
|
case X_MARKET_CYCLE_SHORT:
|
|
mLength = mSCLength;
|
|
break;
|
|
|
|
//
|
|
case X_MARKET_CYCLE_MEDIUM:
|
|
mLength = mMCLength;
|
|
break;
|
|
|
|
//
|
|
case X_MARKET_CYCLE_LONG:
|
|
mLength = mLCLength;
|
|
break;
|
|
|
|
//
|
|
case X_MARKET_CYCLE_HIND:
|
|
mLength = mHCLength;
|
|
break;
|
|
}
|
|
|
|
//
|
|
if (mLength == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
// Find Highest High ...
|
|
double hhValue = bar.FindHighest(
|
|
mLength,
|
|
upperMode //
|
|
);
|
|
hhBuffer[barIndex] = hhValue;
|
|
|
|
//
|
|
// Find Lowest Low ...
|
|
double llValue = bar.FindLowest(
|
|
mLength,
|
|
lowerMode //
|
|
);
|
|
llBuffer[barIndex] = llValue;
|
|
|
|
//
|
|
bar.Clean();
|
|
}
|
|
|
|
/**
|
|
* Calculate Specified Market Cycle MA ...
|
|
*
|
|
* @param barIndex: Integer, Bar Index ...
|
|
* @param cycle: ENUM_X_MARKET_CYCLES member, Specified Cycle ...
|
|
* @param hhBuffer: Highest High Buffer Reference ...
|
|
* @param llBuffer: Lowest Low Buffer Reference ...
|
|
*/
|
|
void CalculateCycleMA(
|
|
int barIndex,
|
|
const int prevCalculated,
|
|
const int ratesTotal,
|
|
const double &open[],
|
|
const double &high[],
|
|
const double &close[],
|
|
const double &low[],
|
|
const long &tickVolume[],
|
|
//
|
|
bool show,
|
|
double &maBuffer[],
|
|
double &colorBuffer[],
|
|
double &stateBuffer[] //
|
|
)
|
|
{
|
|
//
|
|
double iLow = low[barIndex];
|
|
double iHigh = high[barIndex];
|
|
double iOpen = open[barIndex];
|
|
double iClose = close[barIndex];
|
|
double iValue = maBuffer[barIndex];
|
|
|
|
//
|
|
bool basedOnClose = false;
|
|
|
|
//
|
|
double iState = neuturalState;
|
|
double iColor = neuturalColorIDX;
|
|
if (basedOnClose)
|
|
{
|
|
//
|
|
iColor =
|
|
iClose > iValue
|
|
? bullishColorIDX
|
|
: iClose < iValue
|
|
? bearishColorIDX
|
|
: neuturalColorIDX;
|
|
|
|
//
|
|
iState =
|
|
iClose > iValue
|
|
? bullishState
|
|
: iClose < iValue
|
|
? bearishState
|
|
: neuturalState;
|
|
}
|
|
else
|
|
{
|
|
//
|
|
iColor =
|
|
iLow > iValue
|
|
? bullishColorIDX
|
|
: iHigh < iValue
|
|
? bearishColorIDX
|
|
: neuturalColorIDX;
|
|
|
|
//
|
|
iState =
|
|
iLow > iValue
|
|
? bullishState
|
|
: iHigh < iValue
|
|
? bearishState
|
|
: neuturalState;
|
|
}
|
|
stateBuffer[barIndex] = iState;
|
|
colorBuffer[barIndex] = show
|
|
? iColor
|
|
: hideColorIDX;
|
|
}
|
|
|
|
//
|
|
// Process Bars ...
|
|
void DoProcess(
|
|
int barIndex,
|
|
const int prevCalculated,
|
|
const int ratesTotal,
|
|
const double &open[],
|
|
const double &high[],
|
|
const double &close[],
|
|
const double &low[],
|
|
const long &tickVolume[] //
|
|
)
|
|
{
|
|
//
|
|
int lastBarIndex = barIndex + 1;
|
|
int maxBarIndex = startCalculationForLastBars > 0
|
|
? startCalculationForLastBars
|
|
: ratesTotal;
|
|
bool isFirstBar =
|
|
startCalculationForLastBars > 0
|
|
? barIndex == startCalculationForLastBars
|
|
: barIndex == firstBarIndex;
|
|
|
|
//
|
|
if (isFirstBar)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
int minRequiredRange = 20;
|
|
if (barIndex > maxBarIndex - 1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
XOHCL iBar;
|
|
bool has = iBar.Init(
|
|
_Symbol,
|
|
_Period,
|
|
barIndex //
|
|
);
|
|
if (!has)
|
|
{
|
|
//
|
|
iBar.Clean();
|
|
|
|
//
|
|
return;
|
|
}
|
|
|
|
//
|
|
// Reading Values ...
|
|
|
|
//
|
|
// Bars Info ...
|
|
|
|
//
|
|
double iLow = low[barIndex];
|
|
double iHigh = high[barIndex];
|
|
double iOpen = open[barIndex];
|
|
double iClose = close[barIndex];
|
|
|
|
//
|
|
double iPLow = low[barIndex + 1];
|
|
double iPHigh = high[barIndex + 1];
|
|
double iPOpen = open[barIndex + 1];
|
|
double iPClose = close[barIndex + 1];
|
|
|
|
//
|
|
// SC ...
|
|
|
|
//
|
|
double iSCLL = sLLBuffer[barIndex];
|
|
double iSCHH = sHHBuffer[barIndex];
|
|
|
|
//
|
|
double iPSCLL = sLLBuffer[barIndex + 1];
|
|
double iPSCHH = sHHBuffer[barIndex + 1];
|
|
|
|
//
|
|
double iSCMa = scMaBuffer[barIndex];
|
|
double iPSCMa = scMaBuffer[barIndex + 1];
|
|
|
|
//
|
|
double iSCMaState = scMaStateBuffer[barIndex];
|
|
double iPSCMaState = scMaStateBuffer[barIndex + 1];
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isSCMaBullish =
|
|
iSCMaState > 0;
|
|
bool isPSCMaBullish =
|
|
iPSCMaState > 0;
|
|
|
|
//
|
|
bool isSCMaBearish =
|
|
iSCMaState < 0;
|
|
bool isPSCMaBearish =
|
|
iPSCMaState < 0;
|
|
|
|
//
|
|
bool isSCMaSwitchedToBullish =
|
|
isSCMaBullish &&
|
|
!isPSCMaBullish;
|
|
|
|
//
|
|
bool isSCMaSwitchedToBearish =
|
|
isSCMaBearish &&
|
|
!isPSCMaBearish;
|
|
|
|
//
|
|
// MC ...
|
|
|
|
//
|
|
double iMCLL = mLLBuffer[barIndex];
|
|
double iMCHH = mHHBuffer[barIndex];
|
|
|
|
//
|
|
double iPMCLL = mLLBuffer[barIndex + 1];
|
|
double iPMCHH = mHHBuffer[barIndex + 1];
|
|
|
|
//
|
|
double iMCMa = mcMaBuffer[barIndex];
|
|
double iPMCMa = mcMaBuffer[barIndex + 1];
|
|
|
|
//
|
|
double iMCMaState = mcMaStateBuffer[barIndex];
|
|
double iPMCMaState = mcMaStateBuffer[barIndex + 1];
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isMCMaBullish =
|
|
iMCMaState > 0;
|
|
bool isPMCMaBullish =
|
|
iPMCMaState > 0;
|
|
|
|
//
|
|
bool isMCMaBearish =
|
|
iMCMaState < 0;
|
|
bool isPMCMaBearish =
|
|
iPMCMaState < 0;
|
|
|
|
//
|
|
bool isMCMaSwitchedToBullish =
|
|
isMCMaBullish &&
|
|
!isPMCMaBullish;
|
|
|
|
//
|
|
bool isMCMaSwitchedToBearish =
|
|
isMCMaBearish &&
|
|
!isPMCMaBearish;
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isSCMaOverMC =
|
|
iSCMa > iMCMa;
|
|
bool isPSCMaOverMC =
|
|
iPSCMa > iPMCMa;
|
|
|
|
//
|
|
bool isSCMaUnderMC =
|
|
iSCMa < iMCMa;
|
|
bool isPSCMaUnderMC =
|
|
iPSCMa < iPMCMa;
|
|
|
|
//
|
|
bool isSCMaCrossedOverMC =
|
|
isSCMaOverMC &&
|
|
!isPSCMaOverMC;
|
|
|
|
//
|
|
bool isSCMaCrossedUnderMC =
|
|
isSCMaUnderMC &&
|
|
!isPSCMaUnderMC;
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isSCLLOverMCLL =
|
|
iSCLL > iMCLL;
|
|
bool isPSCLLOverMCLL =
|
|
iPSCLL > iPMCLL;
|
|
|
|
//
|
|
bool isSCLLUnderMCLL =
|
|
iSCLL < iMCLL;
|
|
bool isPSCLLUnderMCLL =
|
|
iPSCLL < iPMCLL;
|
|
|
|
//
|
|
bool isSCHHOverMCHH =
|
|
iSCHH > iMCHH;
|
|
bool isPSCHHOverMCHH =
|
|
iPSCHH > iPMCHH;
|
|
|
|
//
|
|
bool isSCHHUnderMCHH =
|
|
iSCHH < iMCHH;
|
|
bool isPSCHHUnderMCHH =
|
|
iPSCHH < iPMCHH;
|
|
|
|
//
|
|
bool isSCLLCrossedOverMCLL =
|
|
isSCLLOverMCLL &&
|
|
!isPSCLLOverMCLL;
|
|
|
|
//
|
|
bool isSCLLCrossedUnderMCLL =
|
|
isSCLLUnderMCLL &&
|
|
!isPSCLLUnderMCLL;
|
|
|
|
//
|
|
bool isSCHHCrossedOverMCHH =
|
|
isSCHHOverMCHH &&
|
|
!isPSCHHOverMCHH;
|
|
|
|
//
|
|
bool isSCHHCrossedUnderMCHH =
|
|
isSCHHUnderMCHH &&
|
|
!isPSCHHUnderMCHH;
|
|
|
|
//
|
|
// LC ...
|
|
|
|
//
|
|
double iLCLL = lLLBuffer[barIndex];
|
|
double iLCHH = lHHBuffer[barIndex];
|
|
|
|
//
|
|
double iPLCLL = lLLBuffer[barIndex + 1];
|
|
double iPLCHH = lHHBuffer[barIndex + 1];
|
|
|
|
//
|
|
double iLCMa = lcMaBuffer[barIndex];
|
|
double iPLCMa = lcMaBuffer[barIndex + 1];
|
|
|
|
//
|
|
double iLCMaState = lcMaStateBuffer[barIndex];
|
|
double iPLCMaState = lcMaStateBuffer[barIndex + 1];
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isLCMaBullish =
|
|
iLCMaState > 0;
|
|
bool isPLCMaBullish =
|
|
iPLCMaState > 0;
|
|
|
|
//
|
|
bool isLCMaBearish =
|
|
iLCMaState < 0;
|
|
bool isPLCMaBearish =
|
|
iPLCMaState < 0;
|
|
|
|
//
|
|
bool isLCMaSwitchedToBullish =
|
|
isLCMaBullish &&
|
|
!isPLCMaBullish;
|
|
|
|
//
|
|
bool isLCMaSwitchedToBearish =
|
|
isLCMaBearish &&
|
|
!isPLCMaBearish;
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isMCMaOverLC =
|
|
iMCMa > iLCMa;
|
|
bool isPMCMaOverLC =
|
|
iPMCMa > iPLCMa;
|
|
|
|
//
|
|
bool isMCMaUnderLC =
|
|
iMCMa < iLCMa;
|
|
bool isPMCMaUnderLC =
|
|
iPMCMa < iPLCMa;
|
|
|
|
//
|
|
bool isMCMaCrossedOverLC =
|
|
isMCMaOverLC &&
|
|
!isPMCMaOverLC;
|
|
|
|
//
|
|
bool isMCMaCrossedUnderLC =
|
|
isMCMaUnderLC &&
|
|
!isPMCMaUnderLC;
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isMCLLOverLCLL =
|
|
iMCLL > iLCLL;
|
|
bool isPMCLLOverLCLL =
|
|
iPMCLL > iPLCLL;
|
|
|
|
//
|
|
bool isMCLLUnderLCLL =
|
|
iMCLL < iLCLL;
|
|
bool isPMCLLUnderLCLL =
|
|
iPMCLL < iPLCLL;
|
|
|
|
//
|
|
bool isMCHHOverLCHH =
|
|
iMCHH > iLCHH;
|
|
bool isPMCHHOverLCHH =
|
|
iPMCHH > iPLCHH;
|
|
|
|
//
|
|
bool isMCHHUnderLCHH =
|
|
iMCHH < iLCHH;
|
|
bool isPMCHHUnderLCHH =
|
|
iPMCHH < iPLCHH;
|
|
|
|
//
|
|
bool isMCLLCrossedOverLCLL =
|
|
isMCLLOverLCLL &&
|
|
!isPMCLLOverLCLL;
|
|
|
|
//
|
|
bool isMCLLCrossedUnderLCLL =
|
|
isMCLLUnderLCLL &&
|
|
!isPMCLLUnderLCLL;
|
|
|
|
//
|
|
bool isMCHHCrossedOverLCHH =
|
|
isMCHHOverLCHH &&
|
|
!isPMCHHOverLCHH;
|
|
|
|
//
|
|
bool isMCHHCrossedUnderLCHH =
|
|
isMCHHUnderLCHH &&
|
|
!isPMCHHUnderLCHH;
|
|
|
|
//
|
|
// HC ...
|
|
|
|
//
|
|
double iHCLL = hLLBuffer[barIndex];
|
|
double iHCHH = hHHBuffer[barIndex];
|
|
|
|
//
|
|
double iPHCLL = hLLBuffer[barIndex + 1];
|
|
double iPHCHH = hHHBuffer[barIndex + 1];
|
|
|
|
//
|
|
double iHCMa = hcMaBuffer[barIndex];
|
|
double iPHCMa = hcMaBuffer[barIndex + 1];
|
|
|
|
//
|
|
double iHCMaState = hcMaStateBuffer[barIndex];
|
|
double iPHCMaState = hcMaStateBuffer[barIndex + 1];
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isHCMaBullish =
|
|
iHCMaState > 0;
|
|
bool isPHCMaBullish =
|
|
iPHCMaState > 0;
|
|
|
|
//
|
|
bool isHCMaBearish =
|
|
iHCMaState < 0;
|
|
bool isPHCMaBearish =
|
|
iPHCMaState < 0;
|
|
|
|
//
|
|
bool isHCMaSwitchedToBullish =
|
|
isHCMaBullish &&
|
|
!isPHCMaBullish;
|
|
|
|
//
|
|
bool isHCMaSwitchedToBearish =
|
|
isHCMaBearish &&
|
|
!isPHCMaBearish;
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isLCMaOverHC =
|
|
iLCMa > iHCMa;
|
|
bool isPLCMaOverHC =
|
|
iPLCMa > iPHCMa;
|
|
|
|
//
|
|
bool isLCMaUnderHC =
|
|
iLCMa < iHCMa;
|
|
bool isPLCMaUnderHC =
|
|
iPLCMa < iPHCMa;
|
|
|
|
//
|
|
bool isLCMaCrossedOverHC =
|
|
isLCMaOverHC &&
|
|
!isPLCMaOverHC;
|
|
|
|
//
|
|
bool isLCMaCrossedUnderHC =
|
|
isLCMaUnderHC &&
|
|
!isPLCMaUnderHC;
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isLCLLOverHCLL =
|
|
iLCLL > iHCLL;
|
|
bool isPLCLLOverHCLL =
|
|
iPLCLL > iPHCLL;
|
|
|
|
//
|
|
bool isLCLLUnderHCLL =
|
|
iLCLL < iHCLL;
|
|
bool isPLCLLUnderHCLL =
|
|
iPLCLL < iPHCLL;
|
|
|
|
//
|
|
bool isLCHHOverHCHH =
|
|
iLCHH > iHCHH;
|
|
bool isPLCHHOverHCHH =
|
|
iPLCHH > iPHCHH;
|
|
|
|
//
|
|
bool isLCHHUnderHCHH =
|
|
iLCHH < iHCHH;
|
|
bool isPLCHHUnderHCHH =
|
|
iPLCHH < iPHCHH;
|
|
|
|
//
|
|
bool isLCLLCrossedOverHCLL =
|
|
isLCLLOverHCLL &&
|
|
!isPLCLLOverHCLL;
|
|
|
|
//
|
|
bool isLCLLCrossedUnderHCLL =
|
|
isLCLLUnderHCLL &&
|
|
!isPLCLLUnderHCLL;
|
|
|
|
//
|
|
bool isLCHHCrossedOverHCHH =
|
|
isLCHHOverHCHH &&
|
|
!isPLCHHOverHCHH;
|
|
|
|
//
|
|
bool isLCHHCrossedUnderHCHH =
|
|
isLCHHUnderHCHH &&
|
|
!isPLCHHUnderHCHH;
|
|
|
|
//
|
|
// Check Price Inside Cloud Zone ...
|
|
|
|
//
|
|
double iCloudZoneUpper = MathMax(iLCMa, iHCMa);
|
|
double iCloudZoneLower = MathMin(iLCMa, iHCMa);
|
|
|
|
//
|
|
bool isICloudZoneUpperBullish =
|
|
iCloudZoneUpper == iLCMa
|
|
? isLCMaBullish
|
|
: isHCMaBullish;
|
|
bool isICloudZoneLowerBullish =
|
|
iCloudZoneLower == iLCMa
|
|
? isLCMaBullish
|
|
: isHCMaBullish;
|
|
|
|
//
|
|
bool isICloudZoneUpperBearish =
|
|
iCloudZoneUpper == iLCMa
|
|
? isLCMaBearish
|
|
: isHCMaBearish;
|
|
bool isICloudZoneLowerBearish =
|
|
iCloudZoneLower == iLCMa
|
|
? isLCMaBearish
|
|
: isHCMaBearish;
|
|
|
|
//
|
|
double iPCloudZoneUpper = MathMax(iPLCMa, iPHCMa);
|
|
double iPCloudZoneLower = MathMin(iPLCMa, iPHCMa);
|
|
|
|
//
|
|
bool isIPCloudZoneUpperBullish =
|
|
iPCloudZoneUpper == iPLCMa
|
|
? isPLCMaBullish
|
|
: isPHCMaBullish;
|
|
bool isIPCloudZoneLowerBullish =
|
|
iPCloudZoneLower == iPLCMa
|
|
? isPLCMaBullish
|
|
: isPHCMaBullish;
|
|
|
|
//
|
|
bool isIPCloudZoneUpperBearish =
|
|
iPCloudZoneUpper == iPLCMa
|
|
? isPLCMaBearish
|
|
: isPHCMaBearish;
|
|
bool isIPCloudZoneLowerBearish =
|
|
iPCloudZoneLower == iPLCMa
|
|
? isPLCMaBearish
|
|
: isPHCMaBearish;
|
|
|
|
//
|
|
double iPressureZoneUpper = MathMax(iSCMa, iMCMa);
|
|
double iPressureZoneLower = MathMin(iSCMa, iMCMa);
|
|
|
|
//
|
|
bool isIPressureZoneUpperBullish =
|
|
iPressureZoneUpper == iSCMa
|
|
? isSCMaBullish
|
|
: isMCMaBullish;
|
|
bool isIPressureZoneLowerBullish =
|
|
iPressureZoneLower == iSCMa
|
|
? isSCMaBullish
|
|
: isMCMaBullish;
|
|
|
|
//
|
|
bool isIPressureZoneUpperBearish =
|
|
iPressureZoneUpper == iSCMa
|
|
? isSCMaBearish
|
|
: isMCMaBearish;
|
|
bool isIPressureZoneLowerBearish =
|
|
iPressureZoneLower == iSCMa
|
|
? isSCMaBearish
|
|
: isMCMaBearish;
|
|
|
|
//
|
|
double iPPressureZoneUpper = MathMax(iPSCMa, iPMCMa);
|
|
double iPPressureZoneLower = MathMin(iPSCMa, iPMCMa);
|
|
|
|
//
|
|
bool isIPPressureZoneUpperBullish =
|
|
iPPressureZoneUpper == iPSCMa
|
|
? isPSCMaBullish
|
|
: isPMCMaBullish;
|
|
bool isIPPressureZoneLowerBullish =
|
|
iPPressureZoneLower == iPSCMa
|
|
? isPSCMaBullish
|
|
: isPMCMaBullish;
|
|
|
|
//
|
|
bool isIPPressureZoneUpperBearish =
|
|
iPPressureZoneUpper == iPSCMa
|
|
? isPSCMaBearish
|
|
: isPMCMaBearish;
|
|
bool isIPPressureZoneLowerBearish =
|
|
iPPressureZoneLower == iPSCMa
|
|
? isPSCMaBearish
|
|
: isPMCMaBearish;
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool isBullishPriceInsideCloudZone =
|
|
iLow < iCloudZoneUpper &&
|
|
iLow > iCloudZoneLower;
|
|
|
|
//
|
|
bool isPBullishPriceInsideCloudZone =
|
|
iPLow < iPCloudZoneUpper &&
|
|
iPLow > iPCloudZoneLower;
|
|
|
|
//
|
|
bool isBearishPriceInsideCloudZone =
|
|
iHigh > iCloudZoneLower &&
|
|
iHigh < iCloudZoneUpper;
|
|
|
|
//
|
|
bool isPBearishPriceInsideCloudZone =
|
|
iPHigh > iPCloudZoneLower &&
|
|
iPHigh < iPCloudZoneUpper;
|
|
|
|
//
|
|
bool isPriceBullishCrossedInsideCloudZone =
|
|
isBullishPriceInsideCloudZone &&
|
|
!isPBullishPriceInsideCloudZone;
|
|
|
|
//
|
|
bool isPriceBearishCrossedInsideCloudZone =
|
|
isBearishPriceInsideCloudZone &&
|
|
!isPBearishPriceInsideCloudZone;
|
|
|
|
//
|
|
bool hasBullishPressure =
|
|
iLow > iPressureZoneUpper;
|
|
|
|
//
|
|
bool hasBearishPressure =
|
|
iHigh < iPressureZoneLower;
|
|
|
|
//
|
|
// Detect Cloud Direction ...
|
|
|
|
//
|
|
bool isBullish =
|
|
hasBullishPressure &&
|
|
isBullishPriceInsideCloudZone;
|
|
|
|
//
|
|
bool isBearish =
|
|
hasBearishPressure &&
|
|
isBearishPriceInsideCloudZone;
|
|
|
|
//
|
|
has = isBullish ||
|
|
isBearish;
|
|
|
|
//
|
|
// Draw Inside Zone Arrow ...
|
|
if (has)
|
|
{
|
|
//
|
|
int arrowWidth = 3;
|
|
int arrowCode = 159;
|
|
ENUM_ARROW_ANCHOR arrowAnchor =
|
|
isBullish
|
|
? ANCHOR_BOTTOM
|
|
: ANCHOR_TOP;
|
|
color arrowColor =
|
|
isBullish
|
|
? mDrawer.defaultBullishStyle.clr
|
|
: mDrawer.defaultBearishStyle.clr;
|
|
ENUM_X_PRICE arrowPriceType =
|
|
isBullish
|
|
? X_PRICE_LOW
|
|
: X_PRICE_HIGH;
|
|
|
|
//
|
|
XCBarArrowObject *iObj;
|
|
has = mDrawer.DrawBarArrow(
|
|
iBar,
|
|
iObj,
|
|
arrowPriceType,
|
|
arrowCode,
|
|
arrowColor,
|
|
arrowWidth,
|
|
arrowAnchor //
|
|
);
|
|
if (has)
|
|
{
|
|
mObjects.Add(iObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Cleanup Resources ...
|
|
|
|
//
|
|
iBar.Clean();
|
|
}
|
|
|
|
//
|
|
void ReadBarStyle()
|
|
{
|
|
//
|
|
long chartId = ChartID();
|
|
|
|
//
|
|
_upColor = GetChartUpColor(chartId);
|
|
_downColor = GetChartDownColor(chartId);
|
|
_lineColor = GetChartLineColor(chartId);
|
|
_bullishColor = GetChartBullishColor(chartId);
|
|
_bearishColor = GetChartBearishColor(chartId);
|
|
}
|
|
|
|
//
|
|
void ShowBars()
|
|
{
|
|
//
|
|
long chartId = ChartID();
|
|
|
|
//
|
|
SetChartUpColor(_upColor, chartId);
|
|
SetChartDownColor(_downColor, chartId);
|
|
SetChartLineColor(_lineColor, chartId);
|
|
SetChartBullishColor(_bullishColor, chartId);
|
|
SetChartBearishColor(_bearishColor, chartId);
|
|
}
|
|
|
|
//
|
|
void HideBars()
|
|
{
|
|
//
|
|
long chartId = ChartID();
|
|
|
|
//
|
|
SetChartUpColor(CLR_NONE, chartId);
|
|
SetChartDownColor(CLR_NONE, chartId);
|
|
SetChartLineColor(CLR_NONE, chartId);
|
|
SetChartBullishColor(CLR_NONE, chartId);
|
|
SetChartBearishColor(CLR_NONE, chartId);
|
|
}
|
|
|
|
// |