//+------------------------------------------------------------------+ //| DPO.mq4 //| Ramdass - Conversion only //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_level1 0 extern int x_prd=7; extern int CountBars=500; //---- buffers double dpo[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line IndicatorBuffers(1); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,dpo); //---- return(0); } //+------------------------------------------------------------------+ //| DPO | //+------------------------------------------------------------------+ int start() { if (CountBars>=Bars) CountBars=Bars; SetIndexDrawBegin(0,Bars-CountBars+x_prd+1); int i,counted_bars=IndicatorCounted(); double t_prd; //---- if(Bars<=x_prd) return(0); //---- initial zero if(counted_bars<x_prd) { for(i=1;i<=x_prd;i++) dpo[CountBars-i]=0.0; } //---- i=CountBars-x_prd-1; // saya tidak menggunakan variable ini dan men-set ma_shift=0 // saya blm terlalu mengerti fungsi ma_shift // tp setingan ini memberi hasil yg sama dgn DOsc dr MT3 Indicator // t_prd=x_prd/2+1; // tp beda dgn DPO di TS 8.1, jd saya kembali ke asal lagi t_prd=x_prd/2+1; while(i>=0) { dpo[i]=Close[i]-iMA(NULL,0,x_prd,t_prd,MODE_SMA,PRICE_CLOSE,i); 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:
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: