add all required indicator and oscillators and also add all helper classes for them ...

This commit is contained in:
2024-05-18 22:46:22 +03:30
parent e69dc85eea
commit 2777f56d78
13 changed files with 5583 additions and 125 deletions
+37 -44
View File
@@ -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;
}
//