//+------------------------------------------------------------------+ //| v+-.mq4 | //| //| //+------------------------------------------------------------------+ #property copyright "m" #property link "m" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 DodgerBlue //---- input parameters extern int KPeriod=14; //---- buffers double Buffer[]; double vplus[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- 1 additional buffer used for counting. IndicatorBuffers(2); //---- indicator line SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Buffer); SetIndexBuffer(1,vplus); //---- name for DataWindow and indicator subwindow label short_name="v+-"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0,KPeriod); //---- return(0); } //+------------------------------------------------------------------+ //|sum vplus | //+------------------------------------------------------------------+ int start() { int i,counted_bars=IndicatorCounted(); //---- if(Bars<=KPeriod) return(0); //---- i=Bars-counted_bars-1; while(i>=0) { double high=High[i]; double low =Low[i]; double vol=Volume[i]; double prevmd=(High[i+1] + Low[i+1])/2; double md=(High[i] + Low[i])/2; if(prevmd>=md) return(0); if(prevmd < md) vol ;//////////////// } //--- //---- { if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; for(i=0; i<limit; i++) vplus[i]=iMAOnArray(Buffer,Bars,KPeriod,0,MODE_SMA,i); //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains tick volumes of 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: