Ultra Trend Indicator For MT5
The Ultra Trend Indicator For MT5 calculates multiple averages (Jurik Smooth Values) with different perdios and detects the angles of those averages. From these values the direction of the trend and the strength of the trend is calculated. The histogram shows orange areas during downward trends and green areas during upward trends. The height of the colored area shows the strength of the trend.
Installing the Ultra Trend 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 Ultra trend.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 Ultra Trend Indicator For MT5
The Ultra Trend Indicator For MT5 has 5 parameters to configure.
input int inpUtrPeriod = 3; // Start period
input int inpProgression = 5; // Step
input int inpInstances = 30; // Instances
input int inpSmooth = 5; // Ultra trend smoothing period
input int inpSmoothPhase = 100; // Ultra trend smoothing phase
Buffers of the Ultra Trend Indicator For MT5
The Ultra Trend Indicator For MT5 provides 6 buffers.
SetIndexBuffer(0,fillu,INDICATOR_DATA);
SetIndexBuffer(1,filld,INDICATOR_DATA);
SetIndexBuffer(2,valp,INDICATOR_DATA);
SetIndexBuffer(3,valpc,INDICATOR_COLOR_INDEX);
SetIndexBuffer(4,valm,INDICATOR_DATA);
SetIndexBuffer(5,valmc,INDICATOR_COLOR_INDEX);
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[])
{
if(Bars(_Symbol,_Period) lt rates_total) return(prev_calculated);
int endLength=inpUtrPeriod+inpProgression*inpInstances;
int i=(int)MathMax(prev_calculated-1,1); for(; i lt rates_total && !_StopFlag; i++)
{
double valueUp=0;
double valueDn=0;
for(int k=inpUtrPeriod,instance=2; k lt =endLength && i gt 0; k+=inpProgression,instance++)
if(_iSmooth[instance].CalculateValue(close[i-1],k,inpSmoothPhase,i-1,rates_total) lt _iSmooth[instance].CalculateValue(close[i],k,inpSmoothPhase,i,rates_total))
valueUp++;
else valueDn++;
valp[i] = _iSmooth[0].CalculateValue(valueUp,inpSmooth,inpSmoothPhase,i,rates_total);
valm[i] = _iSmooth[1].CalculateValue(valueDn,inpSmooth,inpSmoothPhase,i,rates_total);
valpc[i] = (valp[i] gt valm[i]) ? 1 : 2;
valmc[i] = valpc[i];
fillu[i] = valp[i];
filld[i] = valm[i];
}
return (i);
}
//+------------------------------------------------------------------+