//+------------------------------------------------------------------+ //| DPO.mq4 | //| Detrend Price Oscillator | //| Copyright © 2006, firedave | //| http://www.fx-review.com/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, firedave" #property link "http://www.fx-review.com/" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 DodgerBlue #property indicator_level1 0 #property indicator_width1 2 extern int FastMAperiod = 30, FastMAtype = 1, FastMAprice = 0, SlowMAperiod = 100, SlowMAtype = 1, SlowMAprice = 0; double TS[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { // IndicatorBuffers(2); IndicatorDigits(0); IndicatorShortName("DPO ("+FastMAperiod+","+SlowMAperiod+")"); SetIndexBuffer(0,TS); SetIndexStyle(0, DRAW_LINE); SetIndexLabel(0,"DPO"); SetIndexDrawBegin(0,2); return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i, limit, counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for (i=limit-1; i>=0; i--) { TS[i] = NormalizeDouble((iMA(NULL,0,FastMAperiod,0,FastMAtype,FastMAprice,i) - iMA(NULL,0,SlowMAperiod,0,SlowMAtype,SlowMAprice,i))/Point,0); } return(0); } //+------------------------------------------------------------------+
Sample
image not available
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: