//+------------------------------------------------------------------+ //| Copyright © 2009, Ivan Kornilov| //| XSUM.mq4| //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, Ivan Kornilov" #property link "excelf@gmail.com" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 DodgerBlue #property indicator_color2 Red extern int period = 21; extern int shift = 5; extern int ma = 10; double XBuffer[]; double MABuffer[]; double minVolume; int init() { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0, XBuffer); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1, MABuffer); SetIndexDrawBegin(0, (period+ma)); SetIndexDrawBegin(1, (period+ma)); IndicatorShortName("XSUM(" + period + "," + ma + ")"); } int start() { int i; int j; int counted_bars=IndicatorCounted(); if(counted_bars > 0) { counted_bars--; } int limit = Bars - counted_bars; for(i = limit - 1 ; i >= 0; i--) { double sum = 0; for(j=i;j