[MT4指标]3LB On Chart
//+------------------------------------------------------------------+
//|                                                      Alijaan.mq4 |
//|                                            http://www.4-iran.com |
//|                                            E-Mail:[email protected] |
//+------------------------------------------------------------------+
#property copyright "Alijaan"
#property link      "http://www.sarmaye.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int       TLB_Start=500;
//---- buffers
double Buffer1;
double Buffer2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,Buffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(1,Buffer2);
//----
   return(0);
  }   
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//--------------------------------------------------------------------------------------
   int i,Counter;
   double Line1,Line2,Line3,Line4;
   double s1;   
   bool First,End,End_Up,End_Down,Trend,Trend_Back;
//--------------------------------------------------------------------------------------
   i = TLB_Start;
   First = True;
   Trend_Back = False;
//--------------------------------------------------------------------------------------
        double t;
   int m,s,k;
   m=Time[0]+Period()*60-CurTime();
   t=m/60.0;
   s=m%60;
   m=(m-m%60)/60;
   t=NormalizeDouble(t,1);
   for (k=1;k<=Bars-1;k++) s1[k]=0.0000001;
   for (k=1;k<=2;k++) s1[k]=t;
//--------------------------------------------------------------------------------------
      Buffer2 = Open;
      Buffer1 = Close;
      First = False;
      End = False;
      Counter = 1;
      if (Close>Open)
      {
         Trend = True ;
         End_Up = False;
         End_Down = True;
         
      }
      else
      {
         Trend = False;
         End_Up = True;
         End_Down = False;
      }
      Line1 = Close;
      Line2 = Open;
      Line3 = Open;
      Line4 = Open;
      i--;
while(End==False)
{
//Down Trend-----------------------------------------------------------------------------
while(End_Down==false)
{
      if(Trend==False)
      {
         if(Line1>Close)
         {
               if(Trend_Back == False)
               {
                  Buffer2 = Line1;
                  Buffer1 = Close;
                  Line4=Line3;
                  Line3=Line2;
                  Line2=Line1;
                  Line1=Close;
                  Counter++;
                  i--;
                  if(i<1)
                  {
                     End = True;
                     End_Up = True;
                     End_Down = True;
                  }
               }
               if(Trend_Back == True)
               {
                  Buffer2 = Line2;
                  Buffer1 = Close;
                  Line4=Line1;
                  Line3=Line1;
                  Line2 = Line2;
                  Line1 = Close;
                  Trend_Back = False;
                  Counter++;
                  i--;
                  if(i<1)
                  {
                     End = True;
                     End_Up = True;
                     End_Down = True;
                  }
               }
         }
         else
         {
            if(Close>Line4)
            {
               Trend = True;
               Trend_Back = True;
               if(i<1)
               {
                  End = True;
                  End_Up = True;
                  End_Down = True;
               }
            }
            else
            {
               i--;
               if(i<1)
               {
                  End = True;
                  End_Up = True;
                  End_Down = True;
               }
            }
         }
         //if(Open==Close)
         //{
         //   i--;
         //   if(i<1)
         //   {
         //      End = True;
         //     End_Up = True;
         //      End_Down = True;
         //   }
         //}         
      }
   if(Trend_Back == True)
   {
      End_Down = True;
      End_Up = False;
      Counter = 0;      
   }
}
//--------------------------------------------------------------------------------------
//Up Trend------------------------------------------------------------------------------
while(End_Up==false)
{
      if(Trend==True)
      {
         if(Line1   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... For The Next Candle To Confirm||>>>");
   return(0);
   break;
case 2 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Open... New Position||>>>");
   return(0);
   break;   
case 3 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Close... The Old Position||>>>");
   return(0);
   break;   
case 4 :
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Open... New Position||>>>");
   return(0);
   break;   
case 5 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Close... The Old Position||>>>");
   return(0);
   break;
case 6 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Open... New Position||>>>");
   return(0);
   break;   
case 7 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Keep... Your Position||>>>");
   return(0);
   break; 
case 8 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Close... The Old Position||>>>");
   return(0);
   break;    
case 9 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Open... New Position||>>>");
   return(0);
   break; 
case 10 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Keep... Your Position||>>>");
   return(0);
   break;    
case 11 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Keep... Your Position||>>>");
   return(0);
   break;    
case 12 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Keep... Your Position||>>>");
   return(0);
   break;    
case 13 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Close... The Old Position||>>>");
   return(0);
   break;   
case 14 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;       
case 15 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;      
case 16 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;      
case 17 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;      
case 18 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;      
case 19 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;      
case 20 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;      
case 21 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;         
case 22 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;     
case 23 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 24 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 25 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;  
case 26 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 27 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 28 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 29 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 30 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 31 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;              
case 32 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 33 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 34 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
case 35 : 
   Comment("Block Number < " + Counter + " >   -----   " + m + " minutes " + s + " Seconds Left To Bar End   -----   " + "Suggestion <<<||Wait... No Suggestion||>>>");
   return(0);
   break;        
      
   
   
}
}
}
//+------------------------------------------------------------------+
3LB%20On%20Chart.jpg 
3LB%20On%20Chart.jpg









