add supports for MANALYSER and attached it to XCAEAHelper ...
This commit is contained in:
@@ -36,21 +36,21 @@
|
||||
// Fast ...
|
||||
input group "Fast";
|
||||
input int fastLength = 6; // Length
|
||||
input ENUM_MA_METHOD fastMethod = MODE_SMA; // Mwethod
|
||||
input ENUM_MA_METHOD fastMethod = MODE_SMA; // Method
|
||||
input ENUM_APPLIED_PRICE fastAppliedTo = PRICE_CLOSE; // Applied To
|
||||
|
||||
//
|
||||
// Medium ...
|
||||
input group "Medium";
|
||||
input int mediumLength = 21; // Length
|
||||
input ENUM_MA_METHOD mediumMethod = MODE_SMA; // Mwethod
|
||||
input ENUM_MA_METHOD mediumMethod = MODE_SMA; // Method
|
||||
input ENUM_APPLIED_PRICE mediumAppliedTo = PRICE_CLOSE; // Applied To
|
||||
|
||||
//
|
||||
// Slow ...
|
||||
input group "Slow";
|
||||
input int slowLength = 34; // Length
|
||||
input ENUM_MA_METHOD slowMethod = MODE_SMA; // Mwethod
|
||||
input ENUM_MA_METHOD slowMethod = MODE_SMA; // Method
|
||||
input ENUM_APPLIED_PRICE slowAppliedTo = PRICE_CLOSE; // Applied To
|
||||
|
||||
//
|
||||
|
||||
@@ -84,6 +84,12 @@ input int vidyaCMOLength = 20; // CMO (Candle Momentum)
|
||||
input int vidyaEMALength = 14; // EMA Length
|
||||
input ENUM_APPLIED_PRICE vidyaAppliedTo = PRICE_CLOSE; // Applied To
|
||||
|
||||
//
|
||||
// Manalyser ...
|
||||
input group "Manalyser";
|
||||
input int manalyserLength = 14; // Length
|
||||
input ENUM_MA_METHOD manalyserMethod = MODE_SMA; // Method
|
||||
|
||||
//
|
||||
input group "Swing Detection";
|
||||
input int swingLength = 5; // Length
|
||||
@@ -104,6 +110,9 @@ input int startCalculationForLastBars = 1000; // Calculate Last n Bars
|
||||
input bool showSar = true; // Show Sar
|
||||
input bool showKI = true; // Show KI
|
||||
input bool showTKI = true; // Show KI Trend
|
||||
input bool showMAH = true; // Show MAH
|
||||
input bool showMAL = true; // Show MAL
|
||||
input bool showMAC = true; // Show MAC
|
||||
input bool showVidya = true; // Show Vidya
|
||||
input bool showTrend = true; // Show Trend
|
||||
input bool showSwings = true; // Show Swings
|
||||
@@ -146,8 +155,8 @@ input int swingHighArrowCode = 226; // Swing High Arrow Code
|
||||
#property indicator_chart_window
|
||||
|
||||
//
|
||||
#property indicator_buffers 34
|
||||
#property indicator_plots 24
|
||||
#property indicator_buffers 37
|
||||
#property indicator_plots 27
|
||||
|
||||
//
|
||||
// Plot Buffers ...
|
||||
@@ -493,10 +502,55 @@ double vidyaColorBuffer[];
|
||||
#property indicator_style24 STYLE_SOLID
|
||||
#property indicator_width24 1
|
||||
|
||||
//
|
||||
// MAH ...
|
||||
|
||||
//
|
||||
#define mahBufferIndex 28
|
||||
#define mahBufferPlotIndex 24
|
||||
double mahBuffer[];
|
||||
|
||||
//
|
||||
#property indicator_label25 "MAH"
|
||||
#property indicator_type25 DRAW_LINE
|
||||
#property indicator_color25 clrMagenta
|
||||
#property indicator_style25 STYLE_SOLID
|
||||
#property indicator_width25 1
|
||||
|
||||
//
|
||||
// MAL ...
|
||||
|
||||
//
|
||||
#define malBufferIndex 29
|
||||
#define malBufferPlotIndex 25
|
||||
double malBuffer[];
|
||||
|
||||
//
|
||||
#property indicator_label26 "MAL"
|
||||
#property indicator_type26 DRAW_LINE
|
||||
#property indicator_color26 clrAqua
|
||||
#property indicator_style26 STYLE_SOLID
|
||||
#property indicator_width26 1
|
||||
|
||||
//
|
||||
// MAC ...
|
||||
|
||||
//
|
||||
#define macBufferIndex 30
|
||||
#define macBufferPlotIndex 26
|
||||
double macBuffer[];
|
||||
|
||||
//
|
||||
#property indicator_label27 "MAC"
|
||||
#property indicator_type27 DRAW_LINE
|
||||
#property indicator_color27 clrYellow
|
||||
#property indicator_style27 STYLE_SOLID
|
||||
#property indicator_width27 1
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
#define mLastBufferIndex 27
|
||||
#define mLastBufferIndex 30
|
||||
|
||||
//
|
||||
#define trendStateBufferIndex mLastBufferIndex + 1
|
||||
@@ -545,6 +599,12 @@ int tkiHandler = INVALID_HANDLE;
|
||||
int vidyaHandler = INVALID_HANDLE;
|
||||
int trendHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
// Manalyser Handlers ...
|
||||
int mahHandler = INVALID_HANDLE;
|
||||
int malHandler = INVALID_HANDLE;
|
||||
int macHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
// XMarketCycle sc;
|
||||
int mSCLength = 0;
|
||||
@@ -653,6 +713,57 @@ int OnInit()
|
||||
return INIT_FAILED;
|
||||
}
|
||||
|
||||
//
|
||||
// MANALYSE ...
|
||||
|
||||
//
|
||||
// MAH ...
|
||||
mahHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
manalyserLength,
|
||||
0,
|
||||
manalyserMethod,
|
||||
PRICE_HIGH //
|
||||
);
|
||||
isInited = mahHandler != INVALID_HANDLE;
|
||||
if (!isInited)
|
||||
{
|
||||
return INIT_FAILED;
|
||||
}
|
||||
|
||||
//
|
||||
// MAL ...
|
||||
malHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
manalyserLength,
|
||||
0,
|
||||
manalyserMethod,
|
||||
PRICE_LOW //
|
||||
);
|
||||
isInited = malHandler != INVALID_HANDLE;
|
||||
if (!isInited)
|
||||
{
|
||||
return INIT_FAILED;
|
||||
}
|
||||
|
||||
//
|
||||
// MAC ...
|
||||
macHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
manalyserLength,
|
||||
0,
|
||||
manalyserMethod,
|
||||
PRICE_CLOSE //
|
||||
);
|
||||
isInited = macHandler != INVALID_HANDLE;
|
||||
if (!isInited)
|
||||
{
|
||||
return INIT_FAILED;
|
||||
}
|
||||
|
||||
//
|
||||
// because in some cases we may have more than one input for
|
||||
// calculation and we must prevent any calculation
|
||||
@@ -758,6 +869,21 @@ int OnCalculate(
|
||||
// TREND ...
|
||||
int trendCalculatedBars = BarsCalculated(trendHandler);
|
||||
|
||||
//
|
||||
// MANALYSER ...
|
||||
|
||||
//
|
||||
// MAH ...
|
||||
int mahCalculatedBars = BarsCalculated(mahHandler);
|
||||
|
||||
//
|
||||
// MAL ...
|
||||
int malCalculatedBars = BarsCalculated(malHandler);
|
||||
|
||||
//
|
||||
// MAC ...
|
||||
int macCalculatedBars = BarsCalculated(macHandler);
|
||||
|
||||
//
|
||||
bool isPassedRequiredCalculatedBars =
|
||||
//
|
||||
@@ -771,7 +897,15 @@ int OnCalculate(
|
||||
vidyaCalculatedBars >= maxLength &&
|
||||
//
|
||||
// TREND ...
|
||||
trendCalculatedBars >= maxLength
|
||||
trendCalculatedBars >= maxLength &&
|
||||
//
|
||||
// MANALYSER ...
|
||||
// MAH ...
|
||||
mahCalculatedBars >= maxLength &&
|
||||
// MAL ...
|
||||
malCalculatedBars >= maxLength &&
|
||||
// MAC ...
|
||||
macCalculatedBars >= maxLength
|
||||
//
|
||||
;
|
||||
if (!isPassedRequiredCalculatedBars)
|
||||
@@ -803,6 +937,21 @@ int OnCalculate(
|
||||
// TREND ...
|
||||
int copiedTrends = CopyBuffer(trendHandler, MAIN_LINE, 0, limit + 1, trendBuffer);
|
||||
|
||||
//
|
||||
// MANALYSER ...
|
||||
|
||||
//
|
||||
// MAH ...
|
||||
int copiedMahs = CopyBuffer(mahHandler, 0, 0, limit, mahBuffer);
|
||||
|
||||
//
|
||||
// MAL ...
|
||||
int copiedMals = CopyBuffer(malHandler, 0, 0, limit, malBuffer);
|
||||
|
||||
//
|
||||
// MAC ...
|
||||
int copiedMacs = CopyBuffer(macHandler, 0, 0, limit, macBuffer);
|
||||
|
||||
//
|
||||
// Validate Copied Items ...
|
||||
bool isPassedRequiredCopiedItems =
|
||||
@@ -817,7 +966,15 @@ int OnCalculate(
|
||||
copiedVidyas >= limit &&
|
||||
//
|
||||
// TREND ...
|
||||
copiedTrends >= limit
|
||||
copiedTrends >= limit &&
|
||||
//
|
||||
// MANALYSER ...
|
||||
// MAH ...
|
||||
copiedMahs >= limit &&
|
||||
// MAL ...
|
||||
copiedMals >= limit &&
|
||||
// MAC ...
|
||||
copiedMacs >= limit
|
||||
//
|
||||
;
|
||||
if (!isPassedRequiredCopiedItems)
|
||||
@@ -871,6 +1028,7 @@ bool ValidateInputs()
|
||||
sarMax > sarStep &&
|
||||
vidyaEMALength > 0 &&
|
||||
vidyaCMOLength > 0 &&
|
||||
manalyserLength > 0 &&
|
||||
//
|
||||
// XCA ...
|
||||
(IsValid(scMethod, scPeriod) &&
|
||||
@@ -898,6 +1056,7 @@ int ExtractMaxLengthOfInputs()
|
||||
result = MathMax(kiLength, swingLength);
|
||||
result = MathMax(result, vidyaCMOLength);
|
||||
result = MathMax(result, vidyaEMALength);
|
||||
result = MathMax(result, manalyserLength);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -1340,6 +1499,60 @@ void DefineBuffers()
|
||||
PlotIndexSetDouble(swingHighBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||
PlotIndexSetInteger(swingHighBufferPlotIndex, PLOT_ARROW, swingHighArrowCode);
|
||||
|
||||
//
|
||||
// MANALYSER ...
|
||||
|
||||
//
|
||||
// MAH ...
|
||||
|
||||
//
|
||||
ENUM_DRAW_TYPE mahDrawType = showMAH ? DRAW_LINE : DRAW_NONE;
|
||||
|
||||
//
|
||||
ArraySetAsSeries(mahBuffer, true);
|
||||
SetIndexBuffer(mahBufferIndex, mahBuffer, INDICATOR_DATA);
|
||||
|
||||
//
|
||||
PlotIndexSetInteger(mahBufferPlotIndex, PLOT_SHOW_DATA, showMAH);
|
||||
PlotIndexSetInteger(mahBufferPlotIndex, PLOT_DRAW_TYPE, mahDrawType);
|
||||
|
||||
//
|
||||
PlotIndexSetDouble(mahBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||
|
||||
//
|
||||
// MAL ...
|
||||
|
||||
//
|
||||
ENUM_DRAW_TYPE malDrawType = showMAL ? DRAW_LINE : DRAW_NONE;
|
||||
|
||||
//
|
||||
ArraySetAsSeries(malBuffer, true);
|
||||
SetIndexBuffer(malBufferIndex, malBuffer, INDICATOR_DATA);
|
||||
|
||||
//
|
||||
PlotIndexSetInteger(malBufferPlotIndex, PLOT_SHOW_DATA, showMAL);
|
||||
PlotIndexSetInteger(malBufferPlotIndex, PLOT_DRAW_TYPE, malDrawType);
|
||||
|
||||
//
|
||||
PlotIndexSetDouble(malBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||
|
||||
//
|
||||
// MAC ...
|
||||
|
||||
//
|
||||
ENUM_DRAW_TYPE macDrawType = showMAC ? DRAW_LINE : DRAW_NONE;
|
||||
|
||||
//
|
||||
ArraySetAsSeries(macBuffer, true);
|
||||
SetIndexBuffer(macBufferIndex, macBuffer, INDICATOR_DATA);
|
||||
|
||||
//
|
||||
PlotIndexSetInteger(macBufferPlotIndex, PLOT_SHOW_DATA, showMAC);
|
||||
PlotIndexSetInteger(macBufferPlotIndex, PLOT_DRAW_TYPE, mahDrawType);
|
||||
|
||||
//
|
||||
PlotIndexSetDouble(macBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user