This commit is contained in:
2025-04-09 14:00:39 +03:30
parent 031c5f3462
commit 55ac840a38
6 changed files with 1327 additions and 15 deletions
File diff suppressed because it is too large Load Diff
+62 -7
View File
@@ -35,14 +35,17 @@
//
// Market ...
input group "Market";
input int strLength = 14; // Length
input double strMultiplier = 3; // Multiplier
input ENUM_MA_METHOD strBoundaryMode = MODE_SMA; // Boundary Mode
input ENUM_APPLIED_PRICE strAppliedTo = PRICE_MEDIAN; // Applied To
input int strLength = 14; // Length
input double strMultiplier = 3; // Multiplier
input int vidyaLength = 14; // Smothing Length
input ENUM_MA_METHOD strBoundaryMode = MODE_SMA; // Boundary Mode
input ENUM_APPLIED_PRICE strAppliedTo = PRICE_MEDIAN; // Applied To
input ENUM_APPLIED_PRICE vidyaAppliedTo = PRICE_CLOSE; // Smoothing Applied To
//
input group "Presentation";
input bool showStr = true; // Show Str
input bool showVidya = true; // Show Vidya
input bool showStrMid = true; // Show Str Mid
input bool showStrUpper = true; // Show Str Upper
input bool showStrLower = true; // Show Str Lower
@@ -65,8 +68,8 @@ input bool showStrHighMa = true; // Show High Smoothed Buffer
#property indicator_chart_window
//
#property indicator_buffers 11
#property indicator_plots 6
#property indicator_buffers 12
#property indicator_plots 7
//
// STR ...
@@ -152,11 +155,24 @@ double strMidColorBuffer[];
#property indicator_style6 STYLE_SOLID
#property indicator_width6 1
//
// VIDYA ...
#define vidyaBufferIndex 8
double vidyaBuffer[];
//
#define vidyaPlotBufferIndex 6
#property indicator_label7 "X121 VIDYA"
#property indicator_type7 DRAW_LINE
#property indicator_color7 clrYellow
#property indicator_style7 STYLE_SOLID
#property indicator_width7 1
//
// Data Buffers ...
//
int mLastBufferIndex = 7;
int mLastBufferIndex = 8;
//
// STR ...
@@ -194,6 +210,7 @@ int atrHandler = INVALID_HANDLE;
// MA Handler ...
int lowMaHandler = INVALID_HANDLE;
int highMaHandler = INVALID_HANDLE;
int vidyaHandler = INVALID_HANDLE;
//
bool isStrTrendChanged;
@@ -270,6 +287,22 @@ int OnInit()
return INIT_FAILED;
}
//
// Vidya ...
vidyaHandler = iVIDyA(
_Symbol,
_Period,
strLength,
vidyaLength,
0, // Shift ...
vidyaAppliedTo //
);
isInited = vidyaHandler != 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
@@ -311,6 +344,7 @@ void OnDeinit(const int reason)
//
IndicatorRelease(atrHandler);
IndicatorRelease(vidyaHandler);
IndicatorRelease(lowMaHandler);
IndicatorRelease(highMaHandler);
}
@@ -354,6 +388,10 @@ int OnCalculate(
// ATR ...
int atrCalculatedBars = BarsCalculated(atrHandler);
//
// VIDYA ...
int vidyaCalculatedBars = BarsCalculated(vidyaHandler);
//
// Low Ma ...
int lowMaCalculatedBars = BarsCalculated(lowMaHandler);
@@ -368,6 +406,9 @@ int OnCalculate(
// ATR ...
atrCalculatedBars >= 0 &&
//
// VIDYA ...
vidyaCalculatedBars >= 0 &&
//
// Low Ma ...
lowMaCalculatedBars >= 0 &&
//
@@ -395,6 +436,10 @@ int OnCalculate(
// ATR ...
int copiedAtrs = CopyBuffer(atrHandler, 0, 0, rates_total, atrBuffer);
//
// VYDIA ...
int copiedVidyas = CopyBuffer(vidyaHandler, 0, 0, rates_total, vidyaBuffer);
//
// Low Ma ...
int copiedLowMas = CopyBuffer(lowMaHandler, 0, 0, rates_total, strLowMaBuffer);
@@ -410,6 +455,9 @@ int OnCalculate(
// ATR ...
copiedAtrs >= 0 &&
//
// VIDYA ...
copiedVidyas >= 0 &&
//
// Low Ma ...
copiedLowMas >= 0 &&
//
@@ -522,6 +570,13 @@ void DefineBuffers()
PlotIndexSetInteger(strHighMaPlotBufferIndex, PLOT_SHOW_DATA, showStrHighMa);
PlotIndexSetInteger(strHighMaPlotBufferIndex, PLOT_DRAW_TYPE, strHighMaDrawType);
//
ENUM_DRAW_TYPE vidyaDrawType = showVidya ? DRAW_LINE : DRAW_NONE;
SetIndexBuffer(vidyaBufferIndex, vidyaBuffer, INDICATOR_DATA);
PlotIndexSetDouble(vidyaPlotBufferIndex, PLOT_EMPTY_VALUE, emptyValue);
PlotIndexSetInteger(vidyaPlotBufferIndex, PLOT_SHOW_DATA, showVidya);
PlotIndexSetInteger(vidyaPlotBufferIndex, PLOT_DRAW_TYPE, vidyaDrawType);
//
ENUM_DRAW_TYPE strMidDrawType = showStrMid ? DRAW_COLOR_LINE : DRAW_NONE;
SetIndexBuffer(strMidBufferIndex, strMidBuffer, INDICATOR_DATA);