3LB On Chart

Author: Alijaan
3LB On Chart
Price Data Components
Series array that contains open time of each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
3LB On Chart
//+------------------------------------------------------------------+
//|                                                      Alijaan.mq4 |
//|                                            http://www.4-iran.com |
//|                                            E-Mail:Ali@4-iran.com |
//+------------------------------------------------------------------+
#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[i] = Open[i];
      Buffer1[i] = Close[i];
      First = False;
      End = False;
      Counter = 1;
      if (Close[i]>Open[i])
      {
         Trend = True ;
         End_Up = False;
         End_Down = True;
         
      }
      else
      {
         Trend = False;
         End_Up = True;
         End_Down = False;
      }
      Line1 = Close[i];
      Line2 = Open[i];
      Line3 = Open[i];
      Line4 = Open[i];
      i--;




while(End==False)
{




//Down Trend-----------------------------------------------------------------------------

while(End_Down==false)
{
      if(Trend==False)
      {
         if(Line1>Close[i])
         {
               if(Trend_Back == False)
               {
                  Buffer2[i] = Line1;
                  Buffer1[i] = Close[i];
                  Line4=Line3;
                  Line3=Line2;
                  Line2=Line1;
                  Line1=Close[i];
                  Counter++;
                  i--;
                  if(i<1)
                  {
                     End = True;
                     End_Up = True;
                     End_Down = True;
                  }
               }
               if(Trend_Back == True)
               {
                  Buffer2[i] = Line2;
                  Buffer1[i] = Close[i];
                  Line4=Line1;
                  Line3=Line1;
                  Line2 = Line2;
                  Line1 = Close[i];
                  Trend_Back = False;
                  Counter++;
                  i--;
                  if(i<1)
                  {
                     End = True;
                     End_Up = True;
                     End_Down = True;
                  }
               }
         }
         else
         {
            if(Close[i]>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[i]==Close[i])
         //{
         //   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<Close[i])
         {
               if(Trend_Back == False)
               {
                  Buffer2[i] = Line1;
                  Buffer1[i] = Close[i];
                  Line4=Line3;
                  Line3=Line2;
                  Line2=Line1;
                  Line1=Close[i];
                  Counter++;
                  i--;
                  if(i<1)
                  {
                     End = True;
                     End_Up = True;
                     End_Down = True;
                  }
               }
               if(Trend_Back == True)
               {
                  Buffer2[i] = Line2;
                  Buffer1[i] = Close[i];
                  Line4=Line1;
                  Line3=Line1;
                  Line2 = Line2;
                  Line1 = Close[i];
                  Trend_Back = False;
                  Counter++;
                  i--;
                  if(i<1)
                  {
                     End = True;
                     End_Up = True;
                     End_Down = True;
                  }
               }
         }
         else
         {
            if(Close[i]<Line4)
            {
               Trend = False;
               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[i]==Close[i])
         //{
         //   i--;
         //   if(i<1)
         //  {
         //      End = True;
         //      End_Up = True;
         //      End_Down = True;
         //   }
         //}         
      }
   if(Trend_Back == True)
   {
      End_Up = True;
      End_Down = False;
      Counter = 0;
   }

}
//--------------------------------------------------------------------------------------




switch (Counter)
{
case 1 : 
   Comment("Block Number < " + Counter + " >   -----   " + 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;        
      
   
   
}





}
}
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---