RCFMA





//+------------------------------------------------------------------+
//|                                                        RCFMA.mq4 |
//|                                         Copyright © 2009, LeMan. |
//|                                                 b-market@mail.ru |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2009, LeMan."
#property  link      "b-market@mail.ru"
//---- íàñòðîéêè èíäèêàòîðà
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Blue
#property  indicator_color2  Red
#property  indicator_width1  1
#property  indicator_width2  1
//---- Âõîäíûå ïàðàìåòðû
extern int FastMA   = 4; // Äëèíà áûñòðîãî ÌÀ
extern int MiddleMA = 9; // Äëèíà ïðîìåæóòî÷íîãî ÌÀ
extern int SlowMA    = 18; // Äëèíà ìåäëåííîãî ÌÀ
extern int TypeMA    = 0; // 0 - ïðîñòîå(SMA), 1 - ýêñïîíåíöèàëüíîå(EMA), 2 - ñãëàæåííîå(SSMA), 3 - ëèíåéíî-âçâåøåííîå(LWMA)
extern int TypePrice = 0; // 0 - Çàêðûòèå, 1 - Îòêðûòèå, 2 - ìàêñèìàëüíàÿ, 3 - ìèíèìàëüíàÿ, 4 - ñðåäíÿÿ, 5 - òèïè÷íàÿ, 6 - âçâåøåííàÿ çàêðûòèÿ
//---- Áóôåðû èíäèêàòîðà
double     WASOMBuffer[];
double     DFMABuffer[];
//+------------------------------------------------------------------+
int init() {
//----
   SetIndexStyle(0, DRAW_HISTOGRAM);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexDrawBegin(1, SlowMA);
   IndicatorDigits(Digits+1);
//----
   SetIndexBuffer(0,WASOMBuffer);
   SetIndexBuffer(1,DFMABuffer);
//----
   IndicatorShortName("RCFMA ("+FastMA+","+MiddleMA+","+SlowMA+")");
   SetIndexLabel(0, "WASOM");
   SetIndexLabel(1, "DFMA");
//----
   return(0);
}
//+------------------------------------------------------------------+
int start() {
   int limit;
   int counted_bars = IndicatorCounted();
//----
   if (counted_bars > 0) counted_bars--;
   limit = Bars-counted_bars;
//----
   for (int i = 0; i < limit; i++) {
      WASOMBuffer[i] = iMA(NULL,0,MiddleMA,0,TypeMA,TypePrice,i)-iMA(NULL,0,SlowMA,0,TypeMA,TypePrice,i);
   }
//----
   for (i = 0; i < limit; i++) {
      DFMABuffer[i] = iMA(NULL,0,FastMA,0,TypeMA,TypePrice,i)-iMA(NULL,0,FastMA,0,TypeMA,TypePrice,i+1);
   }
//----
   return(0);
}
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_HISTOGRAM
Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: