____ ______





// Ñèëà òðåíäà.mq4
// Èíäèêàòîð

// Trend strength indicator
// Îïèñàíèå http://www.kroufr.ru/content/view/697/124/
// Èñïîëüçóåòñÿ ñðàâíåíèå öåíû ñ 6 SMA ñ øàãîì ïåðèîäà PeriodStep (ïî óìîë÷àíèþ 10) íà áîëüøå/ìåíüøå
// Çíà÷åíèÿ èäèêàòîðà: -100, -66,-33, 0, +33, +66, 100
// Êëàññ: îñöèëÿòîð

#property copyright "mandorr@gmail.com"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_minimum -120
#property indicator_maximum  120

extern int PeriodStep=10;    // Øàã ïåðèîäà ñêîëüçÿùèõ
extern int Slowing=3;        // Çàìåäëåíèå îñíîâíîé ëèíèè (ñèãíàëüíàÿ ëèíèÿ)
extern int CountBars=1000;   // Êîëè÷åñòâî îòîáðàæàåìûõ áàðîâ

double buffer0[];
double buffer1[];

void init()
   {
   SetIndexStyle(0,DRAW_LINE,STYLE_DOT,1,Red);
   SetIndexBuffer(0,buffer0);
   SetIndexLabel(0,"Value");
   SetIndexDrawBegin(0,0);

   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2,Red);
   SetIndexBuffer(1,buffer1);
   SetIndexLabel(1,"Signal");
   SetIndexDrawBegin(1,0);

   IndicatorShortName("Ñèëà òðåíäà ("+PeriodStep+","+Slowing+")");
   }

void start()
   {
   int value;
   int step=1; if (PeriodStep>1) step=PeriodStep;
   double x0, x1, x2, x3, x4, x5, x6;
   for (int i=0; i<=CountBars-1; i++)
      {
      x0=Close[i];
      x1=iMA(NULL,0,1*step,0,MODE_SMA,PRICE_CLOSE,i);
      x2=iMA(NULL,0,2*step,0,MODE_SMA,PRICE_CLOSE,i);
      x3=iMA(NULL,0,3*step,0,MODE_SMA,PRICE_CLOSE,i);
      x4=iMA(NULL,0,4*step,0,MODE_SMA,PRICE_CLOSE,i);
      x5=iMA(NULL,0,5*step,0,MODE_SMA,PRICE_CLOSE,i);
      x6=iMA(NULL,0,6*step,0,MODE_SMA,PRICE_CLOSE,i);
      value=0;
      if (x1<x0) value++;
      if (x2<x0) value++;
      if (x3<x0) value++;
      if (x4<x0) value++;
      if (x5<x0) value++;
      if (x6<x0) value++;
      if (x1>x0) value--;
      if (x2>x0) value--;
      if (x3>x0) value--;
      if (x4>x0) value--;
      if (x5>x0) value--;
      if (x6>x0) value--;
      buffer0[i]=100*value/6;
      }
   for (i=0; i<=CountBars-1; i++)
      {
      buffer1[i]=iMAOnArray(buffer0,0,Slowing,0,MODE_SMA,i);
      }
   }





Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: