//+------------------------------------------------------------------+ //| Custom Moving Average.mq4 | //| Copyright © 2008, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property indicator_chart_window #property indicator_buffers 1 //#property indicator_color1 Red //---- indicator parameters extern int MA_Period=13; extern int MA_Shift=0; extern int MA_Method=0; extern int MA_Applied=0; extern int Fontsize=10; extern color Color_1 = Red; //---- indicator buffers double ExtMapBuffer[]; //---- int ExtCountedBars=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { int draw_begin; string short_name; SetIndexStyle(0,DRAW_LINE,EMPTY,EMPTY,Color_1); SetIndexShift(0,MA_Shift); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); if(MA_Period<2) MA_Period=13; draw_begin=MA_Period-1; switch(MA_Method) { case 1 : short_name="EMA("; draw_begin=0; break; case 2 : short_name="SMMA("; break; case 3 : short_name="LWMA("; break; default : MA_Method=0; short_name="SMA("; } IndicatorShortName(short_name+MA_Period+")"); SetIndexDrawBegin(0,draw_begin); SetIndexBuffer(0,ExtMapBuffer); return(0); } int start() { int limit; string short_name; int counted_bars=IndicatorCounted(); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int i=0; i