Author: Copyright � 2005, Pavel Kulko
Wiseman 1
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Wiseman 1

//+------------------------------------------------------------------+
//|                                                    Wiseman 1.mq4 |
//|                           Bill Williams Wiseman 1 Divergent bars |
//|                                             Author: David Thomas |
//|                                      MQ4 Conversion: Pavel Kulko |
//|                                                  polk@alba.dp.ua |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Pavel Kulko"
#property link      "polk@alba.dp.ua"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Red

double UpBuf[],DnBuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
   SetIndexStyle(0,DRAW_HISTOGRAM,0,2);
   SetIndexBuffer(0,UpBuf); 
   SetIndexStyle(1,DRAW_HISTOGRAM,0,2);
   SetIndexBuffer(1,DnBuf);
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int result;
   double median;
   int    counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   for(int i=limit; i>=0; i--) {
     result = 0;
     median = (High[i]+Low[i])/2;
     if((Low[i] < Low[i+1]) && (Close[i] > median)) result = -1;
     if((High[i] > High[i+1]) && (Close[i] < median)) result = 1;
     if(result > 0) {
       UpBuf[i] = Low[i];
       DnBuf[i] = High[i];
     }
     if(result < 0) {
       UpBuf[i] = High[i];
       DnBuf[i] = Low[i];
     }
   }
   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 ---