692 lines
18 KiB
Plaintext
692 lines
18 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Indicator
|
|
// -------------------------------------------------
|
|
// Name: X121 XDON
|
|
// Description: XDON ...
|
|
//
|
|
//
|
|
// 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 XDON Indicator"
|
|
#property strict
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
#define ShortName "X121 XDON"
|
|
|
|
//
|
|
// Includes Common Library ...
|
|
#include "../Libraries/x-saherelm.common.lib.mq5"
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
// Market ...
|
|
input group "Market";
|
|
input int donchainLength = 40; // Donchain Length
|
|
|
|
//
|
|
// Presentation ...
|
|
input group "Presentation";
|
|
|
|
//
|
|
input int startCalculationForLastBars = 1000; // Calculate Last n Bars
|
|
|
|
//
|
|
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
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
#define hideColorIDX 0
|
|
#define bullishColorIDX 1
|
|
#define bearishColorIDX 2
|
|
#define neuturalColorIDX 3
|
|
|
|
//
|
|
#property indicator_chart_window
|
|
|
|
//
|
|
#property indicator_buffers 8
|
|
#property indicator_plots 8
|
|
|
|
//
|
|
// Plot Buffers ...
|
|
|
|
//
|
|
// Open ...
|
|
|
|
//
|
|
#define donOpenUpperBufferIndex 0
|
|
double donOpenUpperBuffer[];
|
|
|
|
//
|
|
#define donOpenUpperPlotBufferIndex 0
|
|
#property indicator_label1 "X121 O U"
|
|
#property indicator_type1 DRAW_LINE
|
|
#property indicator_color1 clrCornflowerBlue
|
|
#property indicator_width1 1
|
|
|
|
//
|
|
#define donOpenLowerBufferIndex 1
|
|
double donOpenLowerBuffer[];
|
|
|
|
//
|
|
#define donOpenLowerPlotBufferIndex 1
|
|
#property indicator_label2 "X121 O L"
|
|
#property indicator_type2 DRAW_LINE
|
|
#property indicator_color2 clrCornflowerBlue
|
|
#property indicator_width2 1
|
|
|
|
//
|
|
// High ...
|
|
|
|
//
|
|
#define donHighUpperBufferIndex 2
|
|
double donHighUpperBuffer[];
|
|
|
|
//
|
|
#define donHighUpperPlotBufferIndex 2
|
|
#property indicator_label3 "X121 H U"
|
|
#property indicator_type3 DRAW_LINE
|
|
#property indicator_color3 clrAquamarine
|
|
#property indicator_width3 1
|
|
|
|
//
|
|
#define donHighLowerBufferIndex 3
|
|
double donHighLowerBuffer[];
|
|
|
|
//
|
|
#define donHighLowerPlotBufferIndex 3
|
|
#property indicator_label4 "X121 H L"
|
|
#property indicator_type4 DRAW_LINE
|
|
#property indicator_color4 clrAquamarine
|
|
#property indicator_width4 1
|
|
|
|
//
|
|
// Low ...
|
|
|
|
//
|
|
#define donLowUpperBufferIndex 4
|
|
double donLowUpperBuffer[];
|
|
|
|
//
|
|
#define donLowUpperPlotBufferIndex 4
|
|
#property indicator_label5 "X121 L U"
|
|
#property indicator_type5 DRAW_LINE
|
|
#property indicator_color5 clrDarkOrchid
|
|
#property indicator_width5 1
|
|
|
|
//
|
|
#define donLowLowerBufferIndex 5
|
|
double donLowLowerBuffer[];
|
|
|
|
//
|
|
#define donLowLowerPlotBufferIndex 5
|
|
#property indicator_label6 "X121 L L"
|
|
#property indicator_type6 DRAW_LINE
|
|
#property indicator_color6 clrDarkOrchid
|
|
#property indicator_width6 1
|
|
|
|
//
|
|
// Close ...
|
|
|
|
//
|
|
#define donCloseUpperBufferIndex 6
|
|
double donCloseUpperBuffer[];
|
|
|
|
//
|
|
#define donCloseUpperPlotBufferIndex 6
|
|
#property indicator_label7 "X121 C U"
|
|
#property indicator_type7 DRAW_LINE
|
|
#property indicator_color7 clrCoral
|
|
#property indicator_width7 1
|
|
|
|
//
|
|
#define donCloseLowerBufferIndex 7
|
|
double donCloseLowerBuffer[];
|
|
|
|
//
|
|
#define donCloseLowerPlotBufferIndex 7
|
|
#property indicator_label8 "X121 C L"
|
|
#property indicator_type8 DRAW_LINE
|
|
#property indicator_color8 clrCoral
|
|
#property indicator_width8 1
|
|
|
|
//
|
|
// Data Buffers ...
|
|
|
|
//
|
|
int mLastBufferIndex = 7;
|
|
|
|
//
|
|
// Variables, Properties and etc ...
|
|
|
|
//
|
|
// this counts Available Bars ...
|
|
int limit;
|
|
|
|
//
|
|
int maxLength;
|
|
|
|
//
|
|
// Event Handlers ...
|
|
|
|
/**
|
|
* Initialize Indicator ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int OnInit()
|
|
{
|
|
//
|
|
// Validate Inputs ...
|
|
if (!ValidateInputs())
|
|
{
|
|
return INIT_PARAMETERS_INCORRECT;
|
|
}
|
|
|
|
//
|
|
// Initialize Indicator Handlers ...
|
|
|
|
//
|
|
// 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;
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
}
|
|
|
|
/**
|
|
* 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 ...
|
|
|
|
//
|
|
limit = (prev_calculated > rates_total || prev_calculated <= 0)
|
|
? rates_total
|
|
: (rates_total - prev_calculated) + 1;
|
|
|
|
//
|
|
// Buffers Copy ...
|
|
|
|
//
|
|
// 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;
|
|
}
|
|
|
|
//
|
|
// Functions ...
|
|
|
|
/**
|
|
* Validate Input Args for Initialization ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool ValidateInputs()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
donchainLength > 0
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Extract Max Length of Inputs ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int ExtractMaxLengthOfInputs()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Define Required Buffers ...
|
|
*/
|
|
void DefineBuffers()
|
|
{
|
|
//
|
|
// Plot Buffers ...
|
|
//
|
|
// Open ...
|
|
|
|
//
|
|
// UPPER ...
|
|
bool canShowCOpenUpper = showUpper && showOpen;
|
|
ENUM_DRAW_TYPE donOpenUpperDrawType = canShowCOpenUpper ? DRAW_LINE : DRAW_NONE;
|
|
ArraySetAsSeries(donOpenUpperBuffer, true);
|
|
SetIndexBuffer(donOpenUpperBufferIndex, donOpenUpperBuffer, INDICATOR_DATA);
|
|
PlotIndexSetDouble(donOpenUpperPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
|
PlotIndexSetInteger(donOpenUpperPlotBufferIndex, PLOT_SHOW_DATA, canShowCOpenUpper);
|
|
PlotIndexSetInteger(donOpenUpperPlotBufferIndex, PLOT_DRAW_TYPE, donOpenUpperDrawType);
|
|
|
|
//
|
|
// LOWER ...
|
|
bool canShowCOpenLower = showLower && showOpen;
|
|
ENUM_DRAW_TYPE donOpenLowerDrawType = canShowCOpenLower ? DRAW_LINE : DRAW_NONE;
|
|
ArraySetAsSeries(donOpenLowerBuffer, true);
|
|
SetIndexBuffer(donOpenLowerBufferIndex, donOpenLowerBuffer, INDICATOR_DATA);
|
|
PlotIndexSetDouble(donOpenLowerPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
|
PlotIndexSetInteger(donOpenLowerPlotBufferIndex, PLOT_SHOW_DATA, canShowCOpenLower);
|
|
PlotIndexSetInteger(donOpenLowerPlotBufferIndex, PLOT_DRAW_TYPE, donOpenLowerDrawType);
|
|
|
|
//
|
|
// Close ...
|
|
|
|
//
|
|
// UPPER ...
|
|
bool canShowCCloseUpper = showUpper && showClose;
|
|
ENUM_DRAW_TYPE donCloseUpperDrawType = canShowCCloseUpper ? DRAW_LINE : DRAW_NONE;
|
|
ArraySetAsSeries(donCloseUpperBuffer, true);
|
|
SetIndexBuffer(donCloseUpperBufferIndex, donCloseUpperBuffer, INDICATOR_DATA);
|
|
PlotIndexSetDouble(donCloseUpperPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
|
PlotIndexSetInteger(donCloseUpperPlotBufferIndex, PLOT_SHOW_DATA, canShowCCloseUpper);
|
|
PlotIndexSetInteger(donCloseUpperPlotBufferIndex, PLOT_DRAW_TYPE, donCloseUpperDrawType);
|
|
|
|
//
|
|
// LOWER ...
|
|
bool canShowCCloseLower = showLower && showClose;
|
|
ENUM_DRAW_TYPE donCloseLowerDrawType = canShowCCloseLower ? DRAW_LINE : DRAW_NONE;
|
|
ArraySetAsSeries(donCloseLowerBuffer, true);
|
|
SetIndexBuffer(donCloseLowerBufferIndex, donCloseLowerBuffer, INDICATOR_DATA);
|
|
PlotIndexSetDouble(donCloseLowerPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
|
PlotIndexSetInteger(donCloseLowerPlotBufferIndex, PLOT_SHOW_DATA, canShowCCloseLower);
|
|
PlotIndexSetInteger(donCloseLowerPlotBufferIndex, PLOT_DRAW_TYPE, donCloseLowerDrawType);
|
|
|
|
//
|
|
// High ...
|
|
|
|
//
|
|
// UPPER ...
|
|
bool canShowCHighUpper = showUpper && showHigh;
|
|
ENUM_DRAW_TYPE donHighUpperDrawType = canShowCHighUpper ? DRAW_LINE : DRAW_NONE;
|
|
ArraySetAsSeries(donHighUpperBuffer, true);
|
|
SetIndexBuffer(donHighUpperBufferIndex, donHighUpperBuffer, INDICATOR_DATA);
|
|
PlotIndexSetDouble(donHighUpperPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
|
PlotIndexSetInteger(donHighUpperPlotBufferIndex, PLOT_SHOW_DATA, canShowCHighUpper);
|
|
PlotIndexSetInteger(donHighUpperPlotBufferIndex, PLOT_DRAW_TYPE, donHighUpperDrawType);
|
|
|
|
//
|
|
// LOWER ...
|
|
bool canShowCHighLower = showLower && showHigh;
|
|
ENUM_DRAW_TYPE donHighLowerDrawType = canShowCHighLower ? DRAW_LINE : DRAW_NONE;
|
|
ArraySetAsSeries(donHighLowerBuffer, true);
|
|
SetIndexBuffer(donHighLowerBufferIndex, donHighLowerBuffer, INDICATOR_DATA);
|
|
PlotIndexSetDouble(donHighLowerPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
|
PlotIndexSetInteger(donHighLowerPlotBufferIndex, PLOT_SHOW_DATA, canShowCHighLower);
|
|
PlotIndexSetInteger(donHighLowerPlotBufferIndex, PLOT_DRAW_TYPE, donHighLowerDrawType);
|
|
|
|
//
|
|
// Low ...
|
|
|
|
//
|
|
// UPPER ...
|
|
bool canShowCLowUpper = showUpper && showLow;
|
|
ENUM_DRAW_TYPE donLowUpperDrawType = canShowCLowUpper ? DRAW_LINE : DRAW_NONE;
|
|
ArraySetAsSeries(donLowUpperBuffer, true);
|
|
SetIndexBuffer(donLowUpperBufferIndex, donLowUpperBuffer, INDICATOR_DATA);
|
|
PlotIndexSetDouble(donLowUpperPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
|
PlotIndexSetInteger(donLowUpperPlotBufferIndex, PLOT_SHOW_DATA, canShowCLowUpper);
|
|
PlotIndexSetInteger(donLowUpperPlotBufferIndex, PLOT_DRAW_TYPE, donLowUpperDrawType);
|
|
|
|
//
|
|
// LOWER ...
|
|
bool canShowCLowLower = showLower && showLow;
|
|
ENUM_DRAW_TYPE donLowLowerDrawType = canShowCLowLower ? DRAW_LINE : DRAW_NONE;
|
|
ArraySetAsSeries(donLowLowerBuffer, true);
|
|
SetIndexBuffer(donLowLowerBufferIndex, donLowLowerBuffer, INDICATOR_DATA);
|
|
PlotIndexSetDouble(donLowLowerPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
|
PlotIndexSetInteger(donLowLowerPlotBufferIndex, PLOT_SHOW_DATA, canShowCLowLower);
|
|
PlotIndexSetInteger(donLowLowerPlotBufferIndex, PLOT_DRAW_TYPE, donLowLowerDrawType);
|
|
|
|
//
|
|
// Data Buffers ...
|
|
}
|
|
|
|
/**
|
|
* Set Indicator Short Name and also we can define Buffers Labels ...
|
|
*/
|
|
void SetIndicatorName()
|
|
{
|
|
IndicatorSetString(INDICATOR_SHORTNAME, ShortName);
|
|
}
|
|
|
|
/**
|
|
* Calculate Custom Buffers ...
|
|
*
|
|
* @param bar_index: 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 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 barsLimit = startCalculationForLastBars > 0
|
|
? startCalculationForLastBars
|
|
: 0;
|
|
//
|
|
// bool canCalculate = true;
|
|
bool canCalculate =
|
|
barsLimit == 0 ||
|
|
bar_index <= barsLimit;
|
|
if (canCalculate)
|
|
{
|
|
//
|
|
CalculateDonchains(
|
|
bar_index,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume //
|
|
);
|
|
}
|
|
else
|
|
{
|
|
FillBuffersZero(bar_index);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Custom ...
|
|
|
|
/**
|
|
* Fill All Bufers to Zero Vlue for Specified Bar Index ...
|
|
*
|
|
* @param barIndex: Integer ...
|
|
*/
|
|
void FillBuffersZero(int barIndex)
|
|
{
|
|
//
|
|
donOpenUpperBuffer[barIndex] = EMPTY_VALUE;
|
|
donOpenLowerBuffer[barIndex] = EMPTY_VALUE;
|
|
donCloseUpperBuffer[barIndex] = EMPTY_VALUE;
|
|
donCloseLowerBuffer[barIndex] = EMPTY_VALUE;
|
|
donHighUpperBuffer[barIndex] = EMPTY_VALUE;
|
|
donHighLowerBuffer[barIndex] = EMPTY_VALUE;
|
|
donLowUpperBuffer[barIndex] = EMPTY_VALUE;
|
|
donLowLowerBuffer[barIndex] = EMPTY_VALUE;
|
|
}
|
|
|
|
/**
|
|
* Calculate Donchain ...
|
|
*
|
|
* @param bar_index: Integer, Bar Index ...
|
|
* @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 ...
|
|
* @param _length: Integer, Donchain Length ...
|
|
* @param _ouBuffer: Double Array Reference ...
|
|
* @param _olBuffer: Double Array Reference ...
|
|
* @param _huBuffer: Double Array Reference ...
|
|
* @param _hlBuffer: Double Array Reference ...
|
|
* @param _luBuffer: Double Array Reference ...
|
|
* @param _llBuffer: Double Array Reference ...
|
|
* @param _cuBuffer: Double Array Reference ...
|
|
* @param _clBuffer: Double Array Reference ...
|
|
*/
|
|
void CalculateDonchain(
|
|
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 ...
|
|
|
|
//
|
|
int from = bar_index;
|
|
|
|
//
|
|
iUpper = open[ArrayMaximum(open, from, _length)];
|
|
iLower = open[ArrayMinimum(open, from, _length)];
|
|
|
|
//
|
|
_ouBuffer[bar_index] = iUpper;
|
|
_olBuffer[bar_index] = iLower;
|
|
|
|
//
|
|
// HIGH ...
|
|
|
|
//
|
|
iUpper = high[ArrayMaximum(high, from, _length)];
|
|
iLower = high[ArrayMinimum(high, from, _length)];
|
|
|
|
//
|
|
_huBuffer[bar_index] = iUpper;
|
|
_hlBuffer[bar_index] = iLower;
|
|
|
|
//
|
|
// LOW ...
|
|
|
|
//
|
|
iUpper = low[ArrayMaximum(low, from, _length)];
|
|
iLower = low[ArrayMinimum(low, from, _length)];
|
|
|
|
//
|
|
_luBuffer[bar_index] = iUpper;
|
|
_llBuffer[bar_index] = iLower;
|
|
|
|
//
|
|
// CLOSE ...
|
|
|
|
//
|
|
iUpper = close[ArrayMaximum(close, from, _length)];
|
|
iLower = close[ArrayMinimum(close, from, _length)];
|
|
|
|
//
|
|
_cuBuffer[bar_index] = iUpper;
|
|
_clBuffer[bar_index] = iLower;
|
|
}
|
|
|
|
/**
|
|
* Calculate Different VWaps ...
|
|
*
|
|
* @param bar_index: 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 CalculateDonchains(
|
|
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[] //
|
|
)
|
|
{
|
|
//
|
|
CalculateDonchain(
|
|
//
|
|
bar_index,
|
|
prevCalculated,
|
|
ratesTotal,
|
|
//
|
|
open,
|
|
high,
|
|
close,
|
|
low,
|
|
tickVolume,
|
|
//
|
|
donchainLength,
|
|
//
|
|
donOpenUpperBuffer,
|
|
donOpenLowerBuffer,
|
|
donHighUpperBuffer,
|
|
donHighLowerBuffer,
|
|
donLowUpperBuffer,
|
|
donLowLowerBuffer,
|
|
donCloseUpperBuffer,
|
|
donCloseLowerBuffer //
|
|
);
|
|
}
|
|
|
|
// |