SSL_fast_mtf





//+------------------------------------------------------------------+
//|                                                          SSL.mq4 |
//| ssl fast                                                 Kalenzo |
//|                                      bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
//mod2008forextsdml 

#property copyright "Kalenzo"
#property link      "bartlomiej.gorski@gmail.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
#property indicator_style1 STYLE_DOT
extern int Lb = 10;
extern int timeFrame = 0;
extern string  timeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";

double ssl[];
double Hlv[];
string IndicatorFileName;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers(2);
   SetIndexBuffer(0,ssl); SetIndexDrawBegin(0,Lb+1); SetIndexLabel(0,"SSL "+Lb+" ["+timeFrame+"]");
   SetIndexBuffer(1,Hlv);
   
   IndicatorFileName = WindowExpertName();
   timeFrame         = MathMax(timeFrame,Period());

   return(0);
}
int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int counted_bars=IndicatorCounted();
   int i,limit;

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;

   //
   //
   //
   //
   //
   
   if (timeFrame != Period())
   {
      datetime TimeArray[];
         limit = MathMax(limit,timeFrame/Period());
         ArrayCopySeries(TimeArray ,MODE_TIME ,NULL,timeFrame);
         
         //
         //
         //
         //
         //
         
         for(i=0,int y=0; i<limit; i++)
         {
            if(Time[i]<TimeArray[y]) y++;
               ssl[i] = iCustom(NULL,timeFrame,IndicatorFileName,Lb,0,y);
         }
      return(0);         
   }

   //
   //
   //
   //
   //

   for(i=limit;i>=0;i--)
   {
      Hlv[i] = Hlv[i+1];
         if(Close[i]>iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1)) Hlv[i] =  1;
         if(Close[i]<iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1))  Hlv[i] = -1;
      
         if(Hlv[i] == -1)
               ssl[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
         else  ssl[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
   }
   return(0);
}



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains close prices for each bar


Indicator Curves created:



Indicators Used:


Moving average indicator


Custom Indicators Used:
IndicatorFileName

Order Management characteristics:

Other Features: