//+------------------------------------------------------------------+ //| TMA.mq5 | //| Copyright © 2006, Matias Romeo | //| mailto:matias.romeo@gmail.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Matias Romeo" #property link "mailto:matias.romeo@gmail.com" //---- indicator version number #property version "1.00" //---- drawing the indicator in the main window #property indicator_chart_window //---- number of indicator buffers #property indicator_buffers 1 //---- only one plot is used #property indicator_plots 1 //+-----------------------------------+ //| Indicator drawing parameters | //+-----------------------------------+ //---- drawing the indicator as a line #property indicator_type1 DRAW_LINE //---- DodgerBlue color is used as the color of the bullish line of the indicator #property indicator_color1 clrDodgerBlue //---- the indicator line is a continuous curve #property indicator_style1 STYLE_SOLID //---- indicator line width is equal to 1 #property indicator_width1 1 //---- displaying the indicator label #property indicator_label1 "TMA" //+-----------------------------------+ //| INDICATOR INPUT PARAMETERS | //+-----------------------------------+ input uint Length=30; // smoothing depth input int Shift=0; // horizontal shift of the indicator in bars input int PriceShift=0; // vertical shift of the indicator in pointsõ //+-----------------------------------+ //---- declaration of a dynamic array that further // will be used as an indicator buffer double TMA[]; //---- Declaration of the average vertical shift value variable double dPriceShift; //---- Declaration of integer variables of data starting point int min_rates_total; int divisor; int weights[]; //+------------------------------------------------------------------+ //| TMA indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //---- Initialization of variables of the start of data calculation min_rates_total=int(MathCeil(Length/2.0)); ArrayResize(weights,min_rates_total); for(int iii=0; iii