//+------------------------------------------------------------------+ //| RSI_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 8 #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_color1 DeepSkyBlue #property indicator_color2 Coral #property indicator_color3 Red #property indicator_color4 White #property indicator_color5 MediumBlue #property indicator_color6 MediumBlue #property indicator_color7 Lime #property indicator_color8 Gray extern int RSIPeriod = 9; extern int AppliedPrice = 0; extern int MAPeriod = 5; extern int HigherLevel = 70; extern int LowerLevel = 30; // buffers double Higher[]; // Çîíà ïåðåêóïëåííîñòè double Lower[]; // Çîíà ïåðåïðîäàííîñòè double Values[]; // Ñîáñòâåííî çíà÷åíèÿ double SmoothedValues[]; // Ñãëàæåííûå çíà÷åíèÿ double Growing1[]; // ïåðâûé áóôåð ðîñòà double Growing2[]; // âòîðîé áóôåð ðîñòà double Extremums[]; // ïèêè double Crosses[]; // ïåðåñå÷åíèÿ int DigitsUsed = 5; int EmptyValueUsed = 0; int init() { // àññîöèèðóåì áóôåðû // áóôåðû ïåðåêóïëåííîñòè\ïåðåïðîäàííîñòè // äëÿ ïîëó÷åíèÿ ýôôåêòà ïðîçðà÷íîñòè äîëæíû // èìåòü èíäåêñû ìåíüøå ÷åì ó áóôåðà ñî çíà÷åíèÿìè SetIndexBuffer(0, Higher); SetIndexBuffer(1, Lower); // áóôåðû ñî çíà÷åíèÿìè SetIndexBuffer(2, Values); SetIndexBuffer(3, SmoothedValues); // áóôåðû äëÿ ðàñêðàñêè íàïðàâëåíèé SetIndexBuffer(4, Growing1); SetIndexBuffer(5, Growing2); // áóôåð äëÿ ïîìåòêè ïèêîâ\âïàäèí SetIndexBuffer(6, Extremums); // áóôåð äëÿ ïîìåòêè ïåðåñå÷åíèé SetIndexBuffer(7, Crosses); // çàäàåì íàñòðîéêè äëÿ áóôåðîâ SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 4); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 4); SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2); SetIndexStyle(3, DRAW_LINE, STYLE_DOT, 2); SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 2); SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 2); SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, 2); SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, 2); SetIndexArrow(6, 159); SetIndexArrow(7, 251); 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); } // Ñ÷èòàåì ñãëàæåííûå çíà÷åíèÿ for (i = toCount - 1; i >=0; i--) { SmoothedValues[i] = NormalizeDouble(iMAOnArray(Values, 0, MAPeriod, 0, MODE_EMA, i), DigitsUsed); } // Ìåòèì âñå ÷òî ìîæíî. MarkCrosses(Values, SmoothedValues, Crosses, toCount - 1, 0, CROSS_ALL, EmptyValueUsed); MarkGrowing(Values, Growing1, Growing2, toCount - 1, 0, EmptyValueUsed); MarkExtremums(Values, Extremums, toCount - 1, 0, DIR_ALL, EmptyValueUsed); 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
Implements a curve of type DRAW_ARROW
Indicators Used:
Relative strength index
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: