|
|
|
@@ -18,6 +18,7 @@
|
|
|
|
|
#property link "https://saherelm.ir"
|
|
|
|
|
#property version "1.00"
|
|
|
|
|
#property description "SaherElm XFIMA Indicator"
|
|
|
|
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
|
|
|
|
#property strict
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
@@ -73,19 +74,20 @@ input ENUM_SERIESMODE lowerMode = MODE_LOW; // Vale Method
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Others ...
|
|
|
|
|
input ENUM_X_FIBO_LEVELS upperZoneLevel = X_FIBO_LEVEL_618; // Upper Zone Level
|
|
|
|
|
input ENUM_X_FIBO_LEVELS lowerZoneLevel = X_FIBO_LEVEL_382; // Lower Zone Level
|
|
|
|
|
input double sarStep = 0.02; // SAR Step
|
|
|
|
|
input double sarMax = 0.2; // SAR Maximum
|
|
|
|
|
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 zigzagDepth = 12; // ZigZag Depth
|
|
|
|
|
input int zigzagDeviation = 5; // ZigZag Deviation
|
|
|
|
|
input int zigzagBackStep = 3; // ZigZag Back Step
|
|
|
|
|
input ENUM_X_PRICE zigzagUppersMode = X_PRICE_HIGH; // ZigZag High Detect Mode
|
|
|
|
|
input ENUM_X_PRICE zigzagLowersMode = X_PRICE_LOW; // ZigZag Low Detect Mode
|
|
|
|
|
input ENUM_X_FIBO_LEVELS fiboUpperZoneLevel = X_FIBO_LEVEL_382; // Upper Zone Level
|
|
|
|
|
input ENUM_X_FIBO_LEVELS fiboMiddleZoneLevel = X_FIBO_LEVEL_500; // Upper Zone Level
|
|
|
|
|
input ENUM_X_FIBO_LEVELS fiboLowerZoneLevel = X_FIBO_LEVEL_618; // Lower Zone Level
|
|
|
|
|
input double sarStep = 0.02; // SAR Step
|
|
|
|
|
input double sarMax = 0.2; // SAR Maximum
|
|
|
|
|
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 zigzagDepth = 12; // ZigZag Depth
|
|
|
|
|
input int zigzagDeviation = 5; // ZigZag Deviation
|
|
|
|
|
input int zigzagBackStep = 3; // ZigZag Back Step
|
|
|
|
|
input ENUM_X_PRICE zigzagUppersMode = X_PRICE_HIGH; // ZigZag High Detect Mode
|
|
|
|
|
input ENUM_X_PRICE zigzagLowersMode = X_PRICE_LOW; // ZigZag Low Detect Mode
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Presentation ...
|
|
|
|
@@ -129,8 +131,8 @@ input int valeArrowCode = 159; // Vales Arrow Code
|
|
|
|
|
#property indicator_chart_window
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#property indicator_buffers 26
|
|
|
|
|
#property indicator_plots 8
|
|
|
|
|
#property indicator_buffers 27
|
|
|
|
|
#property indicator_plots 9
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Plot Buffers ...
|
|
|
|
@@ -150,8 +152,8 @@ double maFastColorBuffer[];
|
|
|
|
|
//
|
|
|
|
|
#property indicator_label1 "FastMA"
|
|
|
|
|
#property indicator_type1 DRAW_COLOR_LINE
|
|
|
|
|
#property indicator_color1 CLR_NONE, clrYellow, clrOrangeRed, clrGray
|
|
|
|
|
#property indicator_width1 2
|
|
|
|
|
#property indicator_color1 CLR_NONE, clrAquamarine, clrAquamarine, clrAquamarine // clrYellow, clrOrangeRed, clrGray
|
|
|
|
|
#property indicator_width1 3
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Slow MA ...
|
|
|
|
@@ -168,8 +170,8 @@ double maSlowColorBuffer[];
|
|
|
|
|
//
|
|
|
|
|
#property indicator_label2 "SlowMA"
|
|
|
|
|
#property indicator_type2 DRAW_COLOR_LINE
|
|
|
|
|
#property indicator_color2 CLR_NONE, clrLime, clrRed, clrGray
|
|
|
|
|
#property indicator_width2 2
|
|
|
|
|
#property indicator_color2 CLR_NONE, clrLightCoral, clrLightCoral, clrLightCoral // clrLime, clrRed, clrGray
|
|
|
|
|
#property indicator_width2 3
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// SAR ...
|
|
|
|
@@ -231,39 +233,53 @@ double fiboUpperBuffer[];
|
|
|
|
|
#property indicator_color6 clrAqua
|
|
|
|
|
#property indicator_width6 2
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// FIBO Middle ...
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#define fiboMiddleBufferIndex 9
|
|
|
|
|
#define fiboMiddleBufferPlotIndex 6
|
|
|
|
|
double fiboMiddleBuffer[];
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#property indicator_label7 "FIBMID"
|
|
|
|
|
#property indicator_type7 DRAW_LINE
|
|
|
|
|
#property indicator_color7 clrBrown
|
|
|
|
|
#property indicator_width7 2
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// FIBO Lower ...
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#define fiboLowerBufferIndex 9
|
|
|
|
|
#define fiboLowerBufferPlotIndex 6
|
|
|
|
|
#define fiboLowerBufferIndex 10
|
|
|
|
|
#define fiboLowerBufferPlotIndex 7
|
|
|
|
|
double fiboLowerBuffer[];
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#property indicator_label7 "FIBLO"
|
|
|
|
|
#property indicator_type7 DRAW_LINE
|
|
|
|
|
#property indicator_color7 clrMagenta
|
|
|
|
|
#property indicator_width7 2
|
|
|
|
|
#property indicator_label8 "FIBLO"
|
|
|
|
|
#property indicator_type8 DRAW_LINE
|
|
|
|
|
#property indicator_color8 clrMagenta
|
|
|
|
|
#property indicator_width8 2
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// ZigZag ...
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#define zigzagBufferIndex 10
|
|
|
|
|
#define zigzagBufferPlotIndex 7
|
|
|
|
|
#define zigzagBufferIndex 11
|
|
|
|
|
#define zigzagBufferPlotIndex 8
|
|
|
|
|
double zigzagBuffer[];
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#property indicator_label8 "XZG"
|
|
|
|
|
#property indicator_type8 DRAW_SECTION
|
|
|
|
|
#property indicator_color8 clrYellow
|
|
|
|
|
#property indicator_width8 2
|
|
|
|
|
#property indicator_label9 "XZG"
|
|
|
|
|
#property indicator_type9 DRAW_SECTION
|
|
|
|
|
#property indicator_color9 clrYellow
|
|
|
|
|
#property indicator_width9 2
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Data Buffers ...
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#define mLastBufferIndex 10
|
|
|
|
|
#define mLastBufferIndex 11
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// MA ...
|
|
|
|
@@ -825,6 +841,16 @@ void DefineBuffers()
|
|
|
|
|
PlotIndexSetInteger(fiboUpperBufferPlotIndex, PLOT_DRAW_TYPE, fiboZoneDrawType);
|
|
|
|
|
PlotIndexSetDouble(fiboUpperBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Middle ...
|
|
|
|
|
ArraySetAsSeries(fiboMiddleBuffer, true);
|
|
|
|
|
SetIndexBuffer(fiboMiddleBufferIndex, fiboMiddleBuffer, INDICATOR_DATA);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
PlotIndexSetInteger(fiboMiddleBufferPlotIndex, PLOT_SHOW_DATA, showFiboZone);
|
|
|
|
|
PlotIndexSetInteger(fiboMiddleBufferPlotIndex, PLOT_DRAW_TYPE, fiboZoneDrawType);
|
|
|
|
|
PlotIndexSetDouble(fiboMiddleBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Lower ...
|
|
|
|
|
ArraySetAsSeries(fiboLowerBuffer, true);
|
|
|
|
@@ -1294,18 +1320,29 @@ void CalculateValues(
|
|
|
|
|
double iFiboUp = GetFibonacciLevel(
|
|
|
|
|
iPeak,
|
|
|
|
|
iVale,
|
|
|
|
|
upperZoneLevel,
|
|
|
|
|
X_DIRECTION_BULLISH);
|
|
|
|
|
fiboUpperZoneLevel,
|
|
|
|
|
X_DIRECTION_BULLISH //
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
double iFiboMid = GetFibonacciLevel(
|
|
|
|
|
iPeak,
|
|
|
|
|
iVale,
|
|
|
|
|
fiboMiddleZoneLevel,
|
|
|
|
|
X_DIRECTION_BULLISH //
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
double iFiboLo = GetFibonacciLevel(
|
|
|
|
|
iPeak,
|
|
|
|
|
iVale,
|
|
|
|
|
lowerZoneLevel,
|
|
|
|
|
X_DIRECTION_BULLISH);
|
|
|
|
|
fiboLowerZoneLevel,
|
|
|
|
|
X_DIRECTION_BULLISH //
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
fiboUpperBuffer[barIndex] = iFiboUp;
|
|
|
|
|
fiboMiddleBuffer[barIndex] = iFiboMid;
|
|
|
|
|
fiboLowerBuffer[barIndex] = iFiboLo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|