Lsma Indicator For MT4
The Lsma Indicator For MT4 is mostly used to find the trend reversal sign in the price charts. You will find a bold moving average colored in red. When the price trades above the red line, you will notice the price is rallying strongly. On the contrary, when the price trades below the red line, you need to look for the short trade signals. Try to use this tool in a higher period so that you don’t have to deal with the minor trend change in the market.
Installing the Lsma Indicator For MT4
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file lsma.mq4 into the folder MQL4\Indicators of your MT4 installation. After that please restart MT4 and then you will be able to see the indicator in the list of indicators.
Parameters of the Lsma Indicator For MT4
The Lsma Indicator For MT4 has 2 parameters to configure.
extern int period=50;
extern int CountBars=10000; // Êîëè÷åñòâî îòîáðàæàåìûõ áàðîâ
Buffers of the Lsma Indicator For MT4
The Lsma Indicator For MT4 provides 1 buffers.
SetIndexBuffer(0,buffer);
Main Parts Of The Code
void start()
{
int counted_bars=IndicatorCounted();
int limit=Bars-counted_bars;
if(counted_bars==0)
{
limit-=(period+1);
limit=MathMin(CountBars,limit);
}
for(int i=0; i lt limit; i++)
{
buffer[i]=LSMA(period,i);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double LSMA(int ma_period,int shift)
{
double lengthvar;
double tmp;
double sum=0;
for(int i=ma_period; i gt =1; i--)
{
lengthvar=(ma_period+1)/3;
tmp=(i-lengthvar)*Close[ma_period-i+shift];
sum+=tmp;
}
double value=sum*6/(ma_period*(ma_period+1));
return(value);
}
//+------------------------------------------------------------------+