#MTF_LPB_2





//+------------------------------------------------------------------+
//|                                             Linear Price Bar.mq4 |
//|                                      Copyright © 2006, Keris2112 |
//|                                                             none |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Keris2112"
#property link      "none"

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Red

//---- input parameters
/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30 
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
**************************************************************************/
extern int TimeFrame=0;
/*************************************************************************

DRAW_LINE      0     Drawing line. 
DRAW_SECTION   1     Drawing sections. 
DRAW_HISTOGRAM 2     Drawing histogram. 
DRAW_ARROW     3     Drawing arrows (symbols). 
DRAW_ZIGZAG    4     Drawing sections between even and odd indicator buffers. 
DRAW_NONE      12    No drawing.
**************************************************************************/ 


extern string Indicator_Name_1="Linear Price Bar";
extern int Line_1=0;
extern int Draw_1=2;
extern double Parameter1_1 = -100;
extern double Parameter2_1 = -100;
extern double Parameter3_1 = -100;
extern double Parameter4_1 = -100;
extern double Parameter5_1 = -100;

extern string Indicator_Name_2="Linear Price Bar";
extern int Line_2=1;
extern int Draw_2=2;
extern double Parameter1_2 = -100;
extern double Parameter2_2 = -100;
extern double Parameter3_2 = -100;
extern double Parameter4_2 = -100;
extern double Parameter5_2 = -100;

extern string Indicator_Name_3="Linear Price Bar";
extern int Line_3=2;
extern int Draw_3=2;
extern double Parameter1_3 = -100;
extern double Parameter2_3 = -100;
extern double Parameter3_3 = -100;
extern double Parameter4_3 = -100;
extern double Parameter5_3 = -100;

extern string Indicator_Name_4="Linear Price Bar";
extern int Line_4=3;
extern int Draw_4=2;
extern double Parameter1_4 = -100;
extern double Parameter2_4 = -100;
extern double Parameter3_4 = -100;
extern double Parameter4_4 = -100;
extern double Parameter5_4 = -100;
//---- buffers

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicators
   SetIndexStyle(0,Draw_1);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,Draw_2);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,Draw_3);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,Draw_4);
   SetIndexBuffer(3,ExtMapBuffer4);
  
//---- name for DataWindow and indicator subwindow label   
   switch(TimeFrame)
   {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
   }
   IndicatorShortName("MTF_Linear_2 Price Bar ("+TimeFrameStr+")");   
  }
//----
   return(0);
 
