Perfect trend line Indicator For MT5
The Perfect trend line Indicator For MT5 has many different names as the first version of this indicator was developed for the old MetaTrader 4 platform. The basic algorithm of this indicator is concentrated on the key difference between the highest and lowest points of the periods. The signals of this indicator are in the form of a dynamic band that limits the upward (bullish) and downward (bearish) movement of the price.
The blood-red color segment works by limiting the bulls and the dark blue line segments limit the bearish drop. The elite traders use the bars and candlestick patterns to find the sweet trading spot in such zones. As the dependency lies on the candlesticks, you have to carefully select the time frame. Choosing the lower time frame might lead you to faulty trading signals. So, try delusive signals. And be sure you are relying on the advanced risk exposure policy to reduce the risk of blowing up the trading account.
Installing the Perfect trend line 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 PTL.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 Perfect trend line Indicator For MT5
The Perfect trend line Indicator For MT5 has 2 parameters to configure.
input int inpFastLength = 3; // Fast length
input int inpSlowLength = 7; // Slow length
Buffers of the Perfect trend line Indicator For MT5
The Perfect trend line Indicator For MT5 provides 8 buffers.
SetIndexBuffer(0,slowlu ,INDICATOR_DATA);
SetIndexBuffer(1,slowld ,INDICATOR_DATA);
SetIndexBuffer(2,fastln ,INDICATOR_DATA);
SetIndexBuffer(3,fastcl ,INDICATOR_COLOR_INDEX);
SetIndexBuffer(4,arrowar,INDICATOR_DATA);
SetIndexBuffer(5,arrowcl,INDICATOR_COLOR_INDEX);
SetIndexBuffer(6,trend ,INDICATOR_CALCULATIONS);
SetIndexBuffer(7,slowln ,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[])
{
int i= prev_calculated-1; if (i lt 0) i=0; for (; i lt rates_total && !_StopFlag; i++)
{
int _startf = i-inpFastLength+1; if (_startf lt 0) _startf = 0;
int _starts = i-inpSlowLength+1; if (_starts lt 0) _starts = 0;
double thighs = high[ArrayMaximum(high,_starts,inpSlowLength)];
double tlows = low [ArrayMinimum(low ,_starts,inpSlowLength)];
double thighf = high[ArrayMaximum(high,_startf,inpFastLength)];
double tlowf = low [ArrayMinimum(low ,_startf,inpFastLength)];
if (i gt 0)
{
slowln[i] = (close[i] gt slowln[i-1]) ? tlows : thighs;
fastln[i] = (close[i] gt fastln[i-1]) ? tlowf : thighf;
trend[i] = trend[i-1];
if (close[i] lt slowln[i] && close[i] lt fastln[i]) trend[i] = 1;
if (close[i] gt slowln[i] && close[i] gt fastln[i]) trend[i] = 0;
arrowar[i] = (trend[i]!=trend[i-1]) ? slowln[i] : EMPTY_VALUE;
slowlu[i] = (trend[i]==0) ? slowln[i] : EMPTY_VALUE;
slowld[i] = (trend[i]==1) ? slowln[i] : EMPTY_VALUE;
}
else { arrowar[i] = slowlu[i] = slowld[i] = EMPTY_VALUE; trend[i] = fastcl[i] = arrowcl[i] = 0; fastln[i] = slowln[i] = close[i]; }
fastcl[i] = arrowcl[i] = trend[i];
}
return(rates_total);
}