Valid_Swing_HighLow Indicator For MT5
The Valid_Swing_HighLow Indicator For MT5 is an indicator which maps out appropriate high and lows according to its rule-set. The formulation of swing highs and swing lows is a natural occurrence in the market and that will always be the case for an active market however, it is important for traders to have a great analytical sense of direction when it comes to knowing which swing highs and swing lows are valid. This indicator makes that job for traders a lot easier and this is all thanks to a modified version of the normal fractal indicator - the modifications herewith only paints fractals for candlesticks which are either lower or higher than the previous candlesticks. However, the same drawback with the default fractal indicator is present here within this indicator because the lagging characteristic is still in its design therefore it is still important for traders to couple this indicator with pure price action analysis and perhaps a smooth moving average or oscillator which is able to filter out many false trend reversal signals.
Installing the Valid_Swing_HighLow Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file Valid_Swing_HighLow.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the Valid_Swing_HighLow Indicator For MT5
The Valid_Swing_HighLow Indicator For MT5 has 1 parameters to configure.
input ENUM_DRAW_BAR InpDrawBar = BAR_SIGNAL; // Bar of drawing
Buffers of the Valid_Swing_HighLow Indicator For MT5
The Valid_Swing_HighLow Indicator For MT5 provides 3 buffers.
SetIndexBuffer(0,BufferUP,INDICATOR_DATA);
SetIndexBuffer(1,BufferDN,INDICATOR_DATA);
SetIndexBuffer(2,BufferLast,INDICATOR_CALCULATIONS);
Main Parts Of The Code
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[])
{
//--- #AB0= gt 2:0 lt 0AA82 gt 2 1CD5@ gt 2 :0: B09 lt A5@89
ArraySetAsSeries(open,true);
ArraySetAsSeries(high,true);
ArraySetAsSeries(low,true);
//--- @ gt 25@:0 8 @0AGQB : gt ;8G5AB20 ?@ gt AG8BK205 lt KE 10@ gt 2
if(rates_total lt 5) return 0;
//--- @ gt 25@:0 8 @0AGQB : gt ;8G5AB20 ?@ gt AG8BK205 lt KE 10@ gt 2
int limit=rates_total-prev_calculated;
if(limit gt 1)
{
limit=rates_total-5;
ArrayInitialize(BufferUP,EMPTY_VALUE);
ArrayInitialize(BufferDN,EMPTY_VALUE);
ArrayInitialize(BufferLast,0);
}
//--- 0AGQB 8=48:0B gt @0
for(int i=limit; i gt =0 && !IsStopped(); i--)
{
int curr=i+2;
int bar=(InpDrawBar==BAR_SIGNAL ? i : curr);
BufferLast[curr]=0;
BufferUP[i]=BufferDN[i]=EMPTY_VALUE;
if(high[curr] gt high[curr-1] && high[curr] gt high[curr-2] && high[curr] gt high[curr+1] && high[curr] gt high[curr+2])
{
BufferUP[bar]=(InpDrawBar==BAR_SIGNAL ? open[i] : high[bar]);
BufferLast[curr]=1;
Previous(rates_total,i,1,high,low);
}
if(low[curr] lt low[curr-1] && low[curr] lt low[curr-2] && low[curr] lt low[curr+1] && low[curr] lt low[curr+2])
{
BufferDN[bar]=(InpDrawBar==BAR_SIGNAL ? open[i] : low[bar]);
BufferLast[curr]=-1;
Previous(rates_total,i,-1,high,low);
}
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void Previous(const int rates_total,const int index,int flag,const double &high[],const double &low[])
{
int limit=rates_total-2;
for(int i=index+1; i lt =limit; i++)
{
if(BufferLast[i]==flag)
{
if(flag==1 && high[i] lt high[index])
{
BufferLast[i]=0;
break;
}
else if(flag==-1 && low[i] gt low[index])
{
BufferLast[i]=0;
break;
}
}
}
}
//+------------------------------------------------------------------+