last works and apply fix on ZigZag Reading ...
This commit is contained in:
@@ -83,6 +83,7 @@ input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
|
||||
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||
input int maFastLength = 7; // Fast MA Length
|
||||
input int maSlowLength = 20; // Slow MA Length
|
||||
input int maBandLength = 7; // MA Band Length
|
||||
input int zigzagDepth = 12; // ZigZag Depth
|
||||
input int zigzagDeviation = 5; // ZigZag Deviation
|
||||
input int zigzagBackStep = 3; // ZigZag Back Step
|
||||
@@ -96,6 +97,7 @@ input bool showPV = true; // Show PV
|
||||
input bool showSAR = true; // Show Sar
|
||||
input bool showMAFast = true; // Show MA Fast
|
||||
input bool showMASlow = true; // Show MA Slow
|
||||
input bool showMABand = true; // Show MA Band
|
||||
input bool showZigZag = true; // Show ZigZag
|
||||
input bool showFiboZone = true; // Show Fibo Zone
|
||||
|
||||
@@ -131,8 +133,8 @@ input int valeArrowCode = 159; // Vales Arrow Code
|
||||
#property indicator_chart_window
|
||||
|
||||
//
|
||||
#property indicator_buffers 27
|
||||
#property indicator_plots 9
|
||||
#property indicator_buffers 29
|
||||
#property indicator_plots 11
|
||||
|
||||
//
|
||||
// Plot Buffers ...
|
||||
@@ -275,11 +277,39 @@ double zigzagBuffer[];
|
||||
#property indicator_color9 clrYellow
|
||||
#property indicator_width9 2
|
||||
|
||||
//
|
||||
// MA Upper Boundary ...
|
||||
|
||||
//
|
||||
#define maUpperBufferIndex 12
|
||||
#define maUpperBufferPlotIndex 9
|
||||
double maUpperBuffer[];
|
||||
|
||||
//
|
||||
#property indicator_label10 "UpperMA"
|
||||
#property indicator_type10 DRAW_LINE
|
||||
#property indicator_color10 clrAqua
|
||||
#property indicator_width10 3
|
||||
|
||||
//
|
||||
// MA Lower Boundary ...
|
||||
|
||||
//
|
||||
#define maLowerBufferIndex 13
|
||||
#define maLowerBufferPlotIndex 10
|
||||
double maLowerBuffer[];
|
||||
|
||||
//
|
||||
#property indicator_label11 "LowerMA"
|
||||
#property indicator_type11 DRAW_LINE
|
||||
#property indicator_color11 clrMagenta
|
||||
#property indicator_width11 3
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
//
|
||||
#define mLastBufferIndex 11
|
||||
#define mLastBufferIndex 13
|
||||
|
||||
//
|
||||
// MA ...
|
||||
@@ -392,6 +422,8 @@ ENUM_TIMEFRAMES mHCPeriod = NULL;
|
||||
int sarHandler = INVALID_HANDLE;
|
||||
int maFastHandler = INVALID_HANDLE;
|
||||
int maSlowHandler = INVALID_HANDLE;
|
||||
int maUpperHandler = INVALID_HANDLE;
|
||||
int maLowerHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
int limit;
|
||||
@@ -503,6 +535,8 @@ void OnDeinit(const int reason)
|
||||
IndicatorRelease(sarHandler);
|
||||
IndicatorRelease(maFastHandler);
|
||||
IndicatorRelease(maSlowHandler);
|
||||
IndicatorRelease(maUpperHandler);
|
||||
IndicatorRelease(maLowerHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,6 +603,8 @@ int OnCalculate(
|
||||
// MA ...
|
||||
int maFastCalculatedBars = BarsCalculated(maFastHandler);
|
||||
int maSlowCalculatedBars = BarsCalculated(maSlowHandler);
|
||||
int maUpperCalculatedBars = BarsCalculated(maUpperHandler);
|
||||
int maLowerCalculatedBars = BarsCalculated(maLowerHandler);
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
@@ -580,6 +616,8 @@ int OnCalculate(
|
||||
// MA ...
|
||||
maFastCalculatedBars >= maxLength &&
|
||||
maSlowCalculatedBars >= maxLength &&
|
||||
maUpperCalculatedBars >= maxLength &&
|
||||
maLowerCalculatedBars >= maxLength &&
|
||||
//
|
||||
// SAR ...
|
||||
sarCalculatedBars >= maxLength
|
||||
@@ -602,6 +640,8 @@ int OnCalculate(
|
||||
// MA ...
|
||||
int copiedMAFasts = CopyBuffer(maFastHandler, MAIN_LINE, 0, limit, maFastBuffer);
|
||||
int copiedMASlows = CopyBuffer(maSlowHandler, MAIN_LINE, 0, limit, maSlowBuffer);
|
||||
int copiedMAUppers = CopyBuffer(maUpperHandler, MAIN_LINE, 0, limit, maUpperBuffer);
|
||||
int copiedMALowers = CopyBuffer(maLowerHandler, MAIN_LINE, 0, limit, maLowerBuffer);
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
@@ -614,6 +654,8 @@ int OnCalculate(
|
||||
// MA ...
|
||||
copiedMAFasts >= limit &&
|
||||
copiedMASlows >= limit &&
|
||||
copiedMAUppers >= limit &&
|
||||
copiedMALowers >= limit &&
|
||||
//
|
||||
// SAR ...
|
||||
copiedSARs >= limit
|
||||
@@ -675,6 +717,7 @@ bool ValidateInputs()
|
||||
// MA ...
|
||||
maFastLength >= 2 &&
|
||||
maSlowLength >= 2 &&
|
||||
maBandLength >= 2 &&
|
||||
maSlowLength > maFastLength &&
|
||||
//
|
||||
// SAR ...
|
||||
@@ -721,6 +764,7 @@ int ExtractMaxLengthOfInputs()
|
||||
result = MathMax(result, mHCLength);
|
||||
result = MathMax(result, maFastLength);
|
||||
result = MathMax(result, maSlowLength);
|
||||
result = MathMax(result, maBandLength);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -877,6 +921,40 @@ void DefineBuffers()
|
||||
PlotIndexSetInteger(zigzagBufferPlotIndex, PLOT_DRAW_BEGIN, 0);
|
||||
PlotIndexSetDouble(zigzagBufferPlotIndex, PLOT_EMPTY_VALUE, 0);
|
||||
|
||||
//
|
||||
// MA Band ...
|
||||
|
||||
//
|
||||
ENUM_DRAW_TYPE maBandDrawType = showMABand ? DRAW_LINE : DRAW_NONE;
|
||||
|
||||
//
|
||||
// MA Upper Band ...
|
||||
|
||||
//
|
||||
ArraySetAsSeries(maUpperBuffer, true);
|
||||
SetIndexBuffer(maUpperBufferIndex, maUpperBuffer, INDICATOR_DATA);
|
||||
|
||||
//
|
||||
PlotIndexSetInteger(maUpperBufferPlotIndex, PLOT_SHOW_DATA, showMABand);
|
||||
PlotIndexSetInteger(maUpperBufferPlotIndex, PLOT_DRAW_TYPE, maBandDrawType);
|
||||
|
||||
PlotIndexSetInteger(maUpperBufferPlotIndex, PLOT_DRAW_BEGIN, 0);
|
||||
PlotIndexSetDouble(maUpperBufferPlotIndex, PLOT_EMPTY_VALUE, 0);
|
||||
|
||||
//
|
||||
// MA Lower Band ...
|
||||
|
||||
//
|
||||
ArraySetAsSeries(maLowerBuffer, true);
|
||||
SetIndexBuffer(maLowerBufferIndex, maLowerBuffer, INDICATOR_DATA);
|
||||
|
||||
//
|
||||
PlotIndexSetInteger(maLowerBufferPlotIndex, PLOT_SHOW_DATA, showMABand);
|
||||
PlotIndexSetInteger(maLowerBufferPlotIndex, PLOT_DRAW_TYPE, maBandDrawType);
|
||||
|
||||
PlotIndexSetInteger(maLowerBufferPlotIndex, PLOT_DRAW_BEGIN, 0);
|
||||
PlotIndexSetDouble(maLowerBufferPlotIndex, PLOT_EMPTY_VALUE, 0);
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
@@ -1097,6 +1175,38 @@ bool InitRequirements()
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// MA Band Upper ...
|
||||
maUpperHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
maBandLength,
|
||||
0,
|
||||
maMethod,
|
||||
PRICE_HIGH //
|
||||
);
|
||||
result = maUpperHandler != INVALID_HANDLE;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// MA Band Lower ...
|
||||
maLowerHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
maBandLength,
|
||||
0,
|
||||
maMethod,
|
||||
PRICE_LOW //
|
||||
);
|
||||
result = maLowerHandler != INVALID_HANDLE;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
sarHandler = iSAR(
|
||||
|
||||
Reference in New Issue
Block a user