Files
MQL5Data/Helpers/x-saherelm.x121.helper.mq5
T

3565 lines
68 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Helper Class Library
// ----------------------------------------------
// Name: XCX121Helper
// Description: provides all Indicator
// Helper requirements ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// Imports ...
#include "../Classes/x-saherelm.x-helper.class.mq5"
//
// Definitions ...
enum ENUM_X121_BUFFERS
{
//
// Main Buffers ...
X121_PEAKS_LINE = 0,
X121_VALES_LINE = 1,
X121_SAR_LINE = 2,
X121_VWAP_FAST_LINE = 3,
X121_VWAP_MID_LINE = 5,
X121_VWAP_SLOW_LINE = 7,
X121_DON_OPEN_UPPER_LINE = 9,
X121_DON_OPEN_LOWER_LINE = 10,
X121_DON_HIGH_UPPER_LINE = 11,
X121_DON_HIGH_LOWER_LINE = 12,
X121_DON_LOW_UPPER_LINE = 13,
X121_DON_LOW_LOWER_LINE = 14,
X121_DON_CLOSE_UPPER_LINE = 15,
X121_DON_CLOSE_LOWER_LINE = 16,
X121_FIB_LEVEL_1_LINE = 17,
X121_FIB_LEVEL_2_LINE = 18,
X121_FIB_LEVEL_3_LINE = 19,
X121_FIB_LEVEL_4_LINE = 20,
X121_FIB_LEVEL_5_LINE = 21,
//
// Data Buffers ...
//
// XPV Data ...
X121_CURRENT_HH_LINE = 22,
X121_CURRENT_LL_LINE = 23,
X121_SHORT_HH_LINE = 24,
X121_SHORT_LL_LINE = 25,
X121_MEDIUM_HH_LINE = 26,
X121_MEDIUM_LL_LINE = 27,
X121_LONG_HH_LINE = 28,
X121_LONG_LL_LINE = 29,
X121_HIND_HH_LINE = 30,
X121_HIND_LL_LINE = 31,
//
// VWAP Data ...
X121_VWAP_VOLUME_LINE = 32,
X121_VWAP_PRICE_LINE = 33,
X121_VWAP_FAST_STATE_LINE = 34,
X121_VWAP_MID_STATE_LINE = 35,
X121_VWAP_SLOW_STATE_LINE = 36,
//
// VALID PEAKS and VALES ...
X121_VALID_PEAKS_LINE = 37,
X121_VALID_VALES_LINE = 38,
};
//
// Inputs ...
struct X121Inputs
{
//
// Props ...
//
// Cycles ...
//
// Short ...
ENUM_X_PERIOD_METHOD scMethod; // How to Find Period
ENUM_TIMEFRAMES scPeriod; // Time Period
//
// Medium ...
ENUM_X_PERIOD_METHOD mcMethod; // How to Find Period
ENUM_TIMEFRAMES mcPeriod; // Time Period
//
// Long ...
ENUM_X_PERIOD_METHOD lcMethod; // How to Find Period
ENUM_TIMEFRAMES lcPeriod; // Time Period
//
// Hind ...
ENUM_X_PERIOD_METHOD hcMethod; // How to Find Period
ENUM_TIMEFRAMES hcPeriod; // Time Period
//
// Boundary Detection ...
ENUM_SERIESMODE hhMode; // Highest High Calculation Method
ENUM_SERIESMODE llMode; // Lowest Low Calculation Method
//
// Paraboli Sar Detection ...
double sarStep; // Step
double sarMax; // Maximum
//
// VWap Detection ...
int vwapFastLength; // Fast Length
int vwapMidLength; // Mid Length
int vwapSlowLength; // Slow Length
ENUM_APPLIED_PRICE vwapAppliedTo; // Applied To
//
// Donchain Detection ...
int donchainLength; // Donchain Length
//
// Fibonacci ...
double fiboLevel1; // Fibio 1st Level
double fiboLevel2; // Fibio 2st Level
double fiboLevel3; // Fibio 3rd Level
double fiboLevel4; // Fibio 4th Level
double fiboLevel5; // Fibio 5th Level
//
// Presentation ...
//
int startCalculationForLastBars; // Calculate Last n Bars
//
int sarArrowCode; // Parabolic Sar Arrow Code
int peaksArrowCode; // Peaks Arrow Code
int valesArrowCode; // Vales Arrow Code
//
// Global ...
bool showSar; // Show Parabolic Sar
bool showPeaks; // Show Peaks
bool showVales; // Show Vales
bool showVWap; // Show VWap
bool showDonchain; // Show Donchain
//
// Fibonachi Presentation ...
bool showFibo1Levels; // Show Fibo 1st Level
bool showFibo2Levels; // Show Fibo 2nd Level
bool showFibo3Levels; // Show Fibo 3rd Level
bool showFibo4Levels; // Show Fibo 4th Level
bool showFibo5Levels; // Show Fibo 5th Level
//
// VWap Presentation ...
bool showVWapFast; // Show VWap Fast
bool showVWapMedium; // Show VWap Medium
bool showVWapSlow; // Show VWap Slow
//
// Donchain Presentation ...
//
bool showUpper; // Show Upper Band
bool showLower; // Show Lower Band
//
bool showOpen; // Show Open
bool showHigh; // Show High
bool showClose; // Show Close
bool showLow; // Show Low
//
// Constructor ...
X121Inputs()
{
Clean();
}
//
// Tools ...
/**
* Cleaning Up ...
*/
void Clean()
{
//
// Cycles ...
//
// Short ...
scMethod = X_PERIOD_NOTHING;
scPeriod = NULL;
//
// Medium ...
mcMethod = X_PERIOD_NOTHING;
mcPeriod = NULL;
//
// Long ...
lcMethod = X_PERIOD_NOTHING;
lcPeriod = NULL;
//
// Hind ...
hcMethod = X_PERIOD_NOTHING;
hcPeriod = NULL;
//
// Boundary Detection ...
hhMode = MODE_HIGH;
llMode = MODE_LOW;
//
// Paraboli Sar Detection ...
sarStep = 0;
sarMax = 0;
//
// VWap Detection ...
vwapFastLength = 0;
vwapMidLength = 0;
vwapSlowLength = 0;
vwapAppliedTo = PRICE_CLOSE;
//
// Donchain Detection ...
donchainLength = 0;
//
// Fibonacci ...
fiboLevel1 = 0;
fiboLevel2 = 0;
fiboLevel3 = 0;
fiboLevel4 = 0;
fiboLevel5 = 0;
//
// Presentation ...
//
startCalculationForLastBars = 0;
//
sarArrowCode = 0;
peaksArrowCode = 0;
valesArrowCode = 0;
//
// Globals ...
showSar = false;
showPeaks = false;
showVales = false;
showVWap = false;
showDonchain = false;
//
// Fibonachi Presentation ...
showFibo1Levels = false;
showFibo2Levels = false;
showFibo3Levels = false;
showFibo4Levels = false;
showFibo5Levels = false;
//
// VWap Presentation ...
showVWapFast = false;
showVWapMedium = false;
showVWapSlow = false;
//
// Donchain Presentation ...
//
showUpper = false;
showLower = false;
//
showOpen = false;
showHigh = false;
showClose = false;
showLow = false;
}
/**
* Set Default Values ...
*/
void Default()
{
//
// Cycles ...
//
// Short ...
scMethod = X_PERIOD_AUTO;
scPeriod = NULL;
//
// Medium ...
mcMethod = X_PERIOD_AUTO;
mcPeriod = NULL;
//
// Long ...
lcMethod = X_PERIOD_AUTO;
lcPeriod = NULL;
//
// Hind ...
hcMethod = X_PERIOD_AUTO;
hcPeriod = NULL;
//
// Boundary Detection ...
hhMode = MODE_HIGH;
llMode = MODE_LOW;
//
// Paraboli Sar Detection ...
sarStep = 0.02;
sarMax = 0.2;
//
// VWap Detection ...
vwapFastLength = 20;
vwapMidLength = 40;
vwapSlowLength = 60;
vwapAppliedTo = PRICE_CLOSE;
//
// Donchain Detection ...
donchainLength = 40;
//
// Fibonacci ...
fiboLevel1 = 0.236;
fiboLevel2 = 0.382;
fiboLevel3 = 0.5;
fiboLevel4 = 0.618;
fiboLevel5 = 0.764;
//
// Presentation ...
//
startCalculationForLastBars = 1500;
//
sarArrowCode = 159;
peaksArrowCode = 159;
valesArrowCode = 159;
//
// Globals ...
showSar = true;
showPeaks = true;
showVales = true;
showVWap = true;
showDonchain = true;
//
// Fibonachi Presentation ...
showFibo1Levels = false;
showFibo2Levels = false;
showFibo3Levels = true;
showFibo4Levels = false;
showFibo5Levels = false;
//
// VWap Presentation ...
showVWapFast = true;
showVWapMedium = true;
showVWapSlow = true;
//
// Donchain Presentation ...
//
showUpper = true;
showLower = true;
//
showOpen = true;
showHigh = false;
showClose = true;
showLow = false;
}
/**
* Validate ...
*
* @return ( bool )
*/
bool IsValid()
{
//
bool result = false;
//
result =
//
// PSAR ...
sarMax > 0 &&
sarStep > 0 &&
sarMax > sarStep &&
//
// XDON ...
donchainLength > 0 &&
//
// VWAP ...
vwapFastLength > 2 &&
vwapMidLength > vwapFastLength &&
vwapSlowLength > vwapMidLength &&
//
// XPV ...
(IsValid(scMethod, scPeriod) &&
IsValid(mcMethod, mcPeriod) &&
IsValid(lcMethod, lcPeriod) &&
IsValid(hcMethod, hcPeriod))
//
;
//
return result;
}
/**
* Extract Max Input Length ...
*
* @return ( int )
*/
int Max()
{
//
int result = 0;
//
// XVWAP ...
result = MathMax(result, vwapFastLength);
result = MathMax(result, vwapMidLength);
result = MathMax(result, vwapSlowLength);
//
return result;
}
};
//
// Conditions ...
struct X121Conditions
{
//
// Common ...
string symbol;
ENUM_TIMEFRAMES period;
datetime time;
//
// Buffers ...
double peaksBuffer[];
double valesBuffer[];
double sarBuffer[];
double vwapFastBuffer[];
double vwapMidBuffer[];
double vwapSlowBuffer[];
double donOpenUpperBuffer[];
double donOpenLowerBuffer[];
double donCloseUpperBuffer[];
double donCloseLowerBuffer[];
double donHighUpperBuffer[];
double donHighLowerBuffer[];
double donLowUpperBuffer[];
double donLowLowerBuffer[];
double fl1Buffer[];
double fl2Buffer[];
double fl3Buffer[];
double fl4Buffer[];
double fl5Buffer[];
double cHHBuffer[];
double cLLBuffer[];
double sHHBuffer[];
double sLLBuffer[];
double mHHBuffer[];
double mLLBuffer[];
double lHHBuffer[];
double lLLBuffer[];
double hHHBuffer[];
double hLLBuffer[];
double vwapVolumeBuffer[];
double vwapPriceBuffer[];
double vwapFastStateBuffer[];
double vwapMidStateBuffer[];
double vwapSlowStateBuffer[];
double validPeaksBuffer[];
double validValesBuffer[];
//
// Constructor ...
X121Conditions()
{
Clean();
}
//
// Tools ...
/**
* Cleaning Up ...
*/
void Clean()
{
//
// Commons ...
symbol = NULL;
period = NULL;
time = NULL;
//
// Buffers ...
//
Clean(peaksBuffer);
Clean(valesBuffer);
Clean(sarBuffer);
Clean(vwapFastBuffer);
Clean(vwapMidBuffer);
Clean(vwapSlowBuffer);
Clean(donOpenUpperBuffer);
Clean(donOpenLowerBuffer);
Clean(donCloseUpperBuffer);
Clean(donCloseLowerBuffer);
Clean(donHighUpperBuffer);
Clean(donHighLowerBuffer);
Clean(donLowUpperBuffer);
Clean(donLowLowerBuffer);
Clean(fl1Buffer);
Clean(fl2Buffer);
Clean(fl3Buffer);
Clean(fl4Buffer);
Clean(fl5Buffer);
Clean(cHHBuffer);
Clean(cLLBuffer);
Clean(sHHBuffer);
Clean(sLLBuffer);
Clean(mHHBuffer);
Clean(mLLBuffer);
Clean(lHHBuffer);
Clean(lLLBuffer);
Clean(hHHBuffer);
Clean(hLLBuffer);
Clean(vwapVolumeBuffer);
Clean(vwapPriceBuffer);
Clean(vwapFastStateBuffer);
Clean(vwapMidStateBuffer);
Clean(vwapSlowStateBuffer);
Clean(validPeaksBuffer);
Clean(validValesBuffer);
//
ArraySetAsSeries(peaksBuffer, true);
ArraySetAsSeries(valesBuffer, true);
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(vwapFastBuffer, true);
ArraySetAsSeries(vwapMidBuffer, true);
ArraySetAsSeries(vwapSlowBuffer, true);
ArraySetAsSeries(donOpenUpperBuffer, true);
ArraySetAsSeries(donOpenLowerBuffer, true);
ArraySetAsSeries(donCloseUpperBuffer, true);
ArraySetAsSeries(donCloseLowerBuffer, true);
ArraySetAsSeries(donHighUpperBuffer, true);
ArraySetAsSeries(donHighLowerBuffer, true);
ArraySetAsSeries(donLowUpperBuffer, true);
ArraySetAsSeries(donLowLowerBuffer, true);
ArraySetAsSeries(fl1Buffer, true);
ArraySetAsSeries(fl2Buffer, true);
ArraySetAsSeries(fl3Buffer, true);
ArraySetAsSeries(fl4Buffer, true);
ArraySetAsSeries(fl5Buffer, true);
ArraySetAsSeries(cHHBuffer, true);
ArraySetAsSeries(cLLBuffer, true);
ArraySetAsSeries(sHHBuffer, true);
ArraySetAsSeries(sLLBuffer, true);
ArraySetAsSeries(mHHBuffer, true);
ArraySetAsSeries(mLLBuffer, true);
ArraySetAsSeries(lHHBuffer, true);
ArraySetAsSeries(lLLBuffer, true);
ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true);
ArraySetAsSeries(vwapVolumeBuffer, true);
ArraySetAsSeries(vwapPriceBuffer, true);
ArraySetAsSeries(vwapFastStateBuffer, true);
ArraySetAsSeries(vwapMidStateBuffer, true);
ArraySetAsSeries(vwapSlowStateBuffer, true);
ArraySetAsSeries(validPeaksBuffer, true);
ArraySetAsSeries(validValesBuffer, true);
}
/**
* Generate Conditions Scores ...
*
* @param bullishScore: Double, Directional Scores Reference ...
* @param bearishScore: Double, Directional Scores Reference ...
*/
void GenerateScore(
double &bullishScore,
double &bearishScore //
)
{
//
bullishScore = 0;
bearishScore = 0;
//
// TODO: Implement if Required ...
}
/**
* Generate Summary String for Represent Conditions State ...
*
* @param onlyCommons: Boolean, Just Generate Only Commons Conditions ...
* @param onlyConditions: Boolean, Just Generate Only Conditions ...
* @param includeScores: Boolean, Attach Scores Representations on Result ...
* @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ...
* @param separator: String, Separate Lines ...
*
* @return ( string )
*/
string GenerateSummary(
bool onlyCommons = false,
bool onlyConditions = false,
bool includeScores = true,
bool ignoreFalseConditions = true,
string separator = "\n" //
)
{
//
string result = NULL;
//
double bullishScore = 0;
double bearishScore = 0;
GenerateScore(
bullishScore,
bearishScore //
);
//
string scoresStr =
//
"Scores: " + separator +
"---------------" + separator +
"Bullish: " + ToString(bullishScore) + separator +
"Bearish: " + ToString(bearishScore) + separator +
""
//
;
//
string commonStr = GenerateSpecifiedCommonSummary(
this,
separator,
includeScores //
);
//
// TODO: Implement this if required ...
string conditionsStr = "";
//
result =
//
"[" + GetTag() + "]" + separator +
(onlyConditions
? ""
: commonStr) +
(!includeScores
? ""
: scoresStr) +
" " + separator +
(onlyCommons
? ""
: conditionsStr) +
""
//
;
//
return result;
}
/**
* Retrieve nique Tag Identifier ...
*
* @return ( string )
*/
string GetTag()
{
return GetTypeName(this);
}
//
};
//
// Implementation ...
class XCX121Helper : public XCBaseHelper
{
//
public:
//
//
// Constructors ...
XCX121Helper()
: XCBaseHelper(_Symbol, _Period)
{
}
//
// Deconstructor ...
~XCX121Helper()
{
}
//
// Tools ...
/**
* Initialize Indicator Helper ...
*
* @param symbol: String, Symbol ...
* @param period: ENUM_TIMEFRAMES member, Period ...
* @param inputs: X121Inputs instance, Indicator Inputs ...
*
* @return ( bool )
*/
bool Init(
string symbol, // Trading Symbol
ENUM_TIMEFRAMES period, // Trading Period
X121Inputs &inputs // Inputs
)
{
//
bool result = false;
//
mSymbol = symbol;
mPeriod = period;
//
// Validate Inputs ...
result = inputs.IsValid();
if (!result)
{
return result;
}
//
mInputs = inputs;
//
// Setting Arrays As Series ...
ArraySetAsSeries(peaksBuffer, true);
ArraySetAsSeries(valesBuffer, true);
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(vwapFastBuffer, true);
ArraySetAsSeries(vwapMidBuffer, true);
ArraySetAsSeries(vwapSlowBuffer, true);
ArraySetAsSeries(donOpenUpperBuffer, true);
ArraySetAsSeries(donOpenLowerBuffer, true);
ArraySetAsSeries(donCloseUpperBuffer, true);
ArraySetAsSeries(donCloseLowerBuffer, true);
ArraySetAsSeries(donHighUpperBuffer, true);
ArraySetAsSeries(donHighLowerBuffer, true);
ArraySetAsSeries(donLowUpperBuffer, true);
ArraySetAsSeries(donLowLowerBuffer, true);
ArraySetAsSeries(fl1Buffer, true);
ArraySetAsSeries(fl2Buffer, true);
ArraySetAsSeries(fl3Buffer, true);
ArraySetAsSeries(fl4Buffer, true);
ArraySetAsSeries(fl5Buffer, true);
ArraySetAsSeries(cHHBuffer, true);
ArraySetAsSeries(cLLBuffer, true);
ArraySetAsSeries(sHHBuffer, true);
ArraySetAsSeries(sLLBuffer, true);
ArraySetAsSeries(mHHBuffer, true);
ArraySetAsSeries(mLLBuffer, true);
ArraySetAsSeries(lHHBuffer, true);
ArraySetAsSeries(lLLBuffer, true);
ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true);
ArraySetAsSeries(vwapVolumeBuffer, true);
ArraySetAsSeries(vwapPriceBuffer, true);
ArraySetAsSeries(vwapFastStateBuffer, true);
ArraySetAsSeries(vwapMidStateBuffer, true);
ArraySetAsSeries(vwapSlowStateBuffer, true);
ArraySetAsSeries(validPeaksBuffer, true);
ArraySetAsSeries(validValesBuffer, true);
//
mHandler = iCustom(
mSymbol,
mPeriod,
"x-saherelm.x121",
//
// Inputs ...
//
// Cycles ...
"",
//
// Short ...
"",
mInputs.scMethod,
mInputs.scPeriod,
//
// Medium ...
"",
mInputs.mcMethod,
mInputs.mcPeriod,
//
// Long ...
"",
mInputs.lcMethod,
mInputs.lcPeriod,
//
// Hind ...
"",
mInputs.hcMethod,
mInputs.hcPeriod,
//
// Boundary Detection ...
"",
mInputs.hhMode,
mInputs.llMode,
//
// Paraboli Sar Detection ...
"",
mInputs.sarStep,
mInputs.sarMax,
//
// VWap Detection ...
"",
mInputs.vwapFastLength,
mInputs.vwapMidLength,
mInputs.vwapSlowLength,
mInputs.vwapAppliedTo,
//
// Donchain Detection ...
"",
mInputs.donchainLength,
//
// Fibonacci ...
"",
mInputs.fiboLevel1,
mInputs.fiboLevel2,
mInputs.fiboLevel3,
mInputs.fiboLevel4,
mInputs.fiboLevel5,
//
// Presentation ...
"",
mInputs.startCalculationForLastBars,
mInputs.sarArrowCode,
mInputs.peaksArrowCode,
mInputs.valesArrowCode,
//
// Commons ...
mInputs.showSar,
mInputs.showPeaks,
mInputs.showVales,
mInputs.showVWap,
mInputs.showDonchain,
//
// Fibonachi Presentation ...
"",
mInputs.showFibo1Levels,
mInputs.showFibo2Levels,
mInputs.showFibo3Levels,
mInputs.showFibo4Levels,
mInputs.showFibo5Levels,
//
// VWap Presentation ...
"",
mInputs.showVWapFast,
mInputs.showVWapMedium,
mInputs.showVWapSlow,
//
// Donchain Presentation ...
"",
mInputs.showUpper,
mInputs.showLower,
mInputs.showOpen,
mInputs.showHigh,
mInputs.showClose,
mInputs.showLow
//
);
result = mHandler != INVALID_HANDLE;
if (!result)
{
return result;
}
//
return result;
}
/**
* Retrieve Current Indicator Configs ...
*
* @return ( Inputs )
*/
X121Inputs GetInputs()
{
return mInputs;
}
/**
* Set New Indicator Inputs ...
*
* @param inputs: X121Inputs instance, Indicator Inputs ...
*
* @return ( bool )
*/
bool SetInputs(
X121Inputs &inputs // Configs
)
{
//
return Init(
mSymbol,
mPeriod,
inputs
//
);
}
//
// Implement Value Getters ...
//
// XSAR ...
//
double GetSar(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(sarBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return sarBuffer[barIndex];
}
//
int CopySar(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
sarBuffer,
buffer,
forceClean
//
);
}
//
// XPV ...
//
// PEAKS ...
//
double GetPeak(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(peaksBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return peaksBuffer[barIndex];
}
//
int CopyPeak(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
peaksBuffer,
buffer,
forceClean
//
);
}
//
// VALES ...
//
double GetVale(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(valesBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return valesBuffer[barIndex];
}
//
int CopyVale(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
valesBuffer,
buffer,
forceClean
//
);
}
//
// CURRENT ...
//
// HH ...
//
double GetCHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(cHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return cHHBuffer[barIndex];
}
//
int CopyCHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
cHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetCLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(cLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return cLLBuffer[barIndex];
}
//
int CopyCLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
cLLBuffer,
buffer,
forceClean
//
);
}
//
// SHORT ...
//
// HH ...
//
double GetSHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(sHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return sHHBuffer[barIndex];
}
//
int CopySHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
sHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetSLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(sLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return sLLBuffer[barIndex];
}
//
int CopySLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
sLLBuffer,
buffer,
forceClean
//
);
}
//
// MEDIUM ...
//
// HH ...
//
double GetMHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(mHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return mHHBuffer[barIndex];
}
//
int CopyMHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
mHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetMLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(mLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return mLLBuffer[barIndex];
}
//
int CopyMLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
mLLBuffer,
buffer,
forceClean
//
);
}
//
// LONG ...
//
// HH ...
//
double GetLHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(lHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return lHHBuffer[barIndex];
}
//
int CopyLHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
lHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetLLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(lLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return lLLBuffer[barIndex];
}
//
int CopyLLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
lLLBuffer,
buffer,
forceClean
//
);
}
//
// HIND ...
//
// HH ...
//
double GetHHH(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(hHHBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hHHBuffer[barIndex];
}
//
int CopyHHH(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
hHHBuffer,
buffer,
forceClean
//
);
}
//
// LL ...
//
double GetHLL(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(hLLBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hLLBuffer[barIndex];
}
//
int CopyHLL(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
hLLBuffer,
buffer,
forceClean
//
);
}
//
// VALID PEAKS ...
//
double GetValidPeak(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(validPeaksBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return validPeaksBuffer[barIndex];
}
//
int CopyValidPeak(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
validPeaksBuffer,
buffer,
forceClean
//
);
}
//
// VALID VALES ...
//
double GetValidVale(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(validValesBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return validValesBuffer[barIndex];
}
//
int CopyValidVale(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
validValesBuffer,
buffer,
forceClean
//
);
}
//
// XVWAP ...
//
// FAST ...
//
double GetVWapFast(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(vwapFastBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vwapFastBuffer[barIndex];
}
//
int CopyVWapFast(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
vwapFastBuffer,
buffer,
forceClean
//
);
}
//
// STATE FAST ...
//
double GetVWapFastState(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(vwapFastStateBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vwapFastStateBuffer[barIndex];
}
//
int CopyVWapFastState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
vwapFastStateBuffer,
buffer,
forceClean
//
);
}
//
// MID ...
//
double GetVWapMid(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(vwapMidBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vwapMidBuffer[barIndex];
}
//
int CopyVWapMid(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
vwapMidBuffer,
buffer,
forceClean
//
);
}
//
// STATE MID ...
//
double GetVWapMidState(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(vwapMidStateBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vwapMidStateBuffer[barIndex];
}
//
int CopyVWapMidState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
vwapMidStateBuffer,
buffer,
forceClean
//
);
}
//
// SLOW ...
//
double GetVWapSlowBuffer(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(vwapSlowBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vwapSlowBuffer[barIndex];
}
//
int CopyVWapSlow(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
vwapSlowBuffer,
buffer,
forceClean
//
);
}
//
// STATE SLOW ...
//
double GetVWapSlowState(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(vwapSlowStateBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vwapSlowStateBuffer[barIndex];
}
//
int CopyVWapSlowState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
vwapSlowStateBuffer,
buffer,
forceClean
//
);
}
//
// VOLUME ...
//
double GetVWapVolume(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(vwapVolumeBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vwapVolumeBuffer[barIndex];
}
//
int CopyVWapVolume(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
vwapVolumeBuffer,
buffer,
forceClean
//
);
}
//
// PRICE ...
//
double GetVWapPrice(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(vwapPriceBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return vwapPriceBuffer[barIndex];
}
//
int CopyVWapPrice(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
vwapPriceBuffer,
buffer,
forceClean
//
);
}
//
// XDON ...
//
// OPEN ...
//
// UPPER ...
//
double GetDonOpenUpper(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(donOpenUpperBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return donOpenUpperBuffer[barIndex];
}
//
int CopyDonOpenUpper(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
donOpenUpperBuffer,
buffer,
forceClean
//
);
}
//
// LOWER ...
//
double GetDonOpenLower(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(donOpenLowerBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return donOpenLowerBuffer[barIndex];
}
//
int CopyDonOpenLower(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
donOpenLowerBuffer,
buffer,
forceClean
//
);
}
//
// CLOSE ...
//
// UPPER ...
//
double GetDonCloseUpper(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(donCloseUpperBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return donCloseUpperBuffer[barIndex];
}
//
int CopyDonCloseUpper(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
donCloseUpperBuffer,
buffer,
forceClean
//
);
}
//
// LOWER ...
//
double GetDonCloseLower(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(donCloseLowerBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return donCloseLowerBuffer[barIndex];
}
//
int CopyDonCloseLower(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
donCloseLowerBuffer,
buffer,
forceClean
//
);
}
//
// HIGH ...
//
// UPPER ...
//
double GetDonHighUpper(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(donHighUpperBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return donHighUpperBuffer[barIndex];
}
//
int CopyDonHighUpper(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
donHighUpperBuffer,
buffer,
forceClean
//
);
}
//
// LOWER ...
//
double GetDonHighLower(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(donHighLowerBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return donHighLowerBuffer[barIndex];
}
//
int CopyDonHighLower(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
donHighLowerBuffer,
buffer,
forceClean
//
);
}
//
// LOW ...
//
// UPPER ...
//
double GetDonLowUpper(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(donLowUpperBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return donLowUpperBuffer[barIndex];
}
//
int CopyDonLowUpper(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
donLowUpperBuffer,
buffer,
forceClean
//
);
}
//
// LOWER ...
//
double GetDonLoweLower(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(donLowLowerBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return donLowLowerBuffer[barIndex];
}
//
int CopyDonLoweLower(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
donLowLowerBuffer,
buffer,
forceClean
//
);
}
//
// FIBONACCHI ...
//
// LEVEL 1 ...
//
double GetFiboLevel1(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(fl1Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fl1Buffer[barIndex];
}
//
int CopyFiboLevel1(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // FiboLevel To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
fl1Buffer,
buffer,
forceClean
//
);
}
//
// LEVEL 2 ...
//
double GetFiboLevel2(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(fl2Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fl2Buffer[barIndex];
}
//
int CopyFiboLevel2(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // FiboLevel To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
fl2Buffer,
buffer,
forceClean
//
);
}
//
// LEVEL 3 ...
//
double GetFiboLevel3(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(fl3Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fl3Buffer[barIndex];
}
//
int CopyFiboLevel3(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // FiboLevel To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
fl3Buffer,
buffer,
forceClean
//
);
}
//
// LEVEL 4 ...
//
double GetFiboLevel4(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(fl4Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fl4Buffer[barIndex];
}
//
int CopyFiboLevel4(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // FiboLevel To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
fl4Buffer,
buffer,
forceClean
//
);
}
//
// LEVEL 5 ...
//
double GetFiboLevel5(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(fl5Buffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fl5Buffer[barIndex];
}
//
int CopyFiboLevel5(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // FiboLevel To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
fl5Buffer,
buffer,
forceClean
//
);
}
//
// Conditions Generation ...
bool GetConditions(
X121Conditions &conditions, //
int barIndex = 0, //
int loopback = 5 //
)
{
//
bool result = true;
//
if (loopback < 5)
{
loopback = 5;
}
//
conditions.Clean();
//
conditions.symbol = mSymbol;
conditions.period = mPeriod;
conditions.time = TimeCurrent();
//
int zIndex = barIndex;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
int ppIndex = pIndex + 1;
//
// Buffers ...
//
CopySar(
zIndex,
loopback,
conditions.sarBuffer //
);
//
CopyPeak(
zIndex,
loopback,
conditions.peaksBuffer //
);
//
CopyVale(
zIndex,
loopback,
conditions.valesBuffer //
);
//
CopyCHH(
zIndex,
loopback,
conditions.cHHBuffer //
);
//
CopyCLL(
zIndex,
loopback,
conditions.cLLBuffer //
);
//
CopySHH(
zIndex,
loopback,
conditions.sHHBuffer //
);
//
CopySLL(
zIndex,
loopback,
conditions.sLLBuffer //
);
//
CopyMHH(
zIndex,
loopback,
conditions.mHHBuffer //
);
//
CopyMLL(
zIndex,
loopback,
conditions.mLLBuffer //
);
//
CopyLHH(
zIndex,
loopback,
conditions.lHHBuffer //
);
//
CopyLLL(
zIndex,
loopback,
conditions.lLLBuffer //
);
//
CopyHHH(
zIndex,
loopback,
conditions.hHHBuffer //
);
//
CopyHLL(
zIndex,
loopback,
conditions.hLLBuffer //
);
//
CopyValidPeak(
zIndex,
loopback,
conditions.validPeaksBuffer //
);
//
CopyValidVale(
zIndex,
loopback,
conditions.validValesBuffer //
);
//
CopyVWapFast(
zIndex,
loopback,
conditions.vwapFastBuffer //
);
//
CopyVWapFastState(
zIndex,
loopback,
conditions.vwapFastStateBuffer //
);
//
CopyVWapMid(
zIndex,
loopback,
conditions.vwapMidBuffer //
);
//
CopyVWapMidState(
zIndex,
loopback,
conditions.vwapMidStateBuffer //
);
//
CopyVWapSlow(
zIndex,
loopback,
conditions.vwapSlowBuffer //
);
//
CopyVWapSlowState(
zIndex,
loopback,
conditions.vwapSlowStateBuffer //
);
//
CopyVWapVolume(
zIndex,
loopback,
conditions.vwapVolumeBuffer //
);
//
CopyVWapPrice(
zIndex,
loopback,
conditions.vwapPriceBuffer //
);
//
CopyDonOpenUpper(
zIndex,
loopback,
conditions.donOpenUpperBuffer //
);
//
CopyDonOpenLower(
zIndex,
loopback,
conditions.donOpenLowerBuffer //
);
//
CopyDonCloseUpper(
zIndex,
loopback,
conditions.donCloseUpperBuffer //
);
//
CopyDonCloseLower(
zIndex,
loopback,
conditions.donCloseLowerBuffer //
);
//
CopyDonHighUpper(
zIndex,
loopback,
conditions.donHighUpperBuffer //
);
//
CopyDonHighLower(
zIndex,
loopback,
conditions.donHighLowerBuffer //
);
//
CopyDonLowUpper(
zIndex,
loopback,
conditions.donLowUpperBuffer //
);
//
CopyDonLoweLower(
zIndex,
loopback,
conditions.donLowLowerBuffer //
);
//
CopyFiboLevel1(
zIndex,
loopback,
conditions.fl1Buffer //
);
//
CopyFiboLevel2(
zIndex,
loopback,
conditions.fl2Buffer //
);
//
CopyFiboLevel3(
zIndex,
loopback,
conditions.fl3Buffer //
);
//
CopyFiboLevel4(
zIndex,
loopback,
conditions.fl4Buffer //
);
//
CopyFiboLevel5(
zIndex,
loopback,
conditions.fl5Buffer //
);
//
// Conditions ...
// TODO: Implement this if Required ...
//
return result;
}
//
protected:
//
//
private:
//
// Props ...
X121Inputs mInputs; // Inputs ...
//
// Buffers ...
//
// Buffers ...
double peaksBuffer[];
double valesBuffer[];
double sarBuffer[];
double vwapFastBuffer[];
double vwapMidBuffer[];
double vwapSlowBuffer[];
double donOpenUpperBuffer[];
double donOpenLowerBuffer[];
double donCloseUpperBuffer[];
double donCloseLowerBuffer[];
double donHighUpperBuffer[];
double donHighLowerBuffer[];
double donLowUpperBuffer[];
double donLowLowerBuffer[];
double fl1Buffer[];
double fl2Buffer[];
double fl3Buffer[];
double fl4Buffer[];
double fl5Buffer[];
double cHHBuffer[];
double cLLBuffer[];
double sHHBuffer[];
double sLLBuffer[];
double mHHBuffer[];
double mLLBuffer[];
double lHHBuffer[];
double lLLBuffer[];
double hHHBuffer[];
double hLLBuffer[];
double vwapVolumeBuffer[];
double vwapPriceBuffer[];
double vwapFastStateBuffer[];
double vwapMidStateBuffer[];
double vwapSlowStateBuffer[];
double validPeaksBuffer[];
double validValesBuffer[];
//
// Tools ...
/**
* Calculate Buffers ...
*/
void Calculate()
{
//
int totalBars = CountBars();
if (totalBars > 1000)
{
totalBars = 1000;
}
//
// Buffers ...
//
// XSAR ...
CopyBuffer(
mHandler,
X121_SAR_LINE,
0,
totalBars,
sarBuffer
//
);
//
// XPV ...
//
// PEAKS ...
CopyBuffer(
mHandler,
X121_PEAKS_LINE,
0,
totalBars,
peaksBuffer
//
);
//
// VALES ...
CopyBuffer(
mHandler,
X121_VALES_LINE,
0,
totalBars,
valesBuffer
//
);
//
// VALID PEAKS ...
CopyBuffer(
mHandler,
X121_VALID_PEAKS_LINE,
0,
totalBars,
validPeaksBuffer
//
);
//
// VALID VALES ...
CopyBuffer(
mHandler,
X121_VALID_VALES_LINE,
0,
totalBars,
validValesBuffer
//
);
//
// CURRENT ...
//
// HH ...
CopyBuffer(
mHandler,
X121_CURRENT_HH_LINE,
0,
totalBars,
cHHBuffer
//
);
//
// LL ...
CopyBuffer(
mHandler,
X121_CURRENT_LL_LINE,
0,
totalBars,
cLLBuffer
//
);
//
// SHORT ...
//
// HH ...
CopyBuffer(
mHandler,
X121_SHORT_HH_LINE,
0,
totalBars,
sHHBuffer
//
);
//
// LL ...
CopyBuffer(
mHandler,
X121_SHORT_LL_LINE,
0,
totalBars,
sLLBuffer
//
);
//
// MEDIUM ...
//
// HH ...
CopyBuffer(
mHandler,
X121_MEDIUM_HH_LINE,
0,
totalBars,
mHHBuffer
//
);
//
// LL ...
CopyBuffer(
mHandler,
X121_MEDIUM_LL_LINE,
0,
totalBars,
mLLBuffer
//
);
//
// LONG ...
//
// HH ...
CopyBuffer(
mHandler,
X121_LONG_HH_LINE,
0,
totalBars,
lHHBuffer
//
);
//
// LL ...
CopyBuffer(
mHandler,
X121_LONG_LL_LINE,
0,
totalBars,
lLLBuffer
//
);
//
// HIND ...
//
// HH ...
CopyBuffer(
mHandler,
X121_HIND_HH_LINE,
0,
totalBars,
hHHBuffer
//
);
//
// LL ...
CopyBuffer(
mHandler,
X121_HIND_LL_LINE,
0,
totalBars,
hLLBuffer
//
);
//
// XVWAP ...
//
// FAST ...
CopyBuffer(
mHandler,
X121_VWAP_FAST_LINE,
0,
totalBars,
vwapFastBuffer
//
);
//
// FAST STATE ...
CopyBuffer(
mHandler,
X121_VWAP_FAST_STATE_LINE,
0,
totalBars,
vwapFastStateBuffer
//
);
//
// MID ...
CopyBuffer(
mHandler,
X121_VWAP_MID_LINE,
0,
totalBars,
vwapMidBuffer
//
);
//
// MID STATE ...
CopyBuffer(
mHandler,
X121_VWAP_MID_STATE_LINE,
0,
totalBars,
vwapMidStateBuffer
//
);
//
// SLOW ...
CopyBuffer(
mHandler,
X121_VWAP_SLOW_LINE,
0,
totalBars,
vwapSlowBuffer
//
);
//
// SLOW STATE ...
CopyBuffer(
mHandler,
X121_VWAP_SLOW_STATE_LINE,
0,
totalBars,
vwapSlowStateBuffer
//
);
//
// VOLUME ...
CopyBuffer(
mHandler,
X121_VWAP_VOLUME_LINE,
0,
totalBars,
vwapVolumeBuffer
//
);
//
// PRICE ...
CopyBuffer(
mHandler,
X121_VWAP_PRICE_LINE,
0,
totalBars,
vwapPriceBuffer
//
);
//
// FIBONACCI ...
//
// LEVEL 1 ...
CopyBuffer(
mHandler,
X121_FIB_LEVEL_1_LINE,
0,
totalBars,
fl1Buffer
//
);
//
// LEVEL 2 ...
CopyBuffer(
mHandler,
X121_FIB_LEVEL_2_LINE,
0,
totalBars,
fl2Buffer
//
);
//
// LEVEL 3 ...
CopyBuffer(
mHandler,
X121_FIB_LEVEL_3_LINE,
0,
totalBars,
fl3Buffer
//
);
//
// LEVEL 4 ...
CopyBuffer(
mHandler,
X121_FIB_LEVEL_4_LINE,
0,
totalBars,
fl4Buffer
//
);
//
// LEVEL 5 ...
CopyBuffer(
mHandler,
X121_FIB_LEVEL_5_LINE,
0,
totalBars,
fl5Buffer
//
);
}
};
//