Author: Copyright � 2006, firedave
iDPO
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
iDPO
//+------------------------------------------------------------------+ 
//|                                                          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); 
  } 
//+------------------------------------------------------------------+ 

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---