//+--------------------------------------------------------------------+ //| MomentumVT.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //| Conversion from VT to MT4 by Skyline (glicci@yahoo.it) | //+--------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 DodgerBlue //---- input parameters extern int MomPeriod=10; //---- buffers double MomBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,MomBuffer); //---- name for DataWindow and indicator subwindow label short_name="Mom("+MomPeriod+")"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0,MomPeriod); //---- return(0); } //+------------------------------------------------------------------+ //| Momentum | //+------------------------------------------------------------------+ int start() { int i,counted_bars=IndicatorCounted(); //---- if(Bars<=MomPeriod) return(0); //---- initial zero if(counted_bars<1) for(i=1;i<=MomPeriod;i++) MomBuffer[Bars-i]=0.0; //---- i=Bars-MomPeriod-1; if(counted_bars>=MomPeriod) i=Bars-counted_bars-1; while(i>=0) { MomBuffer[i]=Close[i]-Close[i+MomPeriod]; i--; } return(0); } //+------------------------------------------------------------------+
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:
Custom Indicators Used:
Order Management characteristics:
Other Features: