RSI_Levels_Lib_Sample





//+------------------------------------------------------------------+
//|                                        RSI_Levels_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 3

#property indicator_minimum 0
#property indicator_maximum 100

#property indicator_color1  Blue
#property indicator_color2  Red
#property indicator_color3  Yellow

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

extern int HigherLevel     = 70;
extern int LowerLevel      = 30;

// buffers
double Higher[];           // Ïåðåïîêóïêà
double Lower[];            // Ïåðåïðîäàæà
double Values[];           // Ñîáñòâåííî çíà÷åíèÿ

int DigitsUsed = 0;
int EmptyValueUsed = 0;
int Depth = 0;

int init()
{
   Depth = 2;

   // àññîöèèðóåì áóôåðû
   SetIndexBuffer(0, Higher);
   SetIndexBuffer(1, Lower);
   
   // Äëÿ ñîçäàíèÿ ýôôåêòà "ïðîçðà÷íîñòè" ñèãíàëüíûå óðîâíè èìåþò èíäåêñ
   // ìåíüøå, ÷åì îñíîâíîé áóôåð, à òàêæå ó íèõ óâåëè÷åíà øèðèíà ëèíèé
   SetIndexBuffer(2, Values); 
   
   // çàäàåì íàñòðîéêè äëÿ áóôåðîâ
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 3);    // Ñèãíàëüíûå óðîâíè áóäóò ñïëîøíîé òîëñòîé ëèíèåé
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 3);    
   SetIndexStyle(2, DRAW_LINE);                    // çíà÷åíèÿ -- òîíêàÿ ïðÿìàÿ
   
   IndicatorDigits(DigitsUsed);
   
   SetIndexDrawBegin(0, RSIPeriod + 1);
   SetIndexDrawBegin(1, RSIPeriod + 1);
   SetIndexDrawBegin(2, RSIPeriod);
   
   SetLevelValue(0, HigherLevel);
   SetLevelValue(1, LowerLevel);

   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);
   }
   
   MarkLevel(Values, Higher, 0, toCount - 1, HigherLevel, GREATER_THAN, EmptyValueUsed);
   MarkLevel(Values, Lower, 0, toCount - 1, LowerLevel, LESS_THAN, EmptyValueUsed);

   return(0);
}



Sample





Analysis



Market Information Used:



Indicator Curves created:


Implements a curve of type DRAW_LINE

Indicators Used:

Relative strength index


Custom Indicators Used:

Order Management characteristics:

Other Features: