Open_Pivot_PlusLevels





//+------------------------------------------------------------------+
//|                                        Open_Pivot_PlusLevels.mq4 |
//|                                 Copyright © 2008,cjatradingtools |
//+------------------------------------------------------------------+
#property copyright  "Open_Pivot,By cja"
#property indicator_chart_window
extern bool Use_Pivot        = false; 
extern bool Show_Full_Lines  = true;
extern int UpperLEVEL3       = 125;
extern int UpperLEVEL2       = 75;
extern int UpperLEVEL1       = 25;
extern color Upper_Color     = Lime; 
extern int LowerLEVEL1       = 25;
extern int LowerLEVEL2       = 75;
extern int LowerLEVEL3       = 125;
extern color Lower_Color     = Red;
extern int Line_width        = 1;
extern int Line_style        = 2;
extern bool Extend_Lines     = true;

extern color Open_Pivot_Color = DarkSlateGray;
extern int   Open_Pivot_width = 2;

#define PP1 "PP1"
#define UPPER "UPPER"
#define LOWER "LOWER"
#define UPPER1 "UPPER1"
#define LOWER1 "LOWER1"
#define UPPER2 "UPPER2"
#define LOWER2 "LOWER2"

double x;
int trend;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
IndicatorShortName("Open_Pivot_PlusLevels");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----    
   ObjectDelete(PP1);
   ObjectDelete(UPPER); ObjectDelete(LOWER);
   ObjectDelete(UPPER1); ObjectDelete(LOWER1);
   ObjectDelete(UPPER2); ObjectDelete(LOWER2);
     
   DeleteLevel();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars= IndicatorCounted();
    x = Period();
       if(x > 240) return(-1); 
       
  if(Show_Full_Lines){trend = OBJ_HLINE;}else{trend=OBJ_TREND;}
//----
   CreatePVT();
}

void CreateLevel(string Line, double start, double end,double w, double s,color clr)
  {
   ObjectCreate(Line, trend, 0, iTime(NULL,1440,0), start, Time[0], end);
   ObjectSet(Line, OBJPROP_COLOR, clr);
   ObjectSet(Line,OBJPROP_WIDTH,w);
   ObjectSet(Line,OBJPROP_STYLE,s);
   ObjectSet(Line,OBJPROP_RAY,Extend_Lines);
   ObjectSet(Line,OBJPROP_BACK,true);
     }
        void DeleteLevel()
   { 
   ObjectDelete(PP1);
   ObjectDelete(UPPER); ObjectDelete(LOWER);
   ObjectDelete(UPPER1); ObjectDelete(LOWER1);
   ObjectDelete(UPPER2); ObjectDelete(LOWER2);
   }
   void CreatePVT()
   {
   
     DeleteLevel();
     
    if(Use_Pivot){   
    double P = (iHigh(NULL,1440,1) + iLow(NULL,1440,1) + iClose(NULL,1440,1)) / 3;}
    else{P = iOpen(NULL,1440,0);}
    
    double UP = P+ UpperLEVEL1*Point;
    double DN = P- LowerLEVEL1*Point; 
    double UP1 = P+ UpperLEVEL2*Point;
    double DN1 = P- LowerLEVEL2*Point;
    double UP2 = P+ UpperLEVEL3*Point;
    double DN2 = P- LowerLEVEL3*Point;
    

          
    
    CreateLevel(PP1,P,P,Open_Pivot_width,0,Open_Pivot_Color);
    CreateLevel(UPPER,UP,UP,Line_width,Line_style, Upper_Color );
    CreateLevel(LOWER,DN,DN,Line_width,Line_style, Lower_Color );
    CreateLevel(UPPER1,UP1,UP1,Line_width,Line_style, Upper_Color );
    CreateLevel(LOWER1,DN1,DN1,Line_width,Line_style, Lower_Color );
    CreateLevel(UPPER2,UP2,UP2,Line_width,Line_style, Upper_Color );
    CreateLevel(LOWER2,DN2,DN2,Line_width,Line_style, Lower_Color );
   
    
                
    
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

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


Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: