Last Works on Validating Order Blocks ...
This commit is contained in:
@@ -45,7 +45,9 @@ input ENUM_APPLIED_PRICE strAppliedTo = PRICE_MEDIAN; // Applied To
|
||||
input group "Presentation";
|
||||
|
||||
//
|
||||
input bool showStr = true; // Show Str
|
||||
input bool showStr = true; // Show Str
|
||||
input bool showStrUpper = true; // Show Str Upper
|
||||
input bool showStrLower = true; // Show Str Lower
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
@@ -61,7 +63,7 @@ input bool showStr = true; // Show Str
|
||||
|
||||
//
|
||||
#property indicator_buffers 7
|
||||
#property indicator_plots 1
|
||||
#property indicator_plots 3
|
||||
|
||||
//
|
||||
// STR ...
|
||||
@@ -72,18 +74,44 @@ double strBuffer[];
|
||||
double strColorBuffer[];
|
||||
|
||||
//
|
||||
#define strPlotBufferIndex 1
|
||||
#define strPlotBufferIndex 0
|
||||
#property indicator_label1 "X121 STR"
|
||||
#property indicator_type1 DRAW_COLOR_LINE
|
||||
#property indicator_color1 CLR_NONE, clrLime, clrRed, clrGray
|
||||
#property indicator_style1 STYLE_SOLID
|
||||
#property indicator_width1 2
|
||||
|
||||
//
|
||||
// Up ...
|
||||
#define strUpBufferIndex 2
|
||||
double strUpBuffer[];
|
||||
|
||||
//
|
||||
#define strUpPlotBufferIndex 1
|
||||
#property indicator_label2 "X121 STR U"
|
||||
#property indicator_type2 DRAW_LINE
|
||||
#property indicator_color2 C'255,106,0'
|
||||
#property indicator_style2 STYLE_SOLID
|
||||
#property indicator_width2 1
|
||||
|
||||
//
|
||||
// Down ...
|
||||
#define strDownBufferIndex 3
|
||||
double strDownBuffer[];
|
||||
|
||||
//
|
||||
#define strDownPlotBufferIndex 2
|
||||
#property indicator_label3 "X121 STR D"
|
||||
#property indicator_type3 DRAW_LINE
|
||||
#property indicator_color3 C'255,106,0'
|
||||
#property indicator_style3 STYLE_SOLID
|
||||
#property indicator_width3 1
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
//
|
||||
int mLastBufferIndex = 1;
|
||||
int mLastBufferIndex = 3;
|
||||
|
||||
//
|
||||
// STR ...
|
||||
@@ -98,19 +126,9 @@ double atrBuffer[];
|
||||
#define strPriceBufferIndex mLastBufferIndex + 2
|
||||
double strPriceBuffer[];
|
||||
|
||||
//
|
||||
// Up ...
|
||||
#define strUpBufferIndex mLastBufferIndex + 3
|
||||
double strUpBuffer[];
|
||||
|
||||
//
|
||||
// Down ...
|
||||
#define strDownBufferIndex mLastBufferIndex + 4
|
||||
double strDownBuffer[];
|
||||
|
||||
//
|
||||
// Trend ...
|
||||
#define strStateBufferIndex mLastBufferIndex + 5
|
||||
#define strStateBufferIndex mLastBufferIndex + 3
|
||||
double strStateBuffer[];
|
||||
|
||||
//
|
||||
@@ -245,21 +263,6 @@ int OnCalculate(
|
||||
//
|
||||
// Prepare Buffers ...
|
||||
|
||||
//
|
||||
// Fill All Buffers by Zero ...
|
||||
if (prev_calculated == 0)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
int numOfRequiredAtrs = (prev_calculated > rates_total || prev_calculated < 0)
|
||||
? rates_total
|
||||
: rates_total - prev_calculated;
|
||||
if (prev_calculated > 0)
|
||||
{
|
||||
numOfRequiredAtrs++;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Calculated Bars ...
|
||||
|
||||
@@ -271,7 +274,7 @@ int OnCalculate(
|
||||
bool isPassedRequiredCalculatedBars =
|
||||
//
|
||||
// ATR ...
|
||||
atrCalculatedBars >= numOfRequiredAtrs
|
||||
atrCalculatedBars >= 0
|
||||
//
|
||||
;
|
||||
if (!isPassedRequiredCalculatedBars)
|
||||
@@ -292,14 +295,14 @@ int OnCalculate(
|
||||
|
||||
//
|
||||
// ATR ...
|
||||
int copiedAtrs = CopyBuffer(atrHandler, 0, 0, numOfRequiredAtrs, atrBuffer);
|
||||
int copiedAtrs = CopyBuffer(atrHandler, 0, 0, rates_total, atrBuffer);
|
||||
|
||||
//
|
||||
// Validate Copied Items ...
|
||||
bool isPassedRequiredCopiedItems =
|
||||
//
|
||||
// ATR ...
|
||||
copiedAtrs >= numOfRequiredAtrs
|
||||
copiedAtrs >= 0
|
||||
//
|
||||
;
|
||||
if (!isPassedRequiredCopiedItems)
|
||||
@@ -379,6 +382,20 @@ void DefineBuffers()
|
||||
SetIndexBuffer(strBufferIndex, strBuffer, INDICATOR_DATA);
|
||||
SetIndexBuffer(strColorBufferIndex, strColorBuffer, INDICATOR_COLOR_INDEX);
|
||||
|
||||
//
|
||||
ENUM_DRAW_TYPE strUpDrawType = showStrUpper ? DRAW_LINE : DRAW_NONE;
|
||||
SetIndexBuffer(strUpBufferIndex, strUpBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetDouble(strUpPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(strUpPlotBufferIndex, PLOT_SHOW_DATA, showStrUpper);
|
||||
PlotIndexSetInteger(strUpPlotBufferIndex, PLOT_DRAW_TYPE, strUpDrawType);
|
||||
|
||||
//
|
||||
ENUM_DRAW_TYPE strDownDrawType = showStrLower ? DRAW_LINE : DRAW_NONE;
|
||||
SetIndexBuffer(strDownBufferIndex, strDownBuffer, INDICATOR_DATA);
|
||||
PlotIndexSetDouble(strDownPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||
PlotIndexSetInteger(strDownPlotBufferIndex, PLOT_SHOW_DATA, showStrLower);
|
||||
PlotIndexSetInteger(strDownPlotBufferIndex, PLOT_DRAW_TYPE, strDownDrawType);
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
@@ -386,8 +403,6 @@ void DefineBuffers()
|
||||
// STR ...
|
||||
|
||||
//
|
||||
SetIndexBuffer(strUpBufferIndex, strUpBuffer, INDICATOR_CALCULATIONS);
|
||||
SetIndexBuffer(strDownBufferIndex, strDownBuffer, INDICATOR_CALCULATIONS);
|
||||
SetIndexBuffer(strPriceBufferIndex, strPriceBuffer, INDICATOR_CALCULATIONS);
|
||||
SetIndexBuffer(strStateBufferIndex, strStateBuffer, INDICATOR_CALCULATIONS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user