← К каталогу
Исходный код · ID 3255

Stochastic CCI AA9 MTF TT

stochastic cci aa9 mtf tt.mq5
Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

Stochastic CCI AA9 MTF TT — пользовательский индикатор для MetaTrader 5, объединяющий анализ Stochastic-осциллятора и индикатора CCI (Commodity Channel Index) в одном окне с поддержкой многотаймфрейма (MTF). Индикатор рассчитывает стохастическое значение на основе CCI, применяет скользящие средние для сглаживания и отображает результат в виде линии, гистограммы или точек.

Индикатор предоставляет широкий набор инструментов визуализации: полосы (Боллинджера, Келтнера и другие), сигнальная линия, точки разворота, а также стрелки BUY/SELL на графике цены. Поддерживается фильтр по времени, позволяющий отображать сигналы только в заданном интервале.

В режиме MTF индикатор может перерисовываться. Доступны уведомления через сообщение, звук, электронную почту и мобильные уведомления при наступлении сигнальных условий. На графике размещена интерактивная кнопка для управления отображением.

Получить полный код

Поиск по коду файла

#property description "Commodity Channel Index [CCI] — measures the deviation of the price from its Moving Average." 
#property description "CCI usually varies in the range of ?100. Values above/below ?100 inform about "
#property description "overbuying/overselling state and about a probability of correcting increase." 
#property description "Stochastic oscillator compares the current close price" 
#property description "with the price range for the selected one time period." 
#property description " "
#property description "Repaints in MTF mode!  ARROWBAR && ALERTBAR corrected for MTF."   //"Не перерисовывается в режиме MTF если RePaintMTF=false!"  //"Индикатор НЕ перерисовывается! в режиме MTF."   //"ARROWBAR и ALERTBAR скорректированы для MTF."  
#property description " "  //"ALERTBAR без корректировки на MTF."   //ARROWBAR и ALERTBAR скорректированы для MTF.  "— ^ —"
#property description "E-mail:  t*******e*@mail.ru" 
#property version  "8.17"   

#property indicator_separate_window  //chart_window       
#property indicator_buffers 12

#property indicator_color1  clrSpringGreen  //White  //Lime  //LightCyan  //Aqua  //Lime  //Aqua  //White   //Gold
#property indicator_color2  clrForestGreen  //CornflowerBlue  //LimeGreen  //DarkGray  //MediumSeaGreen  //SpringGreen  //LightSteelBlue  //DeepSkyBlue  //Brown  //DeepPink  //LightSkyBlue  //Magenta    //SkyBlue
#property indicator_color3  clrDeepPink  //LightCoral  //PaleVioletRed  //SpringGreen  //DarkOrchid  //MediumVioletRed  //Red  //HotPink  //Orchid  //HotPink  //Magenta    //SkyBlue
#property indicator_color4  clrHotPink  //Red  //MediumSeaGreen  //MediumOrchid  //Magenta  //DeepPink  //HotPink  //Violet  //Crimson  //MediumVioletRed  //DarkOrchid  //SeaGreen  //LightSteelBlue  //LightCyan  //Gold
#property indicator_color5  clrNONE
#property indicator_color6  clrLime  //White  //LightCyan  //MediumOrchid  //DeepSkyBlue  //Aqua  //Lavender  //SkyBlue  //
#property indicator_color7  clrBlue  //Aqua  //Magenta  //Red  //Gold  //Yellow  //DeepSkyBlue  //LimeGreen  //Orange  //DarkOrange  //Lime
#property indicator_color8  clrSteelBlue  //DarkGreen  //Teal  //Sienna  //MediumVioletRed //Tomato  //HotPink  
#property indicator_color9  clrSteelBlue  //DarkGreen  //Teal  //Sienna  //MediumVioletRed  //Tomato  //HotPink  
#property indicator_color10 clrWhite  //Yellow  //HotPink  //Lime  //HotPink  //Magenta  //Red  //Orchid  //Gold

