/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright ?2007, klot"
#property link      "klot@mail.ru"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Blue
#property indicator_color3 Blue

#import "SSA.ex4" //"FullSSA.dll"
void    fastsingular(double a[],int,int,int,double b[]);

extern int Lag = 100;
extern int NumComps = 4;
extern int N = 300;
extern int ATRPeriod1 = 20;
extern int ATRPeriod2 = 20;
extern int ATRmultiplier1 =2;
extern int ATRmultiplier2 =2;

double g_ibuf_100[];
double g_ibuf_104[];
double g_ibuf_108[];
double gda_112[];
double gda_116[];
double gda_120[];

int init() {
   ArrayResize(gda_112, N);
   ArrayResize(gda_116, N);
   ArrayResize(gda_120, N);
   IndicatorBuffers(3);
   SetIndexBuffer(0, g_ibuf_100);
   SetIndexBuffer(1, g_ibuf_104);
   SetIndexBuffer(2, g_ibuf_108);
   SetIndexStyle(0, DRAW_LINE, EMPTY, 2);
   SetIndexStyle(1, DRAW_LINE, EMPTY, 2);
   SetIndexStyle(2, DRAW_LINE, EMPTY, 2);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int l_ind_counted_0 = IndicatorCounted();
   SetIndexDrawBegin(0, Bars - N);
   for (int li_4 = N - 1; li_4 >= 0; li_4--) {
      gda_112[li_4] = iMA(NULL, 0, 1, 0, MODE_SMA, PRICE_CLOSE, li_4);
      gda_116[li_4] = iMA(NULL, 0, 1, 0, MODE_SMA, PRICE_CLOSE, li_4) + ATRmultiplier1*iATR(NULL, 0, ATRPeriod1, li_4);
      gda_120[li_4] = iMA(NULL, 0, 1, 0, MODE_SMA, PRICE_CLOSE, li_4) - ATRmultiplier2*iATR(NULL, 0, ATRPeriod2, li_4);
   }
   fastsingular(gda_112, N, Lag, NumComps, g_ibuf_100);
   fastsingular(gda_116, N, Lag, NumComps, g_ibuf_104);
   fastsingular(gda_120, N, Lag, NumComps, g_ibuf_108);
   return (0);
}