1 //+------------------------------------------------------------------+
\r
3 //| Copyright © 2004, MetaQuotes Software Corp. |
\r
4 //| http://www.metaquotes.net/ |
\r
5 //+------------------------------------------------------------------+
\r
6 #property copyright "Copyright © 2004, MetaQuotes Software Corp."
\r
7 #property link "http://www.metaquotes.net/"
\r
9 #property indicator_separate_window
\r
10 #property indicator_buffers 1
\r
11 #property indicator_color1 DodgerBlue
\r
12 //---- input parameters
\r
13 extern int MomPeriod=14;
\r
16 //+------------------------------------------------------------------+
\r
17 //| Custom indicator initialization function |
\r
18 //+------------------------------------------------------------------+
\r
22 //---- indicator line
\r
23 SetIndexStyle(0,DRAW_LINE);
\r
24 SetIndexBuffer(0,MomBuffer);
\r
25 //---- name for DataWindow and indicator subwindow label
\r
26 short_name="Mom("+MomPeriod+")";
\r
27 IndicatorShortName(short_name);
\r
28 SetIndexLabel(0,short_name);
\r
30 SetIndexDrawBegin(0,MomPeriod);
\r
34 //+------------------------------------------------------------------+
\r
36 //+------------------------------------------------------------------+
\r
39 int i,counted_bars=IndicatorCounted();
\r
41 if(Bars<=MomPeriod) return(0);
\r
44 for(i=1;i<=MomPeriod;i++) MomBuffer[Bars-i]=0.0;
\r
47 if(counted_bars>=MomPeriod) i=Bars-counted_bars-1;
\r
50 MomBuffer[i]=Close[i]*100/Close[i+MomPeriod];
\r
55 //+------------------------------------------------------------------+