//+------------------------------------------------------------------+ //| TMA.mq4 | //| Matias Romeo | //| mailto:matias.romeo@gmail.com | //+------------------------------------------------------------------+ #property copyright "Matias Romeo" #property link "mailto:matias.romeo@gmail.com" //---- #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Green //Input parameters extern int Periods=30; extern int ApplyTo=0; //Indicator buffers double tma[]; //Global variables int weights[]; double divisor; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,tma); //---- IndicatorShortName("TMA("+Periods+")"); //Calculate weigths ArrayResize(weights,Periods); double dPeriods=Periods; int to=MathCeil(dPeriods/2.0); //---- for(int i=0; i0) counted_bars--; int limit=Bars-counted_bars; if(counted_bars==0) limit-=1+Periods; for(int i=limit-1; i>=0; i--) { double tma_val=0.0; for(int j=0; j