/* вызов из кодов - стандартные поля + поле Gap double iCustom( string symbol, // символьное имя инструмента (NULL- текущий) int timeframe, // тайм-фрейм (0- текущий) "iRSI.G", // имя этого индикатора // int period, // период RSI int applied_price, // тип цены: // 0 - PRICE_CLOSE - цена закрытия // 1 - PRICE_OPEN - цена открытия // 2 - PRICE_HIGH - макс.цена // 3 - PRICE_LOW - мин.цена // 4 - PRICE_MEDIAN - средняя цена,(high+low)/2 // 5 - PRICE_TYPICAL - типичная цена,(high+low+close)/3 // 6 - PRICE_WEIGHTED - взвешенная цена закрытия,(high+low+close+close)/4 // 7 - объем int GapPoints, // порог идентификации гэпа в пп. // int mode, // mode - номер буфера индикатора (0) int shift // сдвиг ) ============== iCustom(NULL,0,"iRSI.G",RSIperiod,Price,GapPoints, 0,i); */ #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 DodgerBlue #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_level1 30 #property indicator_level2 70 // входные параметры extern int RSIperiod=14; // период RSI extern int Price=0; // тип цены extern int GapPoints=0; // порог идентификации гэпа в пп. int GapHours=8; // порог по времени в часах (>0) или в минутах (<0) // массивы буферов double Ind[]; // буфер индикатора double price[]; // буфер безгэповых котировок void init() { // короткое имя string short_name="RSI("+RSIperiod+")"; IndicatorShortName(short_name); // буферы SetIndexBuffer(0,Ind); // буфер индикатора SetIndexLabel(0,short_name); SetIndexDrawBegin(0,RSIperiod); IndicatorBuffers(2); SetIndexBuffer(1,price); // буфер безгэповых котировок } void start() { // граница пересчета int limit=Bars-IndicatorCounted()-1; if(limit>1) limit=Bars-1; // заполнение массива безгэповыми котировками for(int i=limit; i>=0; i--) price[i]=iCustom(NULL,0,"KillGap",GapPoints,GapHours,Price, 0,i); // расчет индикатора по массиву price[] for(i=limit; i>=0; i--) Ind[i]=iRSIOnArray(price,Bars,RSIperiod,i); }