Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
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);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---