Files
xMQL5/MQLTestWorkspace/Indicators/x-saherelm.x121.xpv.mq5
T

993 lines
22 KiB
Plaintext

///////////////////////////////////////////////////////
// SaherElm IT Center MQL5 Indicator
// -------------------------------------------
// Name: X121_XPV
// Description: Market Peaks and Vales
//
//
// 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_XPV Indicator"
#property strict
//
// START Constants ...
//
//
// Indicator Short Name ...
#define ShortName "X121_XPV"
//
// END Constants ...
//
//
// START Inputs ...
//
//
input group "Makret Cycles";
input int shortLength = 9; // Short Length
input int mediumLength = 17; // Medium Length
input int longLength = 26; // Long Length
input int hindLength = 35; // Hind Length
input double fiboLevel1 = 0.382; // Fibio 1st Level
input double fiboLevel2 = 0.5; // Fibio 2st Level
input double fiboLevel3 = 0.618; // Fibio 3rd Level
//
input group "Detection Modes";
input ENUM_SERIESMODE hhMode = MODE_HIGH; // Highest High Calculation Method
input ENUM_SERIESMODE llMode = MODE_LOW; // Lowest Low Calculation Method
//
input group "Presentation";
input bool showPeaksAndVales = true; // Show Peaks and Vales
input bool showLevels = false; // Show Levels
input bool showFibo1Levels = true; // Show Fibo 1st Level
input bool showFibo2Levels = true; // Show Fibo 2nd Level
input bool showFibo3Levels = true; // Show Fibo 3rd Level
//
// END Inputs ...
//
//
// START Includes and Imports ...
//
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
//
// END Includes and Imports ...
//
//
// START Buffers ...
//
#property indicator_chart_window
//
#property indicator_buffers 26
#property indicator_plots 18
//
// PEKSANDVALES ...
//
// PEAKS ...
//
#define peaksBufferIndex 0
double peaksBuffer[];
//
#property indicator_label1 "X121_XPV PEAKS"
#property indicator_type1 DRAW_ARROW
#property indicator_color1 clrAqua
#property indicator_width1 1
//
// VALES ...
//
#define valesBufferIndex 1
double valesBuffer[];
//
#property indicator_label2 "X121_XPV VALES"
#property indicator_type2 DRAW_ARROW
#property indicator_color2 clrMagenta
#property indicator_width2 1
//
#define rBufferIndex 2
double rBuffer[];
//
#define rColorBufferIndex 3
double rColorBuffer[];
//
#property indicator_label3 "X121_XPV R"
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_color3 clrAqua, CLR_NONE
#property indicator_style3 STYLE_DOT
#property indicator_width3 1
//
#define sBufferIndex 4
#define sBufferPlotIndex 3
double sBuffer[];
//
#define sColorBufferIndex 5
double sColorBuffer[];
//
#property indicator_label4 "X121_XPV S"
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_color4 clrMagenta, CLR_NONE
#property indicator_style4 STYLE_DOT
#property indicator_width4 1
//
// FIBBO Level 1 ...
//
#define fl1BufferIndex 6
#define fl1BufferPlotIndex 4
double fl1Buffer[];
//
#define fl1ColorBufferIndex 7
double fl1ColorBuffer[];
//
#property indicator_label5 "X121_XPV FL1"
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_color5 CLR_NONE, clrGold
#property indicator_style5 STYLE_DASHDOTDOT
#property indicator_width5 1
//
// FIBBO Level 2 ...
//
#define fl2BufferIndex 8
#define fl2BufferPlotIndex 5
double fl2Buffer[];
//
#define fl2ColorBufferIndex 9
double fl2ColorBuffer[];
//
#property indicator_label6 "X121_XPV FL2"
#property indicator_type6 DRAW_COLOR_LINE
#property indicator_color6 CLR_NONE, clrGold
#property indicator_style6 STYLE_DASHDOTDOT
#property indicator_width6 1
//
// FIBBO Level 3 ...
//
#define fl3BufferIndex 10
#define fl3BufferPlotIndex 6
double fl3Buffer[];
//
#define fl3ColorBufferIndex 11
double fl3ColorBuffer[];
//
#property indicator_label7 "X121_XPV FL3"
#property indicator_type7 DRAW_COLOR_LINE
#property indicator_color7 CLR_NONE, clrGold
#property indicator_style7 STYLE_DASHDOTDOT
#property indicator_width7 1
//
// LEVELS ...
//
#define sHHBufferIndex 12
#define sHHBufferPlotIndex 7
double sHHBuffer[];
//
#property indicator_label8 "X121_XPV SHH"
#property indicator_type8 DRAW_LINE
#property indicator_color8 clrLightGray
#property indicator_style8 STYLE_DOT
#property indicator_width8 1
#define sLLBufferIndex 13
#define sLLBufferPlotIndex 8
double sLLBuffer[];
//
#property indicator_label9 "X121_XPV SLL"
#property indicator_type9 DRAW_LINE
#property indicator_color9 clrLightGray
#property indicator_style9 STYLE_DOT
#property indicator_width9 1
//
#define mHHBufferIndex 14
#define mHHBufferPlotIndex 9
double mHHBuffer[];
//
#property indicator_label10 "X121_XPV MHH"
#property indicator_type10 DRAW_LINE
#property indicator_color10 clrLightGray
#property indicator_style10 STYLE_DOT
#property indicator_width10 1
//
#define mLLBufferIndex 15
#define mLLBufferPlotIndex 10
double mLLBuffer[];
//
#property indicator_label11 "X121_XPV MLL"
#property indicator_type11 DRAW_LINE
#property indicator_color11 clrLightGray
#property indicator_style11 STYLE_DOT
#property indicator_width11 1
//
#define lHHBufferIndex 16
#define lHHBufferPlotIndex 11
double lHHBuffer[];
//
#property indicator_label12 "X121_XPV LHH"
#property indicator_type12 DRAW_LINE
#property indicator_color12 clrLightGray
#property indicator_style12 STYLE_DOT
#property indicator_width12 1
//
#define lLLBufferIndex 17
#define lLLBufferPlotIndex 12
double lLLBuffer[];
//
#property indicator_label13 "X121_XPV LLL"
#property indicator_type13 DRAW_LINE
#property indicator_color13 clrLightGray
#property indicator_style13 STYLE_DOT
#property indicator_width13 1
//
#define hHHBufferIndex 18
#define hHHBufferPlotIndex 13
double hHHBuffer[];
//
#property indicator_label14 "X121_XPV HHH"
#property indicator_type14 DRAW_LINE
#property indicator_color14 clrLightGray
#property indicator_style14 STYLE_DOT
#property indicator_width14 1
//
#define hLLBufferIndex 19
#define hLLBufferPlotIndex 14
double hLLBuffer[];
//
#property indicator_label15 "X121_XPV HLL"
#property indicator_type15 DRAW_LINE
#property indicator_color15 clrLightGray
#property indicator_style15 STYLE_DOT
#property indicator_width15 1
//
// END Buffers ...
//
//
// START Global Definitions: Variables, Properties and etc ...
//
//
int maxLength;
//
double lastPeak;
double lastVale;
//
// END Global Definitions: Variables, Properties and etc ...
//
//
// START Event Handlers ...
//
//
// Initialization ...
int OnInit()
{
//
// Validate Inputs ...
if (!ValidateInputs())
{
return INIT_PARAMETERS_INCORRECT;
}
//
// 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;
}
//
// DeInitialization ...
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
}
//
// 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[])
{
//
// 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);
//
// this counts Available Bars ...
int limit;
//
limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1;
//
// Main Loop ...
for (int i = limit - 1; i >= 0 && !IsStopped(); i--)
{
CalculateBuffers(i);
}
//
return rates_total;
}
//
// END Event Handlers ...
//
//
// START Functions ...
//
//
// Validate Input Args for Initialization ...
bool ValidateInputs()
{
//
bool result =
//
(shortLength > 2 &&
mediumLength > shortLength &&
longLength > mediumLength &&
hindLength > longLength)
//
;
//
return result;
}
//
// Retrieve all Exists Input Max Length ...
// use for Start Of Drawing ...
int ExtractMaxLengthOfInputs()
{
//
int result = 0;
//
// Peaks and Vales ...
result = MathMax(shortLength, mediumLength);
result = MathMax(result, longLength);
result = MathMax(result, hindLength);
//
return result;
}
//
// Define Indexes and Styles ...
void DefineBuffers()
{
//
// RANGE ...
//
// PEAKS and VALES ...
ENUM_DRAW_TYPE pvDrawType = showPeaksAndVales ? DRAW_ARROW : DRAW_NONE;
//
// PEAKS ...
ArraySetAsSeries(peaksBuffer, true);
SetIndexBuffer(peaksBufferIndex, peaksBuffer, INDICATOR_DATA);
PlotIndexSetInteger(peaksBufferIndex, PLOT_ARROW, 225);
// PlotIndexSetInteger(peaksBufferIndex, PLOT_ARROW_SHIFT, -20);
PlotIndexSetDouble(peaksBufferIndex, PLOT_EMPTY_VALUE, 0);
//
PlotIndexSetInteger(peaksBufferIndex, PLOT_SHOW_DATA, showPeaksAndVales);
PlotIndexSetInteger(peaksBufferIndex, PLOT_DRAW_TYPE, pvDrawType);
//
// VALES ...
ArraySetAsSeries(valesBuffer, true);
SetIndexBuffer(valesBufferIndex, valesBuffer, INDICATOR_DATA);
PlotIndexSetInteger(valesBufferIndex, PLOT_ARROW, 225);
// PlotIndexSetInteger(valesBufferIndex, PLOT_ARROW_SHIFT, 20);
PlotIndexSetDouble(valesBufferIndex, PLOT_EMPTY_VALUE, 0);
//
PlotIndexSetInteger(valesBufferIndex, PLOT_SHOW_DATA, showPeaksAndVales);
PlotIndexSetInteger(valesBufferIndex, PLOT_DRAW_TYPE, pvDrawType);
//
// SUPPORT and RESISTANCE ...
//
//
// RESISTANCE ...
ArraySetAsSeries(rBuffer, true);
SetIndexBuffer(rBufferIndex, rBuffer, INDICATOR_DATA);
PlotIndexSetInteger(rBufferIndex, PLOT_DRAW_BEGIN, maxLength);
PlotIndexSetInteger(rBufferIndex, PLOT_SHOW_DATA, false);
//
// RESISTANCE Color ...
ArraySetAsSeries(rColorBuffer, true);
SetIndexBuffer(rColorBufferIndex, rColorBuffer, INDICATOR_COLOR_INDEX);
//
// SUPPORT ...
ArraySetAsSeries(sBuffer, true);
SetIndexBuffer(sBufferIndex, sBuffer, INDICATOR_DATA);
PlotIndexSetInteger(sBufferIndex, PLOT_DRAW_BEGIN, maxLength);
PlotIndexSetInteger(sBufferPlotIndex, PLOT_SHOW_DATA, false);
//
// SUPPORT Color ...
ArraySetAsSeries(sColorBuffer, true);
SetIndexBuffer(sColorBufferIndex, sColorBuffer, INDICATOR_COLOR_INDEX);
//
// FIBBO Levels ...
//
// LEVEL 1 ...
//
// BULLISH ...
ArraySetAsSeries(fl1Buffer, true);
SetIndexBuffer(fl1BufferIndex, fl1Buffer, INDICATOR_DATA);
PlotIndexSetInteger(fl1BufferIndex, PLOT_DRAW_BEGIN, maxLength);
PlotIndexSetInteger(fl1BufferIndex, PLOT_SHOW_DATA, showFibo1Levels);
//
// BULLISH Color ...
ArraySetAsSeries(fl1ColorBuffer, true);
SetIndexBuffer(fl1ColorBufferIndex, fl1ColorBuffer, INDICATOR_COLOR_INDEX);
//
// LEVEL 2 ...
//
// BULLISH ...
ArraySetAsSeries(fl2Buffer, true);
SetIndexBuffer(fl2BufferIndex, fl2Buffer, INDICATOR_DATA);
PlotIndexSetInteger(fl2BufferIndex, PLOT_DRAW_BEGIN, maxLength);
PlotIndexSetInteger(fl2BufferIndex, PLOT_SHOW_DATA, showFibo2Levels);
//
// BULLISH Color ...
ArraySetAsSeries(fl2ColorBuffer, true);
SetIndexBuffer(fl2ColorBufferIndex, fl2ColorBuffer, INDICATOR_COLOR_INDEX);
//
// LEVEL 3 ...
//
// BULLISH ...
ArraySetAsSeries(fl3Buffer, true);
SetIndexBuffer(fl3BufferIndex, fl3Buffer, INDICATOR_DATA);
PlotIndexSetInteger(fl3BufferIndex, PLOT_DRAW_BEGIN, maxLength);
PlotIndexSetInteger(fl3BufferIndex, PLOT_SHOW_DATA, showFibo3Levels);
//
// BULLISH Color ...
ArraySetAsSeries(fl3ColorBuffer, true);
SetIndexBuffer(fl3ColorBufferIndex, fl3ColorBuffer, INDICATOR_COLOR_INDEX);
//
ENUM_DRAW_TYPE zoneDrawType = showLevels ? DRAW_LINE : DRAW_NONE;
//
// SHORT Buffers ...
//
// HIGH ...
ArraySetAsSeries(sHHBuffer, true);
SetIndexBuffer(sHHBufferIndex, sHHBuffer, INDICATOR_DATA);
PlotIndexSetInteger(sHHBufferIndex, PLOT_DRAW_BEGIN, maxLength);
//
PlotIndexSetInteger(sHHBufferPlotIndex, PLOT_SHOW_DATA, showLevels);
PlotIndexSetInteger(sHHBufferPlotIndex, PLOT_DRAW_TYPE, zoneDrawType);
//
// LOW ...
ArraySetAsSeries(sLLBuffer, true);
SetIndexBuffer(sLLBufferIndex, sLLBuffer, INDICATOR_DATA);
PlotIndexSetInteger(sLLBufferIndex, PLOT_DRAW_BEGIN, maxLength);
//
PlotIndexSetInteger(sLLBufferPlotIndex, PLOT_SHOW_DATA, showLevels);
PlotIndexSetInteger(sLLBufferPlotIndex, PLOT_DRAW_TYPE, zoneDrawType);
//
// MEDIUM Buffer ...
//
// HIGH ...
ArraySetAsSeries(mHHBuffer, true);
SetIndexBuffer(mHHBufferIndex, mHHBuffer, INDICATOR_DATA);
PlotIndexSetInteger(mHHBufferIndex, PLOT_DRAW_BEGIN, maxLength);
//
PlotIndexSetInteger(mHHBufferPlotIndex, PLOT_SHOW_DATA, showLevels);
PlotIndexSetInteger(mHHBufferPlotIndex, PLOT_DRAW_TYPE, zoneDrawType);
//
// LOW ...
ArraySetAsSeries(mLLBuffer, true);
SetIndexBuffer(mLLBufferIndex, mLLBuffer, INDICATOR_DATA);
PlotIndexSetInteger(mLLBufferIndex, PLOT_DRAW_BEGIN, maxLength);
//
PlotIndexSetInteger(mLLBufferPlotIndex, PLOT_SHOW_DATA, showLevels);
PlotIndexSetInteger(mLLBufferPlotIndex, PLOT_DRAW_TYPE, zoneDrawType);
//
// LONG Buffer ...
//
// HIGH ...
ArraySetAsSeries(lHHBuffer, true);
SetIndexBuffer(lHHBufferIndex, lHHBuffer, INDICATOR_DATA);
PlotIndexSetInteger(lHHBufferIndex, PLOT_DRAW_BEGIN, maxLength);
//
PlotIndexSetInteger(lHHBufferPlotIndex, PLOT_SHOW_DATA, showLevels);
PlotIndexSetInteger(lHHBufferPlotIndex, PLOT_DRAW_TYPE, zoneDrawType);
//
// LOW ...
ArraySetAsSeries(lLLBuffer, true);
SetIndexBuffer(lLLBufferIndex, lLLBuffer, INDICATOR_DATA);
PlotIndexSetInteger(lLLBufferIndex, PLOT_DRAW_BEGIN, maxLength);
//
PlotIndexSetInteger(lLLBufferPlotIndex, PLOT_SHOW_DATA, showLevels);
PlotIndexSetInteger(lLLBufferPlotIndex, PLOT_DRAW_TYPE, zoneDrawType);
//
// HIND Buffer ...
//
// HIGH ...
ArraySetAsSeries(hHHBuffer, true);
SetIndexBuffer(hHHBufferIndex, hHHBuffer, INDICATOR_DATA);
PlotIndexSetInteger(hHHBufferIndex, PLOT_DRAW_BEGIN, maxLength);
//
PlotIndexSetInteger(hHHBufferPlotIndex, PLOT_SHOW_DATA, showLevels);
PlotIndexSetInteger(hHHBufferPlotIndex, PLOT_DRAW_TYPE, zoneDrawType);
//
// LOW ...
ArraySetAsSeries(hLLBuffer, true);
SetIndexBuffer(hLLBufferIndex, hLLBuffer, INDICATOR_DATA);
PlotIndexSetInteger(hLLBufferIndex, PLOT_DRAW_BEGIN, maxLength);
//
PlotIndexSetInteger(hLLBufferPlotIndex, PLOT_SHOW_DATA, showLevels);
PlotIndexSetInteger(hLLBufferPlotIndex, PLOT_DRAW_TYPE, zoneDrawType);
}
//
// Set Indicator Short Name and also we can define Buffers Labels ...
void SetIndicatorName()
{
IndicatorSetString(INDICATOR_SHORTNAME, ShortName);
}
//
// Calculate Buffers ...
void CalculateBuffers(
int bar_index // Selected Bar Index
)
{
//
// Calculate ...
//
double rColorIDX = 1;
double sColorIDX = 1;
//
// SHORT ...
//
// HIGH ...
int sHHIndex = iHighest(
_Symbol,
_Period,
hhMode,
shortLength,
bar_index);
double sHHValue = GetAppliedPrice(
sHHIndex,
hhMode);
//
sHHBuffer[bar_index] = sHHValue;
//
// LOW ...
int sLLIndex = iLowest(
_Symbol,
_Period,
llMode,
shortLength,
bar_index);
double sLLValue = GetAppliedPrice(
sLLIndex,
llMode);
//
sLLBuffer[bar_index] = sLLValue;
//
// MEDIUM ...
//
// HIGH ...
int mHHIndex = iHighest(
_Symbol,
_Period,
hhMode,
mediumLength,
bar_index);
double mHHValue = GetAppliedPrice(
mHHIndex,
hhMode);
//
mHHBuffer[bar_index] = mHHValue;
//
// LOW ...
int mLLIndex = iLowest(
_Symbol,
_Period,
llMode,
mediumLength,
bar_index);
double mLLValue = GetAppliedPrice(
mLLIndex,
llMode);
//
mLLBuffer[bar_index] = mLLValue;
//
// LONG ...
//
// HIGH ...
int lHHIndex = iHighest(
_Symbol,
_Period,
hhMode,
longLength,
bar_index);
double lHHValue = GetAppliedPrice(
lHHIndex,
hhMode);
//
lHHBuffer[bar_index] = lHHValue;
//
// LOW ...
int lLLIndex = iLowest(
_Symbol,
_Period,
llMode,
longLength,
bar_index);
double lLLValue = GetAppliedPrice(
lLLIndex,
llMode);
//
lLLBuffer[bar_index] = lLLValue;
//
// HIND ...
//
// HIGH ...
int hHHIndex = iHighest(
_Symbol,
_Period,
hhMode,
hindLength,
bar_index);
double hHHValue = GetAppliedPrice(
hHHIndex,
hhMode);
//
hHHBuffer[bar_index] = hHHValue;
//
// LOW ...
int hLLIndex = iLowest(
_Symbol,
_Period,
llMode,
hindLength,
bar_index);
double hLLValue = GetAppliedPrice(
hLLIndex,
llMode);
//
hLLBuffer[bar_index] = hLLValue;
//
// RESISTANCE SUPPORT ...
//
// RESISTANCE ...
double rValue = (sHHValue + mHHValue + lHHValue + hHHValue) / 4;
rBuffer[bar_index] = rValue;
//
// SUPPORT ...
double sValue = (sLLValue + mLLValue + lLLValue + hLLValue) / 4;
sBuffer[bar_index] = sValue;
//
// PEAKS and VALES ...
//
// PEAKS ...
bool isPeak = rValue == hHHValue &&
hHHValue == lHHValue &&
lHHValue == mHHValue &&
mHHValue == sHHValue;
//
if (isPeak && lastPeak != rValue)
{
//
if (showPeaksAndVales)
{
rColorIDX = 0;
}
//
lastPeak = rValue;
peaksBuffer[bar_index] = lastPeak;
}
else
{
peaksBuffer[bar_index] = lastPeak;
}
//
// VALES ...
bool isVale = sValue == hLLValue &&
hLLValue == lLLValue &&
lLLValue == mLLValue &&
mLLValue == sLLValue;
//
if (isVale && lastVale != sValue)
{
//
if (showPeaksAndVales)
{
sColorIDX = 0;
}
//
lastVale = sValue;
valesBuffer[bar_index] = lastVale;
}
else
{
valesBuffer[bar_index] = lastVale;
}
//
// Set Default Colors ...
//
rColorBuffer[bar_index] = rColorIDX;
sColorBuffer[bar_index] = sColorIDX;
//
// Calculate Fibonacci ...
double upPrice = peaksBuffer[bar_index];
double downPrice = valesBuffer[bar_index];
//
// Level 1 ...
//
// Bullish ...
double fibLevel1BullishValue = GetFibonacciLevel(
upPrice,
downPrice,
fiboLevel1,
1);
fl1Buffer[bar_index] = fibLevel1BullishValue;
double fl1BullColorIdx = showFibo1Levels ? 1 : 0;
fl1ColorBuffer[bar_index] = fl1BullColorIdx;
// //
// // Bearish ...
// double fibLevel1BearishValue = GetFibonacciLevel(
// upPrice,
// downPrice,
// fiboLevel1,
// 0);
// fl1BearBuffer[bar_index] = fibLevel1BearishValue;
// double fl1BearColorIdx = showFibo1Levels ? 1 : 0;
// fl1BearColorBuffer[bar_index] = fl1BearColorIdx;
//
// Level 2 ...
//
// Bullish ...
double fibLevel2BullishValue = GetFibonacciLevel(
upPrice,
downPrice,
fiboLevel2,
1);
fl2Buffer[bar_index] = fibLevel2BullishValue;
double fl2BullColorIdx = showFibo2Levels ? 1 : 0;
fl2ColorBuffer[bar_index] = fl2BullColorIdx;
// //
// // Bearish ...
// double fibLevel2BearishValue = GetFibonacciLevel(
// upPrice,
// downPrice,
// fiboLevel2,
// 0);
// fl2BearBuffer[bar_index] = fibLevel2BearishValue;
// double fl2BearColorIdx = showFibo2Levels ? 1 : 0;
// fl2BearColorBuffer[bar_index] = fl2BearColorIdx;
//
// Level 3 ...
//
// Bullish ...
double fibLevel3BullishValue = GetFibonacciLevel(
upPrice,
downPrice,
fiboLevel3,
1);
fl3Buffer[bar_index] = fibLevel3BullishValue;
double fl3BullColorIdx = showFibo3Levels ? 1 : 0;
fl3ColorBuffer[bar_index] = fl3BullColorIdx;
// //
// // Bearish ...
// double fibLevel3BearishValue = GetFibonacciLevel(
// upPrice,
// downPrice,
// fiboLevel3,
// 0);
// fl3BearBuffer[bar_index] = fibLevel3BearishValue;
// double fl3BearColorIdx = showFibo3Levels ? 1 : 0;
// fl3BearColorBuffer[bar_index] = fl3BearColorIdx;
}
//
// END Functions ...
//