Initial Commit ...

This commit is contained in:
2024-01-25 04:05:58 +03:30
commit dac3101466
520 changed files with 186332 additions and 0 deletions
@@ -0,0 +1,173 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MA Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
// this indicator uses two ma line:
// - fast ma;
// - slow ma;
//
// 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 MA Indicator"
#property strict
//
// START Inputs ...
//
//
// Fast MA ...
input int maLength = 20; // MA Length
input int maShift = 0; // MA Shift
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
input ENUM_APPLIED_PRICE maAppliedPrice = PRICE_CLOSE; // MA Applied Price
//
// START Global Definitions: Variables, Properties and etc ...
//
#property indicator_chart_window
//
#property indicator_buffers 1
//
#property indicator_plots 1
//
// Start Define Indicator Buffer Styles ...
//
//
// Fast Ma Buffer ...
#property indicator_label1 "Ma"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrYellow
#property indicator_style1 STYLE_DOT
#property indicator_width1 2
//
// End Define Indicator Buffer Styles ...
//
//
// Buffers ...
#define maBufferIndex 0
double maBuffer[];
//
// END Global Definitions: Variables, Properties and etc ...
//
//
// Start Event Handlers ...
//
//
// Initialization ...
int OnInit() {
//
// Initialize what we want ...
if (maLength <= 0) {
return INIT_PARAMETERS_INCORRECT;
}
//
// Start Set Index Buffers ...
//
//
// Ma ...
SetIndexBuffer(maBufferIndex, maBuffer);
SetIndexDrawBegin(maBufferIndex, maLength + 1);
//
// End Set Index Buffers ...
//
//
return INIT_SUCCEEDED;
}
//
// Calculating what we want ...
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]
) {
//
// this counts Available Bars ...
int limit;
//
// 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 ...
int maxLength = MathMax(0, maLength);
//
// input variable, we return 0 means nothing passed ...
if (rates_total < maxLength) {
return 0;
}
//
// found which candles calculated before ...
limit = (prev_calculated == 0) ? rates_total - maxLength - 1 : rates_total - prev_calculated + 1;
//
// this is the main loop of calculations, for each bar index ...
for (int i = limit - 1; i >= 0; i--) {
//
// Start Calculation here ...
// i is bar_index ...
//
// Calculate Ma ...
CalculateMa(i);
}
//
return rates_total;
}
//
// END Event Handlers ...
//
//
// START Functions ...
//
//
// Calculating Ma ...
void CalculateMa(
const int &bar_index
) {
//
// Calculating Fast Ma ...
double ma = iMA(
_Symbol,
_Period,
maLength,
maShift,
maMethod,
maAppliedPrice,
bar_index
);
//
maBuffer[bar_index] = ma;
}
//
// END Functions ...
//
@@ -0,0 +1,412 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center X Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// 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 X Indicator"
#property strict
//
// START Inputs ...
//
//
input int marketLength = 7; // Market Length
//
input int shortCycleMultiplier = 2; // Market Short Cycle Multiplier
input int mediumCycleMultiplier = 6; // Market Medium Cycle Multiplier
input int longCycleMultiplier = 36; // Market Medium Cycle Multiplier
//
input ENUM_MA_METHOD maMethod = MODE_SMA; // Ma Method
//
// END Inputs ...
//
//
// START Global Definitions: Variables, Properties and etc ...
//
#property indicator_chart_window
//
#property indicator_buffers 6
//
#property indicator_plots 6
//
// Start Define Indicator Buffer Styles ...
//
//
// Short Cycle Highest High Buffer ...
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrGreen
#property indicator_style1 STYLE_DOT
#property indicator_width1 1
//
// Short Cycle Lowest Low Buffer ...
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrRed
#property indicator_style2 STYLE_DOT
#property indicator_width2 1
//
// Medium Cycle Highest High Buffer ...
#property indicator_type3 DRAW_LINE
#property indicator_color3 clrAqua
#property indicator_style3 STYLE_DOT
#property indicator_width3 1
//
// Medium Cycle Lowest Low Buffer ...
#property indicator_type4 DRAW_LINE
#property indicator_color4 clrFuchsia
#property indicator_style4 STYLE_DOT
#property indicator_width4 1
//
// Long Cycle Highest High Buffer ...
#property indicator_type5 DRAW_LINE
#property indicator_color5 C'62,82,6'
#property indicator_style5 STYLE_DOT
#property indicator_width5 1
//
// Long Cycle Lowest Low Buffer ...
#property indicator_type6 DRAW_LINE
#property indicator_color6 C'255,81,0'
#property indicator_style6 STYLE_DOT
#property indicator_width6 1
//
// End Define Indicator Buffer Styles ...
//
//
// Buffers ...
//
// HH Buffers ...
#define scHHBufferIndex 0
#define scLLBufferIndex 1
#define mcHHBufferIndex 2
#define mcLLBufferIndex 3
#define lcHHBufferIndex 4
#define lcLLBufferIndex 5
double scHHBuffer[];
double scLLBuffer[];
double mcHHBuffer[];
double mcLLBuffer[];
double lcHHBuffer[];
double lcLLBuffer[];
//
// Variables ...
int shortCycleLength;
int mediumCycleLength;
int longCycleLength;
//
// END Global Definitions: Variables, Properties and etc ...
//
//
// Start Event Handlers ...
//
//
// Initialization ...
int OnInit() {
//
// Initialize what we want ...
if (
marketLength <= 0 ||
shortCycleMultiplier <= 0 ||
mediumCycleMultiplier <= 0 ||
shortCycleMultiplier > mediumCycleMultiplier
) {
return INIT_PARAMETERS_INCORRECT;
}
//
// Start Set Index Buffers ...
//
shortCycleLength = shortCycleMultiplier * marketLength;
mediumCycleLength = mediumCycleMultiplier * marketLength;
longCycleLength = longCycleMultiplier * marketLength;
//
// Highest High and Lowest Low Buffers ...
//
// Short Cycle Highest High ...
string scHHLbl = StringConcatenate(
"SC HH(", shortCycleLength, ")"
);
SetIndexBuffer(scHHBufferIndex, scHHBuffer);
SetIndexLabel(scHHBufferIndex, scHHLbl);
//
// Short Cycle Lowest Low ...
string scLLLbl = StringConcatenate(
"SC LL(", shortCycleLength, ")"
);
SetIndexBuffer(scLLBufferIndex, scLLBuffer);
SetIndexLabel(scLLBufferIndex, scLLLbl);
//
// Medium Cycle Highest High ...
string mcHHLbl = StringConcatenate(
"MC HH(", mediumCycleLength, ")"
);
SetIndexBuffer(mcHHBufferIndex, mcHHBuffer);
SetIndexLabel(mcHHBufferIndex, mcHHLbl);
//
// Medium Cycle Lowest Low ...
string mcLLLbl = StringConcatenate(
"MC LL(", mediumCycleLength, ")"
);
SetIndexBuffer(mcLLBufferIndex, mcLLBuffer);
SetIndexLabel(mcLLBufferIndex, mcLLLbl);
//
// Long Cycle Highest High ...
string lcHHLbl = StringConcatenate(
"LC HH(", longCycleLength, ")"
);
SetIndexBuffer(lcHHBufferIndex, lcHHBuffer);
SetIndexLabel(lcHHBufferIndex, lcHHLbl);
//
// Long Cycle Lowest Low ...
string lcLLLbl = StringConcatenate(
"LC LL(", longCycleLength, ")"
);
SetIndexBuffer(lcLLBufferIndex, lcLLBuffer);
SetIndexLabel(lcLLBufferIndex, lcLLLbl);
//
// End Set Index Buffers ...
//
//
return INIT_SUCCEEDED;
}
//
// Calculating what we want ...
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]
) {
//
// this counts Available Bars ...
int limit;
//
// 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 ...
int maxLength = MathMax(0, marketLength);
//
// input variable, we return 0 means nothing passed ...
if (rates_total < maxLength) {
return 0;
}
//
// found which candles calculated before ...
limit = (prev_calculated == 0) ? rates_total - maxLength - 1 : rates_total - prev_calculated + 1;
//
// this is the main loop of calculations, for each bar index ...
for (int i = limit - 1; i >= 0; i--) {
//
// Start Calculation here ...
// i is bar_index ...
//
// Calculat Ma's ...
//
CalculateShortCycle(i);
//
CalculateMediumCycle(i);
//
CalculateLongCycle(i);
}
//
return rates_total;
}
//
// END Event Handlers ...
//
//
// START Functions ...
//
//
// Calculating Short Cycle ...
void CalculateShortCycle(
const int &bar_index
) {
//
// Short Cycle Highest High ...
//
int scHHIdx = iHighest(
_Symbol,
_Period,
MODE_HIGH,
shortCycleLength,
bar_index
);
//
double scHH = iHigh(
_Symbol,
_Period,
scHHIdx
);
//
scHHBuffer[bar_index] = scHH;
//
// Short Cycle Lowest Low ...
//
int scLLIdx = iLowest(
_Symbol,
_Period,
MODE_LOW,
shortCycleLength,
bar_index
);
//
double scLL = iLow(
_Symbol,
_Period,
scLLIdx
);
//
scLLBuffer[bar_index] = scLL;
}
//
// Calculating Medium Cycle ...
void CalculateMediumCycle(
const int &bar_index
) {
//
// Medium Cycle Highest High ...
//
int mcHHIdx = iHighest(
_Symbol,
_Period,
MODE_HIGH,
mediumCycleLength,
bar_index
);
//
double mcHH = iHigh(
_Symbol,
_Period,
mcHHIdx
);
//
mcHHBuffer[bar_index] = mcHH;
//
// Medium Cycle Lowest Low ...
//
int mcLLIdx = iLowest(
_Symbol,
_Period,
MODE_LOW,
mediumCycleLength,
bar_index
);
//
double mcLL = iLow(
_Symbol,
_Period,
mcLLIdx
);
//
mcLLBuffer[bar_index] = mcLL;
}
//
// Calculating Long Cycle ...
void CalculateLongCycle(
const int &bar_index
) {
//
// Long Cycle Highest High ...
//
int lcHHIdx = iHighest(
_Symbol,
_Period,
MODE_HIGH,
longCycleLength,
bar_index
);
//
double lcHH = iHigh(
_Symbol,
_Period,
lcHHIdx
);
//
lcHHBuffer[bar_index] = lcHH;
//
// Long Cycle Lowest Low ...
//
int lcLLIdx = iLowest(
_Symbol,
_Period,
MODE_LOW,
longCycleLength,
bar_index
);
//
double lcLL = iLow(
_Symbol,
_Period,
lcLLIdx
);
//
lcLLBuffer[bar_index] = lcLL;
}
//
// END Functions ...
//
@@ -0,0 +1,294 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center XRange Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// 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 XRange Indicator"
#property strict
//
// START Inputs ...
//
input int marketLength = 14;
//
// END Inputs ...
//
//
// START Global Definitions: Variables, Properties and etc ...
//
#property indicator_chart_window
//
#property indicator_buffers 3
//
#property indicator_plots 3
//
// Start Define Indicator Buffer Styles ...
//
//
// Highest High Buffer ...
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrGreen
#property indicator_style1 STYLE_DOT
#property indicator_width1 1
//
// Lowest Low Buffer ...
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrRed
#property indicator_style2 STYLE_DOT
#property indicator_width2 1
//
// Middle Buffer ...
#property indicator_type3 DRAW_LINE
#property indicator_color3 clrYellow
#property indicator_style3 STYLE_DASH
#property indicator_width3 1
//
// End Define Indicator Buffer Styles ...
//
//
// Buffers ...
//
#define highestHighBufferIndex 0
#define lowestLowBufferIndex 1
#define middleBufferIndex 2
//
double highestHighBuffer[];
double lowestLowBuffer[];
double middleBuffer[];
//
datetime startTime;
//
// END Global Definitions: Variables, Properties and etc ...
//
//
// Start Event Handlers ...
//
//
// Initialization ...
int OnInit() {
//
// Initialize what we want ...
if (
marketLength <= 0
) {
return INIT_PARAMETERS_INCORRECT;
}
//
string hhLbl = StringConcatenate(
"XR HH(", marketLength, ")"
);
SetIndexBuffer(highestHighBufferIndex, highestHighBuffer);
SetIndexLabel(highestHighBufferIndex, hhLbl);
//
string llLbl = StringConcatenate(
"XR LL(", marketLength, ")"
);
SetIndexBuffer(lowestLowBufferIndex, lowestLowBuffer);
SetIndexLabel(lowestLowBufferIndex, llLbl);
//
string midLbl = StringConcatenate(
"XR Mid(", marketLength, ")"
);
SetIndexBuffer(middleBufferIndex, middleBuffer);
SetIndexLabel(middleBufferIndex, midLbl);
//
return INIT_SUCCEEDED;
}
//
// Calculating what we want ...
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]
) {
//
// this counts Available Bars ...
int limit;
//
// 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 ...
int maxLength = MathMax(0, marketLength);
//
// input variable, we return 0 means nothing passed ...
if (rates_total < maxLength) {
return 0;
}
//
// found which candles calculated before ...
limit = (prev_calculated == 0) ? rates_total - maxLength - 1 : rates_total - prev_calculated + 1;
//
// this is the main loop of calculations, for each bar index ...
for (int i = limit - 1; i >= 0; i--) {
//
// Start Calculation here ...
// i is bar_index ...
//
// Calculations ...
CalculateBuffers(i);
}
//
return rates_total;
}
//
// END Event Handlers ...
//
//
// START Functions ...
//
//
// Calculations ...
void CalculateBuffers(
const int &bar_index
) {
//
// Retrieve Bar Time ...
datetime barTime = iTime(
_Symbol,
_Period,
bar_index
);
//
if (startTime == 0) {
//
startTime = barTime;
SetIndicatorBuffersNone(bar_index);
return;
}
//
int startBarIndex = iBarShift(
_Symbol,
_Period,
startTime
);
//
int startDistance = startBarIndex - bar_index;
if (startDistance < marketLength) {
//
SetIndicatorBuffersNone(bar_index);
return;
}
//
// Highest High ...
int hhIdx = iHighest(
_Symbol,
_Period,
MODE_HIGH,
marketLength,
bar_index
);
double hh = iHigh(
_Symbol,
_Period,
hhIdx
);
highestHighBuffer[bar_index] = hh;
//
// Lowest Low ...
int llIdx = iLowest(
_Symbol,
_Period,
MODE_LOW,
marketLength,
bar_index
);
double ll = iLow(
_Symbol,
_Period,
llIdx
);
lowestLowBuffer[bar_index] = ll;
//
// Middle Buffer ...
double mid = (hh + ll) / 2;
middleBuffer[bar_index] = mid;
//
// Reset Start Time ...
startTime = 0;
}
//
void SetIndicatorBuffersNone(
const int bar_index
) {
//
int lastBarIndex = bar_index + 1;
//
double lastHighestHigh;
double lastLowestLow;
//
// Highest High ...
if (ArraySize(highestHighBuffer) > lastBarIndex) {
lastHighestHigh = highestHighBuffer[lastBarIndex];
} else {
lastHighestHigh = 0;
}
//
// Lowest Low ...
if (ArraySize(lowestLowBuffer) > lastBarIndex) {
lastLowestLow = lowestLowBuffer[lastBarIndex];
} else {
lastLowestLow = 0;
}
//
highestHighBuffer[bar_index] = lastHighestHigh;
lowestLowBuffer[bar_index] = lastLowestLow;
//
double mid = (lastHighestHigh + lastLowestLow) / 2;
middleBuffer[bar_index] = mid;
}
//
// END Functions ...
//
@@ -0,0 +1,395 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center X Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// 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 X Indicator"
#property strict
//
// START Inputs ...
//
//
input int marketLength = 7; // Market Length
//
input double step = 0.02; // P SAR Step
input double maximum = 0.2; // P SAR Maximum
//
input int shortCycleMultiplier = 2; // Market Short Cycle Multiplier
input int mediumCycleMultiplier = 6; // Market Medium Cycle Multiplier
input int longCycleMultiplier = 36; // Market Medium Cycle Multiplier
//
input ENUM_MA_METHOD maMethod = MODE_SMA; // Ma Method
//
// END Inputs ...
//
//
// START Global Definitions: Variables, Properties and etc ...
//
#property indicator_chart_window
//
#property indicator_buffers 7
//
#property indicator_plots 7
//
// Start Define Indicator Buffer Styles ...
//
//
// Short Cycle Fast Buffer ...
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrGreen
#property indicator_style1 STYLE_DOT
#property indicator_width1 1
//
// Short Cycle Slow Buffer ...
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrRed
#property indicator_style2 STYLE_DOT
#property indicator_width2 1
//
// Medium Cycle Fast Buffer ...
#property indicator_type3 DRAW_LINE
#property indicator_color3 clrAqua
#property indicator_style3 STYLE_DOT
#property indicator_width3 1
//
// Medium Cycle Slow Buffer ...
#property indicator_type4 DRAW_LINE
#property indicator_color4 clrFuchsia
#property indicator_style4 STYLE_DOT
#property indicator_width4 1
//
// Long Cycle Fast Buffer ...
#property indicator_type5 DRAW_LINE
#property indicator_color5 C'62,82,6'
#property indicator_style5 STYLE_DOT
#property indicator_width5 1
//
// Long Cycle Slow Buffer ...
#property indicator_type6 DRAW_LINE
#property indicator_color6 C'255,81,0'
#property indicator_style6 STYLE_DOT
#property indicator_width6 1
//
// Parabolic SAR ...
#property indicator_type7 DRAW_LINE
#property indicator_color7 C'0,174,255'
#property indicator_style7 STYLE_DASHDOT
#property indicator_width7 1
//
// End Define Indicator Buffer Styles ...
//
//
// Buffers ...
//
// Ma Buffers ...
#define scFastBufferIndex 0
#define scSlowBufferIndex 1
#define mcFastBufferIndex 2
#define mcSlowBufferIndex 3
#define lcFastBufferIndex 4
#define lcSlowBufferIndex 5
#define psarBufferIndex 6
double scFastBuffer[];
double scSlowBuffer[];
double mcFastBuffer[];
double mcSlowBuffer[];
double lcFastBuffer[];
double lcSlowBuffer[];
double psarBuffer[];
//
// Variables ...
int shortCycleLength;
int mediumCycleLength;
int longCycleLength;
//
// END Global Definitions: Variables, Properties and etc ...
//
//
// Start Event Handlers ...
//
//
// Initialization ...
int OnInit() {
//
// Initialize what we want ...
if (
marketLength <= 0 ||
shortCycleMultiplier <= 0 ||
mediumCycleMultiplier <= 0 ||
shortCycleMultiplier > mediumCycleMultiplier
) {
return INIT_PARAMETERS_INCORRECT;
}
//
// Start Set Index Buffers ...
//
shortCycleLength = shortCycleMultiplier * marketLength;
mediumCycleLength = mediumCycleMultiplier * marketLength;
longCycleLength = longCycleMultiplier * marketLength;
//
// Ma Buffers ...
//
// Short Cycle ...
string scFLbl = StringConcatenate(
"SC F(", shortCycleLength, ")"
);
SetIndexBuffer(scFastBufferIndex, scFastBuffer);
SetIndexLabel(scFastBufferIndex, scFLbl);
//
string scSLbl = StringConcatenate(
"SC S(", shortCycleLength, ")"
);
SetIndexBuffer(scSlowBufferIndex, scSlowBuffer);
SetIndexLabel(scSlowBufferIndex, scSLbl);
//
// Medium Cycle ...
string mcFLbl = StringConcatenate(
"MC F(", mediumCycleLength, ")"
);
SetIndexBuffer(mcFastBufferIndex, mcFastBuffer);
SetIndexLabel(mcFastBufferIndex, mcFLbl);
//
string mcSLbl = StringConcatenate(
"MC S(", mediumCycleLength, ")"
);
SetIndexBuffer(mcSlowBufferIndex, mcSlowBuffer);
SetIndexLabel(mcSlowBufferIndex, mcSLbl);
//
// Long Cycle ...
string lcFLbl = StringConcatenate(
"LC F(", longCycleLength, ")"
);
SetIndexBuffer(lcFastBufferIndex, lcFastBuffer);
SetIndexLabel(lcFastBufferIndex, lcFLbl);
//
string lcSLbl = StringConcatenate(
"LC S(", longCycleLength, ")"
);
SetIndexBuffer(lcSlowBufferIndex, lcSlowBuffer);
SetIndexLabel(lcSlowBufferIndex, lcSLbl);
//
// End Set Index Buffers ...
//
//
// Parabolic Sar ...
SetIndexBuffer(psarBufferIndex, psarBuffer);
SetIndexLabel(psarBufferIndex, "P Sar");
//
return INIT_SUCCEEDED;
}
//
// Calculating what we want ...
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]
) {
//
// this counts Available Bars ...
int limit;
//
// 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 ...
int maxLength = MathMax(0, marketLength);
//
// input variable, we return 0 means nothing passed ...
if (rates_total < maxLength) {
return 0;
}
//
// found which candles calculated before ...
limit = (prev_calculated == 0) ? rates_total - maxLength - 1 : rates_total - prev_calculated + 1;
//
// this is the main loop of calculations, for each bar index ...
for (int i = limit - 1; i >= 0; i--) {
//
// Start Calculation here ...
// i is bar_index ...
//
// Calculat Ma's ...
//
CalculateShortCycle(i);
//
CalculateMediumCycle(i);
//
CalculateLongCycle(i);
//
// Parabolic SAR ...
CalculateParabolicSAR(i);
}
//
return rates_total;
}
//
// END Event Handlers ...
//
//
// START Functions ...
//
//
// Calculating Short Cycle ...
void CalculateShortCycle(
const int &bar_index
) {
//
double scFast = iMA(
_Symbol,
_Period,
shortCycleLength,
0,
maMethod,
PRICE_OPEN,
bar_index
);
scFastBuffer[bar_index] = scFast;
//
double scSlow = iMA(
_Symbol,
_Period,
shortCycleLength,
0,
maMethod,
PRICE_CLOSE,
bar_index
);
scSlowBuffer[bar_index] = scSlow;
}
//
// Calculating Medium Cycle ...
void CalculateMediumCycle(
const int &bar_index
) {
//
double mcFast = iMA(
_Symbol,
_Period,
mediumCycleLength,
0,
maMethod,
PRICE_OPEN,
bar_index
);
mcFastBuffer[bar_index] = mcFast;
//
double mcSlow = iMA(
_Symbol,
_Period,
mediumCycleLength,
0,
maMethod,
PRICE_CLOSE,
bar_index
);
mcSlowBuffer[bar_index] = mcSlow;
}
//
// Calculating Long Cycle ...
void CalculateLongCycle(
const int &bar_index
) {
//
double lcFast = iMA(
_Symbol,
_Period,
longCycleLength,
0,
maMethod,
PRICE_OPEN,
bar_index
);
lcFastBuffer[bar_index] = lcFast;
//
double lcSlow = iMA(
_Symbol,
_Period,
longCycleLength,
0,
maMethod,
PRICE_CLOSE,
bar_index
);
lcSlowBuffer[bar_index] = lcSlow;
}
//
// Calculate Parabolic SAR ...
void CalculateParabolicSAR(
const int &bar_index
) {
//
double pSar = iSAR(
_Symbol,
_Period,
step,
maximum,
bar_index
);
//
psarBuffer[bar_index] = pSar;
}
//
// END Functions ...
//