//+------------------------------------------------------------------+
//| MTF Parabolic Sar                                         |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
   limit=Bars-counted_bars;
   limit=Bars-counted_bars;
   for(i=0,y=0;i<limit;i++)
   {
   if (Time[i]<TimeArray[y]) y++;

/***********************************************************   
   Add your main indicator loop below.  You can reference an existing
      indicator with its iName  or iCustom.
   Rule 1:  Add extern inputs above for all neccesary values   
   Rule 2:  Use 'TimeFrame' for the indicator time frame
   Rule 3:  Use 'y' for your indicator's shift value
 **********************************************************/  
 
   ExtMapBuffer1[i]=GetIcustomValue(0,y);
   ExtMapBuffer2[i]=GetIcustomValue(1,y); 
   ExtMapBuffer3[i]=GetIcustomValue(2,y); 
   ExtMapBuffer4[i]=GetIcustomValue(3,y);  
   
   }  
   return(0);
  }
  
  double GetIcustomValue(int level ,int shift)
  {
      double value =0;
      
      switch(level)
      {
         case 1 :
         {  
            if(Parameter1_1==-100 && Parameter2_1==-100 && Parameter3_1==-100 && Parameter4_1==-100 && Parameter5_1==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_1,Line_1,shift);
            if(Parameter1_1!=-100 && Parameter2_1==-100 && Parameter3_1==-100 && Parameter4_1==-100 && Parameter5_1==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_1,Parameter1_1,Line_1,shift);
            if(Parameter1_1!=-100 && Parameter2_1!=-100 && Parameter3_1==-100 && Parameter4_1==-100 && Parameter5_1==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_1,Parameter1_1,Parameter2_1,Line_1,shift);
            if(Parameter1_1!=-100 && Parameter2_1!=-100 && Parameter3_1!=-100 && Parameter4_1==-100 && Parameter5_1==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_1,Parameter1_1,Parameter2_1,Parameter3_1,Line_1,shift);
            if(Parameter1_1!=-100 && Parameter2_1!=-100 && Parameter3_1!=-100 && Parameter4_1!=-100 && Parameter5_1==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_1,Parameter1_1,Parameter2_1,Parameter3_1,Parameter4_1,Line_1,shift);
            if(Parameter1_1!=-100 && Parameter2_1!=-100 && Parameter3_1!=-100 && Parameter4_1!=-100 && Parameter5_1!=-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_1,Parameter1_1,Parameter2_1,Parameter3_1,Parameter4_1,Parameter5_1,Line_1,shift);
            break;
         }
      
         case 2 :
         {  
            if(Parameter1_2==-100 && Parameter2_2==-100 && Parameter3_2==-100 && Parameter4_2==-100 && Parameter5_2==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_2,Line_2,shift);
            if(Parameter1_2!=-100 && Parameter2_2==-100 && Parameter3_2==-100 && Parameter4_2==-100 && Parameter5_2==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_2,Parameter1_2,Line_2,shift);
            if(Parameter1_2!=-100 && Parameter2_2!=-100 && Parameter3_2==-100 && Parameter4_2==-100 && Parameter5_2==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_2,Parameter1_2,Parameter2_2,Line_2,shift);
            if(Parameter1_2!=-100 && Parameter2_2!=-100 && Parameter3_2!=-100 && Parameter4_2==-100 && Parameter5_2==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_2,Parameter1_2,Parameter2_2,Parameter3_2,Line_2,shift);
            if(Parameter1_2!=-100 && Parameter2_2!=-100 && Parameter3_2!=-100 && Parameter4_2!=-100 && Parameter5_2==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_2,Parameter1_2,Parameter2_2,Parameter3_2,Parameter4_2,Line_2,shift);
            if(Parameter1_2!=-100 && Parameter2_2!=-100 && Parameter3_2!=-100 && Parameter4_2!=-100 && Parameter5_2!=-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_2,Parameter1_2,Parameter2_2,Parameter3_2,Parameter4_2,Parameter5_2,Line_2,shift);
            break;
         }
      
         case 3 :
         {  
            if(Parameter1_3==-100 && Parameter2_3==-100 && Parameter3_3==-100 && Parameter4_3==-100 && Parameter5_3==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_3,Line_3,shift);
            if(Parameter1_3!=-100 && Parameter2_3==-100 && Parameter3_3==-100 && Parameter4_3==-100 && Parameter5_3==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_3,Parameter1_3,Line_3,shift);
            if(Parameter1_3!=-100 && Parameter2_3!=-100 && Parameter3_3==-100 && Parameter4_3==-100 && Parameter5_3==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_3,Parameter1_3,Parameter2_3,Line_3,shift);
            if(Parameter1_3!=-100 && Parameter2_3!=-100 && Parameter3_3!=-100 && Parameter4_3==-100 && Parameter5_3==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_3,Parameter1_3,Parameter2_3,Parameter3_3,Line_3,shift);
            if(Parameter1_3!=-100 && Parameter2_3!=-100 && Parameter3_3!=-100 && Parameter4_3!=-100 && Parameter5_3==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_3,Parameter1_3,Parameter2_3,Parameter3_3,Parameter4_3,Line_3,shift);
            if(Parameter1_3!=-100 && Parameter2_3!=-100 && Parameter3_3!=-100 && Parameter4_3!=-100 && Parameter5_3!=-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_3,Parameter1_3,Parameter2_3,Parameter3_3,Parameter4_3,Parameter5_3,Line_3,shift);
            break;
         }
         
         case 4 :
         {  
            if(Parameter1_4==-100 && Parameter2_4==-100 && Parameter3_4==-100 && Parameter4_4==-100 && Parameter5_4==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_4,Line_4,shift);
            if(Parameter1_4!=-100 && Parameter2_4==-100 && Parameter3_4==-100 && Parameter4_4==-100 && Parameter5_4==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_4,Parameter1_4,Line_4,shift);
            if(Parameter1_4!=-100 && Parameter2_4!=-100 && Parameter3_4==-100 && Parameter4_4==-100 && Parameter5_4==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_4,Parameter1_4,Parameter2_4,Line_4,shift);
            if(Parameter1_4!=-100 && Parameter2_4!=-100 && Parameter3_4!=-100 && Parameter4_4==-100 && Parameter5_4==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_4,Parameter1_4,Parameter2_4,Parameter3_4,Line_4,shift);
            if(Parameter1_4!=-100 && Parameter2_4!=-100 && Parameter3_4!=-100 && Parameter4_4!=-100 && Parameter5_4==-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_4,Parameter1_4,Parameter2_4,Parameter3_4,Parameter4_4,Line_4,shift);
            if(Parameter1_4!=-100 && Parameter2_4!=-100 && Parameter3_4!=-100 && Parameter4_4!=-100 && Parameter5_4!=-100)
               value = iCustom(NULL,TimeFrame,Indicator_Name_4,Parameter1_4,Parameter2_4,Parameter3_4,Parameter4_4,Parameter5_4,Line_4,shift);
            break;
         }
      }
       
      return (value);

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



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar


Indicator Curves created:

Implements a curve of type Draw_1

Implements a curve of type Draw_2
Implements a curve of type Draw_3
Implements a curve of type Draw_4

Indicators Used:




Custom Indicators Used:
Indicator_Name_1
Indicator_Name_2
Indicator_Name_3
Indicator_Name_4

Order Management characteristics:

Other Features: