SLine 5 - копия

Author: Copyright 2018, MetaQuotes Software Corp.
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
SLine 5 - копия
ÿþ//+------------------------------------------------------------------+

//|                                                        SLINE 1.05.mq4 |

//|                        Copyright 2018, MetaQuotes Software Corp. |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2018, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.06"

#property strict

//--- indicator settings

#property indicator_chart_window

#property indicator_buffers 8

#property indicator_color1 Aqua

#property indicator_color2 Aqua

#property indicator_color3 Green

#property indicator_color4 Green

#property indicator_color5 Red

#property indicator_color6 Red

#property indicator_color7 Yellow

#property indicator_color8 Yellow

//--- indicator buffers

double S1Buffer[];

double R1Buffer[];

double S2Buffer[];

double R2Buffer[];

double S3Buffer[];

double R3Buffer[];

double S4Buffer[];

double R4Buffer[];





//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int OnInit()

  {

     IndicatorShortName("SL");

     IndicatorBuffers(8);

//--- drawing settings 

     SetIndexStyle(0,DRAW_LINE,0,2,Aqua);

     SetIndexStyle(1,DRAW_LINE,0,2,Aqua);

     SetIndexStyle(2,DRAW_LINE,0,2,Green);

     SetIndexStyle(3,DRAW_LINE,0,2,Green);

     SetIndexStyle(4,DRAW_LINE,0,2,Red);

     SetIndexStyle(5,DRAW_LINE,0,2,Red);

     SetIndexStyle(6,DRAW_LINE,0,2,Yellow);

     SetIndexStyle(7,DRAW_LINE,0,2,Yellow);

//--- all indicator buffers mapping

     SetIndexBuffer(0,S1Buffer);

     SetIndexBuffer(1,R1Buffer);

     SetIndexBuffer(2,S2Buffer);

     SetIndexBuffer(3,R2Buffer);

     SetIndexBuffer(4,S3Buffer);

     SetIndexBuffer(5,R3Buffer);

     SetIndexBuffer(6,S4Buffer);

     SetIndexBuffer(7,R4Buffer);

     



   return(INIT_SUCCEEDED);

  }



//+------------------------------------------------------------------+

//| Custom indicator iteration function                              |

//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime &time[],

                const double &open[],

                const double &high[],

                const double &low[],

                const double &close[],

                const long &tick_volume[],

                const long &volume[],

                const int &spread[])

  {

   int limit; 

     int counted_bars=IndicatorCounted(); 

 //--- last counted bar will be recounted 

     if(counted_bars>0) counted_bars--; 

     limit=Bars-counted_bars; 

     for(int i=0; i<limit; i++) 

       { 

        int S1=iHighest(NULL,0,MODE_HIGH,8,i);

         S1Buffer[i]=High[S1]; 

        int R1=iLowest(NULL,0,MODE_LOW,8,i);

         R1Buffer[i]=Low[R1];

         int S2=iHighest(NULL,0,MODE_HIGH,16,i);

         S2Buffer[i]=High[S2]; 

        int R2=iLowest(NULL,0,MODE_LOW,16,i);

         R2Buffer[i]=Low[R2];

         int S3=iHighest(NULL,0,MODE_HIGH,25,i);

         S3Buffer[i]=High[S3]; 

        int R3=iLowest(NULL,0,MODE_LOW,25,i);

         R3Buffer[i]=Low[R3];

          int S4=iHighest(NULL,0,MODE_HIGH,250,i);

         S4Buffer[i]=High[S4]; 

        int R4=iLowest(NULL,0,MODE_LOW,250,i);

         R4Buffer[i]=Low[R4];

         

    

       }

//--- done

   return(rates_total);

  }

Comments