//+------------------------------------------------------------------+ //| i-TestMa200-v1.mq4 | //| Copyright 2020, Leschich. | //| https://forexdengi.com/ | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, Leschich." #property link "https://forexdengi.com/" #property version "1.00" #property indicator_buffers 3 #property indicator_color1 clrMaroon #property indicator_color2 clrRed #property indicator_color3 clrMediumBlue #property indicator_chart_window #property strict input int MA_Period = 200; input ENUM_MA_METHOD MA_Type = MODE_EMA; input ENUM_APPLIED_PRICE MA_Applied = PRICE_CLOSE; //---- buffers double po; double ExtMaBuffer[],PriceBuffer[],BarBuffer[]; int i,dg; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping IndicatorBuffers(3); IndicatorDigits(Digits); SetIndexStyle(0,DRAW_LINE,STYLE_DOT,2); SetIndexBuffer(0,ExtMaBuffer); SetIndexBuffer(1,PriceBuffer); SetIndexBuffer(2,BarBuffer); SetIndexStyle(1,DRAW_ARROW); SetIndexStyle(2,DRAW_ARROW); SetIndexEmptyValue(1,0); SetIndexEmptyValue(2,0); //--- set short name po= SymbolInfoDouble(Symbol(),SYMBOL_POINT); dg=(int)SymbolInfoInteger(Symbol(),SYMBOL_DIGITS); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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[]) { //--- int limit; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i=0; i