#property indicator_width1  3
#property indicator_width2  3
#property indicator_width3  3
#property indicator_width4  3
#property indicator_width5  3
#property indicator_width6  2
#property indicator_width7  0
#property indicator_width8  0
#property indicator_width9  0
#property indicator_width10 0

#property indicator_style1  STYLE_SOLID
#property indicator_style2  STYLE_SOLID
#property indicator_style3  STYLE_SOLID
#property indicator_style4  STYLE_SOLID
#property indicator_style5  STYLE_SOLID
#property indicator_style6  STYLE_SOLID
#property indicator_style7  STYLE_SOLID
#property indicator_style8  STYLE_SOLID
#property indicator_style9  STYLE_SOLID
#property indicator_style10 STYLE_DOT

#property indicator_levelcolor C'61,62,63' //clrDarkSlateGray  //DimGray  //C'0,66,0'  //clrDarkSlateBlue   //SteelBlue  //Sienna   //C'60,61,62' //C'66,122,177'  // 
#property indicator_levelwidth 0
#property indicator_levelstyle STYLE_DOT

enum setIntpl { Intp0,/*OFF*/ Intp1,/*HALF*/ Intp2/*FULL*/ };

enum prcSTOX { stoArray,/*CCI price*/ stoLowHig,/*Low/High*/ stoClose/*Close/Close*/ };

enum calcBB { BandsOFF,/*Bands OFF*/ AvgBands,/*Averaged*/ BolBands,/*Bollinger*/ KelBands,/*Keltner*/ MinMax,/*Minimum/Maximum*/ SigBands,/*Signal*/ };

enum showCD { LINE,/*Line*/ sHISTO,/*Standard Histogram*/ aHISTO/*Alternative Histogram*/ };

enum arrows { ArrowsOFF,/*OFF*/ arSignal50,/*Signal cross Center*/ arMoreLess,/*Index more/less Previous*/ arMoreLessLV,/*Index more/less Previous on Level*/ arCrossSignal,/*Index cross Signal*/ arSetup1715,/*Index + Signal setup 1715*/ arExtremeLV,/*Index Extremum on Level*/ arCross50,/*Index cross Center*/ arCrossLev,/*Index cross Level*/ arCrossBB,/*Index cross Bands*/ arMoreLessVLD,/*trend VLADISLAVIAN*/ allArrows/*All setups*/ };

enum setARR { onOFF,/*Arrows OFF*/ onInduk,/*on Indicator*/ onChart,/*on Chart*/ onBoth/*on Indicator & Chart*/ }; 
enum showAR { HideArrows,/*Hide Arrows*/ INSIDE,/*Inside*/ CENTER,/*Center*/ OUTSIDE/*Outside*/ };  //enum showAR { aDoNotCALC, HideArrows, aOnCHART, aOnINDIK }; 

extern int                      History  =  0;    //288=D1/M5 //576=D2/M5; //864=D3/M5; //1152=D4/M5;  //1440=D5/M5;
extern ENUM_TIMEFRAMES        TimeFrame  =  PERIOD_CURRENT;
extern setIntpl           Interpolation  =  Intp0;

extern int                BarsNormalize  =  0;  
extern string                      PAIR  =  "";

extern int                    CciPeriod  =  8;                    //0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711;
extern int                    StoPeriod  =  8;
extern int                    WmaPeriod  =  5;   
extern ENUM_APPLIED_PRICE      CciPrice  =  PRICE_TYPICAL;   
extern prcSTOX                 StoPrice  =  stoArray;  //enum prcSTOX { stoArray, stoLowHig, stoClose };     
extern ENUM_MA_METHOD           WmaMode  =  MODE_LWMA;           

extern int                    PctPeriod  =  0;
extern double                 PctFilter  =  1.0;                   //0.1454, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0, 1.272, 1.414, 1.618, 2.058, 2.618, 3.32, 4.236, 5.35, 6.853.... 

extern ENUM_MA_METHOD           SigMode  =  MODE_LWMA;  //MODE_SMA;  //MODE_EMA;  //MODE_SMMA;    
extern int                    SigPeriod  =  1;      //1;   
extern bool                  SigFastEma  =  false;  

extern calcBB                 BandsType  =  BolBands;  //;    //enum calcBB { BandsOFF, AvgBands, BolBands, KelBands, MinMax, SigBands };
extern int                  BandsPeriod  =  21;  //15;  //33;   //12;  //14;  //288
extern double           BandsDeviations  =  1.618;  //1.0;       
extern ENUM_MA_METHOD         BandsMode  =  MODE_LWMA;  //MODE_SMMA;    

extern int                      DotCode  =  0;  //167;  //110;  //159;    //108;  //
extern showCD                 ShowIndex  =  aHISTO;  //sHISTO;  //LINE;  //
extern bool                ShadowSignal  =  true;
extern int                   CrossLevel  =  100;  
extern int                   TrendLevel  =  200;    
extern bool                  ShowSignal  =  false;  //

extern string                 StartTime  =  "00:01";           
extern string                   EndTime  =  "23:59";       
extern setARR                DrawArrows  =  onBoth;  //onInduk;  //onOFF;  //
extern arrows               WhichArrows  =  arCrossLev;  //enum arrows { ArrowsOFF, arSignal50, arMoreLess, arMoreLessLV, arCrossSignal, arSetup1715, arExtremeLV, arCross50, arCrossLev, arCrossBB, arMoreLessVLD, allArrows };   
extern int                     ARROWBAR  =  0;        //На каком баре рисовать Стрелку: =0 - рисовать на текущем (до закрытия - может исчезнуть)
extern showAR                ShowArrows  =  OUTSIDE;   //HideArrows;  //IN   
extern int                ArrowGapChart  =  3;   //Дистанция от High/Low свечи  
extern int               ArrowGapSubwin  =  33;   //Дистанция от High/Low свечи  
extern color                   ColorBUY  =  clrAqua,    //SpringGreen,  //White,  //Lime,  //LightCyan,   //Turquoise,  //LightSkyBlue,  //White,  //LimeGreen,  //FireBrick,   //  
                              ColorSELL  =  clrGold;    //Orange;  //HotPink;  //Red;  //Magenta;   //LightSalmon;  //Salmon;  //HotPink;  //SlateBlue;   //
extern int                      CodeBUY  =  233,
                               CodeSELL  =  234, 
                              ArrowSize  =  0;    

extern arrows               WhichAlerts  =  arCrossLev;  //arCrossLev;  //allAlerts;  //                          
extern int                     ALERTBAR  =  1;   //На каком баре сигналить....
extern bool               AlertsMessage  =  true,   //false,    
                            AlertsSound  =  true,   //false,
                            AlertsEmail  =  false,
                           AlertsMobile  =  false;
extern string                 SoundFile  =  "alert2.wav";   //"news.wav";  //"expert.wav";  //   //"stops.wav"   //

extern color                  buttColor  =  clrLime;             //Button text color
extern int                     buttSize  =  9;                   //Button text width
extern color                  backColor  =  clrMagenta;          //Button background color               
extern int                        axisX  =  0;                   //Button X axis
extern int                        axisY  =  15;                  //Button Y axis
extern ENUM_BASE_CORNER      buttCorner  =  CORNER_LEFT_UPPER;   //Button base corner
extern int                   buttWindow  =  1;                   //Button in which window
extern string                  buttName  =  "StoxCCI";           //Button text

double POSS1[], POSS2[], NEGG1[], NEGG2[], FAKE[], MAIN[], DOTZ[], LOWER[], UPPER[], SIGMA[], ARRUP[], ARRDN[];    
double TEMP[], FLAG[], STOX[], PONT, DGTS, levLO, levHI, tevLO, tevHI, levZR;
int TFK, MTK, MAX, ARB, SGB;  string sTFR, cTFR, TWIN, PREF;   datetime TimeBar=0, NewTime=0, OneTime=0;  bool boBand=false, boHist=false;      int TikKont=23, ReCalc=1;

string ShortName = "["+(string)CciPeriod+">"+(string)StoPeriod+">"+(string)WmaPeriod+"+"+(string)PctPeriod+"*"+(string)PctFilter+">"+(string)SigPeriod+">"+(string)BandsPeriod+"*"+(string)BandsDeviations+"]";  //+"?"+(string)Periud+

int init()
{
      // код доступен только после оплаты
   }

void DrawHistoLine()
{
   int CHTSCL, HSTS;   int wSZ, bSZ;  //SZH;

   CHTSCL = ChartGetInteger(0,CHART_SCALE,0);         

   switch(CHTSCL) {
     case 0 : HSTS=0;   wSZ=0;  bSZ=0;  break;
     case 1 : HSTS=2;   wSZ=0;  bSZ=0;  break;
     case 2 : HSTS=2;   wSZ=0;  bSZ=2;  break;    
     case 3 : HSTS=4;   wSZ=0;  bSZ=3;  break;
     case 4 : HSTS=8;   wSZ=0;  bSZ=6;  break;
     case 5 : HSTS=16;  wSZ=2;  bSZ=13; break;
     default: HSTS=2;   wSZ=0;  bSZ=3;  break; } 

   SetIndexStyle(0,boHist?DRAW_HISTOGRAM:DRAW_NONE,EMPTY,bSZ);     
   SetIndexStyle(1,boHist?DRAW_HISTOGRAM:DRAW_NONE,EMPTY,bSZ);     
   SetIndexStyle(2,boHist?DRAW_HISTOGRAM:DRAW_NONE,EMPTY,bSZ);     
   SetIndexStyle(3,boHist?DRAW_HISTOGRAM:DRAW_NONE,EMPTY,bSZ);   color fake = ChartGetInteger(0,CHART_COLOR_BACKGROUND);
   SetIndexStyle(4,boHist?DRAW_HISTOGRAM:DRAW_NONE,EMPTY,bSZ,fake);   
}   

void OnDeinit(const int reason)
{ 
   Comment("");   ObjectsDeleteAll(0,PREF,-1,-1); 

   switch(reason)
    {

     case REASON_CHARTCHANGE :
     case REASON_RECOMPILE   :
     case REASON_CLOSE       : break;
     default : ObjectDelete(0,PrefBT);
    }
}     

bool WorkTime(int i)  //фильтр времени для стрелок
{     
   if  (  (TimeToStr(StrToTime(StartTime),TIME_MINUTES) < TimeToStr(StrToTime(EndTime),TIME_MINUTES) 
           && TimeToStr(Time[i],TIME_MINUTES) >= TimeToStr(StrToTime(StartTime),TIME_MINUTES) && TimeToStr(Time[i],TIME_MINUTES) <= TimeToStr(StrToTime(EndTime),TIME_MINUTES)) 
        ||
          (TimeToStr(StrToTime(StartTime),TIME_MINUTES) > TimeToStr(StrToTime(EndTime),TIME_MINUTES)   
           && (TimeToStr(Time[i],TIME_MINUTES) >= TimeToStr(StrToTime(StartTime),TIME_MINUTES) || TimeToStr(Time[i],TIME_MINUTES) <= TimeToStr(StrToTime(EndTime),TIME_MINUTES))) ) 
        return(true);                         
   else return(false);
}

int start()
{
      // код доступен только после оплаты
   }   
   if (buttYes && objSTATE(PrefBT)=="OFF")  return(0);       TikKont++;  //if (TikKont%4==0) {   

   int CountedBars=IndicatorCounted();   
   if (CountedBars<0) return(-1);   //Стандарт+Tankk-Вариант!!!
   if (CountedBars>0) CountedBars--;  int minBars=fmax(iBars(TWIN,0),iBars(TWIN,TimeFrame));
   int limit = (CountedBars>0 && ReCalc>0) ? iBars(TWIN,0)-CountedBars-1+TFK : minBars-MAX-1;  //fmin(iBars(TWIN,0)-CountedBars-1+TFK,minBars-3-MAX);  //+MAX*10*TFK
   if (History>MAX) limit=fmin(History+MAX*3,minBars-3-MAX);  //Comment(limit);
   if (NewTime!=iTime(NULL,0,0)+15) { //ObjectsDeleteAll(0,PREF,-1,-1);  
     if (DrawArrows>1 && WhichArrows>0)  for (int i=0; i<5*TFK; i++) { ObjectDelete(0,PREF+"ArrUP"+(string)Time[i]);  ObjectDelete(0,PREF+"ArrDN"+(string)Time[i]); }
     CountedBars=0;  /*if (History<=MAX) limit=minBars-1;*/  NewTime=iTime(NULL,0,0)+15; }  //Time[0]

if (TikKont%25==0 || CountedBars<3) { ReCalc=1; 

   for (i=limit; i>=0; i--) //for (i=0; i<limit; i++)       
    {        
     int y = iBarShift(TWIN,TimeFrame,iTime(TWIN,0,i),false);    int x = y;  if (i<iBars(TWIN,0)-1) x = iBarShift(TWIN,TimeFrame,iTime(TWIN,0,i+1));    if (i>iBars(TWIN,TimeFrame)-3-MAX) continue;

     double mArray = StoPrice<1  ?  iCCI(TWIN,TimeFrame,CciPeriod,CciPrice,y)  :  StoPrice>1  ?  iCCI(TWIN,TimeFrame,CciPeriod,PRICE_CLOSE,y)  :  iCCI(TWIN,TimeFrame,CciPeriod,PRICE_MEDIAN,y);   //iMA(TWIN,TimeFrame,1,0,0,Price,y);

     double mMin = StoPrice!=1  ?  mArray  :  iCCI(TWIN,TimeFrame,CciPeriod,PRICE_LOW,y);  
     double mMax = StoPrice!=1  ?  mArray  :  iCCI(TWIN,TimeFrame,CciPeriod,PRICE_HIGH,y);  

     for (int k=0; k<StoPeriod; k++) {
       double kArray = StoPrice<1  ?  iCCI(TWIN,TimeFrame,CciPeriod,CciPrice,y+k)  :  StoPrice>1  ?  iCCI(TWIN,TimeFrame,CciPeriod,PRICE_CLOSE,y+k)  :  iCCI(TWIN,TimeFrame,CciPeriod,PRICE_MEDIAN,y+k);   //iMA(TWIN,TimeFrame,1,0,0,Price,y);
       mMin = fmin(mMin,kArray);
       mMax = fmax(mMax,kArray); }    //Comment( mMin +"  :  "+ mMax );

     STOX[i]=0;   STOX[i] = mMax!=mMin  ?  (mArray-mMin) / (mMax-mMin)  :  STOX[i+1];

     TEMP[i]=0;   TEMP[i] = (2.0 * (get4MA(STOX[i],WmaPeriod,WmaMode,false,i,1)-0.5)) *256;    

     MAIN[i]=0;   if (x!=y) MAIN[i] = getNorm0100(TEMP[i],BarsNormalize,y,0);    else MAIN[i] = MAIN[i+1];

     MAIN[i] = getPCTFilter(MAIN[i],PctPeriod,PctFilter,y,0);

     if (MAIN[i]==0 && MAIN[i+1]>0)  MAIN[i]= PONT;   
     if (MAIN[i]==0 && MAIN[i+1]<0)  MAIN[i]=-PONT;

     MAIN[i] = getINTPL(MAIN[i],TimeFrame,Interpolation,i,0);             

     DOTZ[i]=0;    DOTZ[i] = (DotCode>32 && DotCode<256) ? MAIN[i] : 0;   //SymbolInfoDouble(TWIN,SYMBOL_POINT)/10)

     SIGMA[i]=0;   SIGMA[i] = SigPeriod>0 && ShadowSignal ? MAIN[i+SigPeriod] : SigPeriod>1 && !ShadowSignal ? get4MA(MAIN[i],SigPeriod,SigMode,SigFastEma,i,0) : 0;        

     if (x!=y) SIGMA[i] = SIGMA[i];    else SIGMA[i] = SIGMA[i+1];    SIGMA[i] = getINTPL(SIGMA[i],TimeFrame,Interpolation,i,1);    

     if (SIGMA[i]==0 && SIGMA[i+1]>0)  SIGMA[i]= PONT;   
     if (SIGMA[i]==0 && SIGMA[i+1]<0)  SIGMA[i]=-PONT; 

     POSS1[i]=0;   POSS2[i]=0;   NEGG1[i]=0;  NEGG2[i]=0;   FAKE[i]=0;    /*if (!boHist) continue;*/    GetHISTO(ShowIndex,i); 

     LOWER[i]=0;  UPPER[i]=0;   if (x!=y) GetBANDS(i,y);   else { LOWER[i]=LOWER[i+1]; UPPER[i]=UPPER[i+1]; }   LOWER[i] = getINTPL(LOWER[i],TimeFrame,Interpolation,i,2);   UPPER[i] = getINTPL(UPPER[i],TimeFrame,Interpolation,i,3);  

     ARRUP[i]=0;  ARRDN[i]=0;   FLAG[i]=0;                   if (!WorkTime(i))  continue;

     if (WhichAlerts>0)  GetArrAlt(false,WhichAlerts,i);                        if (i>iBars(TWIN,0)-3-MAX*1 || (History>MAX && i>History)) continue;  //обрезал историю для стрелок...
     if (WhichArrows>0 && DrawArrows%2!=0)  GetArrAlt(true,WhichArrows,i);

    } //*конец цикла* 

   if (DrawArrows>1 && WhichArrows>0)  for (i=0; i<9*TFK; i++)  { if (!WorkTime(i)) continue;  GetArrAlt(true,WhichArrows,i); }   

   if (WhichAlerts>0 && (AlertsMessage || AlertsEmail || AlertsMobile || AlertsSound))   
    {
     string sufix="", mesaga="";  //enum arrows { ArrowsOFF, arSignal50, arMoreLess, arMoreLessLV, arCrossSignal, arSetup1715, arExtremeLV, arCross50, arCrossLev, arCrossBB, arMoreLessVLD, allArrows };

     if (FLAG[SGB]==111 || FLAG[SGB]==-111) sufix = "Signal cross Center";  //Zero
     if (FLAG[SGB]==222 || FLAG[SGB]==-222) sufix = "Index cross Previous";
     if (FLAG[SGB]==333 || FLAG[SGB]==-333) sufix = "Index cross Previous on Level";
     if (FLAG[SGB]==444 || FLAG[SGB]==-444) sufix = "Index cross Signal";
     if (FLAG[SGB]==456 || FLAG[SGB]==-456) sufix = "Index + Signal";
     if (FLAG[SGB]==555 || FLAG[SGB]==-555) sufix = "Extremum on Level";
     if (FLAG[SGB]==777 || FLAG[SGB]==-777) sufix = "Index cross Center";
     if (FLAG[SGB]==888 || FLAG[SGB]==-888) sufix = "Index cross Level ?"+string(fabs(CrossLevel));
     if (FLAG[SGB]==899 || FLAG[SGB]==-899) sufix = "Index

Показано первые 50% кода (символов: 34173)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
3 417,30₽ ≈ $41.77