Trix with LR signal Indicator For MT5

Trix with LR signal Indicator For MT5

The Trix with LR signal Indicator For MT5 is based on the Triple Exponential Smoothing Oscillator and Linear Regression. It is an updated version of the normal TRIX, which uses slope instead of linear regression.


The Trix with LR signal - indicator for MetaTrader 5 plots two oscillating lines on an indicator chart below the main trading chart. one of the lines is dotted while the other line is a thick continuous line. The color of the lines also changes depending on the prevailing market trend.


When the color of the lines is blue, it shows that there is a bullish trend. when the color of the lines is orange, it shows that there is a bearish trend. To confirm the trend, the lines cross one another.


when there is a bullish trend, the thick continuous line crosses above the dotted line, while for the bearish trend the dotted line cross above the thick continuous line.


The indicator, therefore, gives its trading signal through a combination of the crossing of the lines and the color change.

FREE Trix with LR signal Indicator

Download the FREE Trix with LR signal Indicator for MT5.

To receive my email 100% sure: 
Put my email on your whitelist!

 

Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

 

Installing the Trix with LR signal 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 TRIX with LR signal.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 Trix with LR signal Indicator For MT5

The Trix with LR signal Indicator For MT5 has 3 parameters to configure.

input int                inpTrixPeriod = 8;            // Trix period
input ENUM_APPLIED_PRICE inpTrixPrice  = PRICE_CLOSE;  // Price
input int                inpSignPeriod = 14;           // Signal period

Buffers of the Trix with LR signal Indicator For MT5

The Trix with LR signal Indicator For MT5 provides 4 buffers.

SetIndexBuffer(0,signal,INDICATOR_DATA);
SetIndexBuffer(1,signalc,INDICATOR_COLOR_INDEX);
SetIndexBuffer(2,val,INDICATOR_DATA);
SetIndexBuffer(3,valc,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);
   if (ArrayRange(workTrix,0)!=rates_total) ArrayResize(workTrix,rates_total);

   //
   //---
   //
   
   double alpha = 2.0/(1.0+inpTrixPeriod);
   int i=(int)MathMax(prev_calculated-1,0); for(; i lt rates_total && !_StopFlag; i++)
     {
      double price = MathLog(getPrice(inpTrixPrice,open,close,high,low,i,rates_total));
            workTrix[i][0] = (i gt 0) ? workTrix[i-1][0]+alpha*(price         -workTrix[i-1][0]) : 0;
            workTrix[i][1] = (i gt 0) ? workTrix[i-1][1]+alpha*(workTrix[i][0]-workTrix[i-1][1]) : 0;
            workTrix[i][2] = (i gt 0) ? workTrix[i-1][2]+alpha*(workTrix[i][1]-workTrix[i-1][2]) : 0;
         
            val[i]     = (i gt 0) ? (workTrix[i-1][2]!=0) ? (workTrix[i][2]-workTrix[i-1][2])/workTrix[i-1][2] : 0 : 0;
            signal[i]  = iLinr(val[i],inpSignPeriod,i,rates_total);
            valc[i]    = (val[i] gt signal[i]) ? 1 :(val[i] lt signal[i]) ? 2 : (i gt 0) ? valc[i-1]: 0;
            signalc[i] = valc[i];
     }
   return (i);
  }

//+------------------------------------------------------------------+
//| Custom functions                                                 |
//+------------------------------------------------------------------+
double workLinr[][1];
//
//---
//
double iLinr(double price, double period, int r, int bars, int instanceNo=0)
{
   if (ArraySize(workLinr)!= bars) ArrayResize(workLinr,bars);

   //
   //
   //
   //
   //
   
      period = MathMax(period,1);
      workLinr[r][instanceNo] = price;
         double lwmw = period; double lwma = lwmw*price;
         double sma  = price;
         for(int k=1; k lt period && (r-k) gt =0; k++)
         {
            double weight = period-k;
                   lwmw  += weight;
                   lwma  += weight*workLinr[r-k][instanceNo];  
                   sma   +=        workLinr[r-k][instanceNo];
         }             
   
   return(3.0*lwma/lwmw-2.0*sma/period);
}
//
//---
//
double getPrice(ENUM_APPLIED_PRICE tprice,const double &open[],const double &close[],const double &high[],const double &low[],int i,int _bars)
  {
   switch(tprice)
     {
      case PRICE_CLOSE:     return(close[i]);
      case PRICE_OPEN:      return(open[i]);
      case PRICE_HIGH:      return(high[i]);
      case PRICE_LOW:       return(low[i]);
      case PRICE_MEDIAN:    return((high[i]+low[i])/2.0);
      case PRICE_TYPICAL:   return((high[i]+low[i]+close[i])/3.0);
      case PRICE_WEIGHTED:  return((high[i]+low[i]+close[i]+close[i])/4.0);
     }
   return(0);
  }

 

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group


Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.