add all required indicator and oscillators and also add all helper classes for them ...
This commit is contained in:
@@ -24,9 +24,17 @@
|
||||
// INPUT ...
|
||||
|
||||
//
|
||||
input group "Market";
|
||||
input int length = 52; // Market Length
|
||||
input double offset = 0; // Offset
|
||||
|
||||
//
|
||||
input group "Presentation";
|
||||
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 ...
|
||||
|
||||
@@ -164,36 +172,17 @@ void OnDeinit(const int reason)
|
||||
//
|
||||
// Calculating what we want ...
|
||||
int OnCalculate(
|
||||
//
|
||||
// total Candles on chart ...
|
||||
const int rates_total,
|
||||
//
|
||||
// total calculated Candles on charts ...
|
||||
const int prev_calculated,
|
||||
//
|
||||
// history of Candles Open Time ...
|
||||
const datetime &time[],
|
||||
//
|
||||
// history of Candles Open Price ...
|
||||
const double &open[],
|
||||
//
|
||||
// history of Candles High Price ...
|
||||
const double &high[],
|
||||
//
|
||||
// history of Candles Low Price ...
|
||||
const double &low[],
|
||||
//
|
||||
// history of Candles Close Price ...
|
||||
const double &close[],
|
||||
//
|
||||
// history of Tick Volumes on Candle ...
|
||||
const long &tick_volume[],
|
||||
//
|
||||
// history of Trade Volumes ...
|
||||
const long &volume[],
|
||||
//
|
||||
// history of Candles Spread Price ...
|
||||
const int &spread[])
|
||||
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 < length - 1)
|
||||
@@ -298,63 +287,75 @@ void DefineBuffers()
|
||||
{
|
||||
//
|
||||
// Open ...
|
||||
ENUM_DRAW_TYPE openDrawType = showOpen ? DRAW_LINE : DRAW_NONE;
|
||||
|
||||
//
|
||||
// UPPER ...
|
||||
SetIndexBuffer(upperOBufferIndex, upperOBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(upperOBufferIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(upperOBufferIndex, PLOT_SHOW_DATA, showOpen);
|
||||
PlotIndexSetDouble(upperOBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(upperOBufferIndex, PLOT_DRAW_TYPE, openDrawType);
|
||||
|
||||
//
|
||||
// LOWER ...
|
||||
SetIndexBuffer(lowerOBufferIndex, lowerOBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(lowerOBufferIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(lowerOBufferIndex, PLOT_SHOW_DATA, showOpen);
|
||||
PlotIndexSetDouble(lowerOBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(lowerOBufferIndex, PLOT_DRAW_TYPE, openDrawType);
|
||||
|
||||
//
|
||||
// Close ...
|
||||
ENUM_DRAW_TYPE closeDrawType = showClose ? DRAW_LINE : DRAW_NONE;
|
||||
|
||||
//
|
||||
// UPPER ...
|
||||
SetIndexBuffer(upperCBufferIndex, upperCBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(upperCBufferIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(upperCBufferIndex, PLOT_SHOW_DATA, showClose);
|
||||
PlotIndexSetDouble(upperCBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(upperCBufferIndex, PLOT_DRAW_TYPE, closeDrawType);
|
||||
|
||||
//
|
||||
// LOWER ...
|
||||
SetIndexBuffer(lowerCBufferIndex, lowerCBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(lowerCBufferIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(lowerCBufferIndex, PLOT_SHOW_DATA, showClose);
|
||||
PlotIndexSetDouble(lowerCBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(lowerCBufferIndex, PLOT_DRAW_TYPE, closeDrawType);
|
||||
|
||||
//
|
||||
// High ...
|
||||
ENUM_DRAW_TYPE highDrawType = showHigh ? DRAW_LINE : DRAW_NONE;
|
||||
|
||||
//
|
||||
// UPPER ...
|
||||
SetIndexBuffer(upperHBufferIndex, upperHBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(upperHBufferIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(upperHBufferIndex, PLOT_SHOW_DATA, showHigh);
|
||||
PlotIndexSetDouble(upperHBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(upperHBufferIndex, PLOT_DRAW_TYPE, highDrawType);
|
||||
|
||||
//
|
||||
// LOWER ...
|
||||
SetIndexBuffer(lowerHBufferIndex, lowerHBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(lowerHBufferIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(lowerHBufferIndex, PLOT_SHOW_DATA, showHigh);
|
||||
PlotIndexSetDouble(lowerHBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(lowerHBufferIndex, PLOT_DRAW_TYPE, highDrawType);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
ENUM_DRAW_TYPE lowDrawType = showLow ? DRAW_LINE : DRAW_NONE;
|
||||
|
||||
//
|
||||
// UPPER ...
|
||||
SetIndexBuffer(upperLBufferIndex, upperLBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(upperLBufferIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(upperLBufferIndex, PLOT_SHOW_DATA, showLow);
|
||||
PlotIndexSetDouble(upperLBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(upperLBufferIndex, PLOT_DRAW_TYPE, lowDrawType);
|
||||
|
||||
//
|
||||
// LOWER ...
|
||||
SetIndexBuffer(lowerLBufferIndex, lowerLBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(lowerLBufferIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(lowerLBufferIndex, PLOT_SHOW_DATA, showLow);
|
||||
PlotIndexSetDouble(lowerLBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(lowerLBufferIndex, PLOT_DRAW_TYPE, lowDrawType);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -378,36 +378,17 @@ void OnDeinit(const int reason)
|
||||
//
|
||||
// Calculating what we want ...
|
||||
int OnCalculate(
|
||||
//
|
||||
// total Candles on chart ...
|
||||
const int rates_total,
|
||||
//
|
||||
// total calculated Candles on charts ...
|
||||
const int prev_calculated,
|
||||
//
|
||||
// history of Candles Open Time ...
|
||||
const datetime &time[],
|
||||
//
|
||||
// history of Candles Open Price ...
|
||||
const double &open[],
|
||||
//
|
||||
// history of Candles High Price ...
|
||||
const double &high[],
|
||||
//
|
||||
// history of Candles Low Price ...
|
||||
const double &low[],
|
||||
//
|
||||
// history of Candles Close Price ...
|
||||
const double &close[],
|
||||
//
|
||||
// history of Tick Volumes on Candle ...
|
||||
const long &tick_volume[],
|
||||
//
|
||||
// history of Trade Volumes ...
|
||||
const long &volume[],
|
||||
//
|
||||
// history of Candles Spread Price ...
|
||||
const int &spread[])
|
||||
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 ...
|
||||
)
|
||||
{
|
||||
//
|
||||
// this counts Available Bars ...
|
||||
|
||||
@@ -44,11 +44,17 @@ enum ENUM_X_ZG_PRICE_MODE
|
||||
// INPUT ...
|
||||
|
||||
//
|
||||
input group "Market";
|
||||
input int depth = 12; // Depth
|
||||
input int deviation = 5; // Deviation
|
||||
input int backStep = 3; // Back Step
|
||||
input ENUM_X_ZG_PRICE_MODE mode = X_ZG_PRICE_HIGH_LOW_MODE; // Mode
|
||||
|
||||
//
|
||||
input group "Presentation";
|
||||
input bool showZigZag = true; // Show ZigZag
|
||||
input bool showPeaksAndVales = true; // Show Peaks and Vales
|
||||
|
||||
//
|
||||
// BUFFERS ...
|
||||
|
||||
@@ -56,8 +62,8 @@ input ENUM_X_ZG_PRICE_MODE mode = X_ZG_PRICE_HIGH_LOW_MODE; // Mode
|
||||
#property indicator_chart_window
|
||||
|
||||
//
|
||||
#property indicator_buffers 5
|
||||
#property indicator_plots 3
|
||||
#property indicator_buffers 6
|
||||
#property indicator_plots 4
|
||||
|
||||
//
|
||||
// ZigZag ...
|
||||
@@ -67,10 +73,13 @@ input ENUM_X_ZG_PRICE_MODE mode = X_ZG_PRICE_HIGH_LOW_MODE; // Mode
|
||||
#define mainBufferPlotIndex 0
|
||||
double mainBuffer[];
|
||||
|
||||
#define mainColorBufferIndex 1
|
||||
double mainColorBuffer[];
|
||||
|
||||
//
|
||||
#property indicator_label1 "XZG Main"
|
||||
#property indicator_type1 DRAW_SECTION
|
||||
#property indicator_color1 clrYellow
|
||||
#property indicator_type1 DRAW_COLOR_SECTION
|
||||
#property indicator_color1 CLR_NONE, clrRoyalBlue, clrSaddleBrown
|
||||
#property indicator_width1 2
|
||||
|
||||
//
|
||||
@@ -78,29 +87,29 @@ double mainBuffer[];
|
||||
|
||||
//
|
||||
// ZigZag Pointer or Line Indicator ...
|
||||
#define arrowBufferIndex 1
|
||||
#define arrowBufferIndex 2
|
||||
#define arrowBufferPlotIndex 1
|
||||
double arrowBuffer[];
|
||||
|
||||
//
|
||||
#define arrowColorBufferIndex 2
|
||||
#define arrowColorBufferIndex 3
|
||||
double arrowColorBuffer[];
|
||||
|
||||
//
|
||||
#property indicator_label2 "XZG PV"
|
||||
#property indicator_type2 DRAW_COLOR_ARROW
|
||||
#property indicator_color2 clrAqua, clrMagenta
|
||||
#property indicator_color2 CLR_NONE, clrAqua, clrMagenta
|
||||
#property indicator_width2 1
|
||||
|
||||
//
|
||||
#define highsBufferIndex 3
|
||||
#define highsBufferIndex 4
|
||||
double highsBuffer[];
|
||||
|
||||
//
|
||||
// Lows ...
|
||||
|
||||
//
|
||||
#define lowsBufferIndex 4
|
||||
#define lowsBufferIndex 5
|
||||
double lowsBuffer[];
|
||||
|
||||
//
|
||||
@@ -159,36 +168,16 @@ void OnDeinit(const int reason)
|
||||
//
|
||||
// Calculating what we want ...
|
||||
int OnCalculate(
|
||||
//
|
||||
// total Candles on chart ...
|
||||
const int rates_total,
|
||||
//
|
||||
// total calculated Candles on charts ...
|
||||
const int prev_calculated,
|
||||
//
|
||||
// history of Candles Open Time ...
|
||||
const datetime &time[],
|
||||
//
|
||||
// history of Candles Open Price ...
|
||||
const double &open[],
|
||||
//
|
||||
// history of Candles High Price ...
|
||||
const double &high[],
|
||||
//
|
||||
// history of Candles Low Price ...
|
||||
const double &low[],
|
||||
//
|
||||
// history of Candles Close Price ...
|
||||
const double &close[],
|
||||
//
|
||||
// history of Tick Volumes on Candle ...
|
||||
const long &tick_volume[],
|
||||
//
|
||||
// history of Trade Volumes ...
|
||||
const long &volume[],
|
||||
//
|
||||
// history of Candles Spread Price ...
|
||||
const int &spread[] //
|
||||
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 ...
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -278,9 +267,10 @@ void DefineBuffers()
|
||||
|
||||
//
|
||||
SetIndexBuffer(mainBufferIndex, mainBuffer, INDICATOR_DATA);
|
||||
SetIndexBuffer(mainColorBufferIndex, mainColorBuffer, INDICATOR_COLOR_INDEX);
|
||||
|
||||
//
|
||||
PlotIndexSetInteger(mainBufferPlotIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(mainBufferPlotIndex, PLOT_SHOW_DATA, showZigZag);
|
||||
PlotIndexSetInteger(mainBufferPlotIndex, PLOT_DRAW_BEGIN, 0);
|
||||
PlotIndexSetDouble(mainBufferPlotIndex, PLOT_EMPTY_VALUE, 0);
|
||||
|
||||
@@ -291,7 +281,7 @@ void DefineBuffers()
|
||||
SetIndexBuffer(arrowBufferIndex, arrowBuffer, INDICATOR_DATA);
|
||||
|
||||
//
|
||||
PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_SHOW_DATA, true);
|
||||
PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_SHOW_DATA, showPeaksAndVales);
|
||||
PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_DRAW_BEGIN, 0);
|
||||
PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_ARROW, 159);
|
||||
PlotIndexSetInteger(arrowBufferPlotIndex, PLOT_ARROW_SHIFT, 0);
|
||||
@@ -664,11 +654,14 @@ int CalcukateZigZag(
|
||||
//
|
||||
colorIDX =
|
||||
lastZigZagValue > iZigZagForColor
|
||||
? 0
|
||||
: lastZigZagValue < iZigZagForColor
|
||||
? 1
|
||||
: lastZigZagValue < iZigZagForColor
|
||||
? 2
|
||||
: colorIDX;
|
||||
arrowColorBuffer[shift] = colorIDX;
|
||||
|
||||
//
|
||||
mainColorBuffer[shift] = showZigZag ? colorIDX : 0;
|
||||
arrowColorBuffer[shift] = showPeaksAndVales ? colorIDX : 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user