UltraFatl Indicator For MT5
The UltraFatl Indicator For MT5 is based on the analysis of Fast Adaptive Trend Line (FATL) indicator and its signal lines. The values of FATL with different time periods are utilized to calculate the average values of FATL indicator. The evaluation of trend direction is dependent on the averaged values for all the signal lines.
The positive and negative trend values are thereafter averaged and used to create a multi-colored histogram. The histogram is plotted using the DRAW_COLOR_HISTOGRAM2 style. Bar colors depend on trend direction, while the width of histogram is a factor of the strength of trend in force.
Installing the UltraFatl 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 ultrafatl.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 UltraFatl Indicator For MT5
The UltraFatl Indicator For MT5 has 16 parameters to configure.
input ENUM_APPLIED_PRICE Applied_price=PRICE_CLOSE; // Applied price
input Smooth_Method W_Method=MODE_JJMA; // Smoothing method
input int StartLength=3; // Initial smoothing period
input int WPhase=100; // Phase
input uint Step=5; // Step
input uint StepsTotal=10; // Total steps
input Smooth_Method SmoothMethod=MODE_JJMA; // Smoothing method
input int SmoothLength=3; // Smoothing length
input int SmoothPhase=100; // Phase
input Applied_price_ IPC=PRICE_CLOSE_; // Applied price
input uint UpLevel=80; // Overbought level (in %)
input uint DnLevel=20; // Oversold level (in %)
input color UpLevelsColor=Blue; // Color of overbought level
input color DnLevelsColor=Blue; // Color of oversold level
input STYLE Levelstyle=DASH_; // Level style
input WIDTH LevelsWidth=Width_1; // Level width
Buffers of the UltraFatl Indicator For MT5
The UltraFatl Indicator For MT5 provides 3 buffers.
SetIndexBuffer(0,BullsBuffer,INDICATOR_DATA);
SetIndexBuffer(1,BearsBuffer,INDICATOR_DATA);
SetIndexBuffer(2,ColorBuffer,INDICATOR_COLOR_INDEX);
Main Parts Of The Code
int OnCalculate(const int rates_total, // number of bars in history at current tick
const int prev_calculated,// number of bars, calculated at previous call
const datetime &time[],
const double &open[],
const double& high[], // high prices
const double& low[], // low prices
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---- checking of bars
if(rates_total lt min_rates_total) return(RESET);
//---- declaration of local variables
int limit,bar,maxbar0,maxbar1,maxbar2;
double upsch,dnsch,fatl,price;
//---- calculation of maxbar starting bar index for XMASeries()
maxbar0=rates_total-1;
maxbar1=maxbar0-min_rates_fatl;
maxbar2=maxbar0-min_rates_xma;
//---- set limit for bars recalculation
if(prev_calculated gt rates_total || prev_calculated lt =0)// checking of first call
limit=maxbar0; // starting index for all bars
else limit=rates_total-prev_calculated; // starting index for new bars
//---- set indexing as time series
ArraySetAsSeries(open,true);
ArraySetAsSeries(low,true);
ArraySetAsSeries(high,true);
ArraySetAsSeries(close,true);
//---- calculation of indicator values
for(bar=limit; bar gt =0 && !IsStopped(); bar--)
{
price=PriceSeries(IPC,bar,open,low,high,close);
fatl=Fatl.FATLSeries(maxbar0,prev_calculated,rates_total,price,bar,true);
for(int sm=int(StepsTotal); sm gt =0 && !IsStopped(); sm--)
invalue0[sm]=XMA[sm].XMASeries(maxbar1,prev_calculated,rates_total,W_Method,WPhase,period[sm],fatl,bar,true);
if(bar gt maxbar2)
{
if(bar) ArrayCopy(invalue1,invalue0,0,0,WHOLE_ARRAY);
continue;
}
upsch=0;
dnsch=0;
for(int sm=int(StepsTotal); sm gt =0 && !IsStopped(); sm--)
if(invalue0[sm] gt invalue1[sm]) upsch++;
else dnsch++;
BullsBuffer[bar]=XMA[StTot1].XMASeries(maxbar2,prev_calculated,rates_total,SmoothMethod,SmoothPhase,SmoothLength,upsch,bar,true);
BearsBuffer[bar]=XMA[StTot2].XMASeries(maxbar2,prev_calculated,rates_total,SmoothMethod,SmoothPhase,SmoothLength,dnsch,bar,true);
if(bar) ArrayCopy(invalue1,invalue0,0,0,WHOLE_ARRAY);
}
//---- set starting index for bars recalculation
if(prev_calculated gt rates_total || prev_calculated lt =0)// checking of first call
limit--;
//---- calculation of indicator values
for(bar=limit; bar gt =0 && !IsStopped(); bar--)
{
ColorBuffer[bar]=0;
if(BullsBuffer[bar] gt BearsBuffer[bar])
{
if(BullsBuffer[bar] gt dUpLevel || BearsBuffer[bar] lt dDnLevel)
{
if(BullsBuffer[bar+1] lt =BullsBuffer[bar]) ColorBuffer[bar]=7;
else ColorBuffer[bar]=8;
}
else
{
if(BullsBuffer[bar+1] lt =BullsBuffer[bar]) ColorBuffer[bar]=5;
else ColorBuffer[bar]=6;
}
}
if(BullsBuffer[bar] lt BearsBuffer[bar])
{
if(BullsBuffer[bar] lt dDnLevel || BearsBuffer[bar] gt dUpLevel)
{
if(BearsBuffer[bar+1] lt =BearsBuffer[bar]) ColorBuffer[bar]=1;
else ColorBuffer[bar]=2;
}
else
{
if(BearsBuffer[bar+1] lt =BearsBuffer[bar]) ColorBuffer[bar]=3;
else ColorBuffer[bar]=4;
}
}
}
//----
return(rates_total);
}
//+------------------------------------------------------------------+