RSI_Extremums_Lib_Sample

Author: Copyright � 2009, TheXpert
Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
RSI_Extremums_Lib_Sample
//+------------------------------------------------------------------+
//|                                     RSI_Extremums_Lib_Sample.mq4 |
//|                                       Copyright © 2009, TheXpert |
//|                                           theforexpert@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, TheXpert"
#property link      "theforexpert@gmail.com"

#include <Indicator_Painting.mqh>

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_minimum 0
#property indicator_maximum 100

#property indicator_color1  White
#property indicator_color2  Red

extern int RSIPeriod       = 9;
extern int AppliedPrice    = 0;

// buffers
double Values[];           // Ñîáñòâåííî çíà÷åíèÿ
double Extremums[];        // ïèêè

int DigitsUsed = 5;
int EmptyValueUsed = 0;

int init()
{
   // àññîöèèðóåì áóôåðû
   SetIndexBuffer(0, Values);
   SetIndexBuffer(1, Extremums);
   
   // çàäàåì íàñòðîéêè äëÿ áóôåðîâ
   SetIndexStyle(0, DRAW_LINE);     // Îñíîâíîé ñèãíàë áóäåò ñïëîøíîé ëèíèåé

   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 2);    // Ýêñòðåìóìû áóäóò ïîìå÷àòüñÿ ñèìâîëîì êðóæêà
   SetIndexArrow(1, 159);
   
   IndicatorDigits(DigitsUsed);
   
   SetIndexDrawBegin(0, RSIPeriod);
   SetIndexDrawBegin(1, RSIPeriod + 2);

   return(0);
}

int start()
{
   int toCount = Bars - IndicatorCounted();  

   for (int i = toCount - 1; i >=0; i--)
   {
      Values[i] = NormalizeDouble(iRSI(Symbol(), 0, RSIPeriod, AppliedPrice, i), DigitsUsed);
   }
   
   MarkExtremums(Values, Extremums, toCount - 1, 0, DIR_ALL, EmptyValueUsed);
   
   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 ---