Navigation:Home > Content >

Daily_Pivot_Simple(2).mq4

Time: 2015-02-26 | Download file:Daily_Pivot_Simple(2).mq4

#property copyright "eevviill"
#property link      "itisallillusion@gmail.com"

#property indicator_chart_window


extern string piv_for = "Pivot formula";
extern string formula1 = "(H+L)/2";
extern bool use_formula1 = true;
extern string formula2 = "(H+L+C)/3";
extern bool use_formula2 = false;

extern string pus1 = "";
extern string line = "Line settings";
extern int line_width = 4;
extern color line_color = OrangeRed;

extern string pus2 = "";
extern string label = "Label settings";
extern string label_name = "D_pivot";
extern int label_size = 16;
extern color label_color = Yellow;
extern int label_shift_left = 3;
extern int label_shift_up = 9;

extern string pus3 = "";
extern string p_day = "Select day of pivot";
extern int pivot_day = 1; 



string formula_number;




int deinit()
  {
  if(use_formula1) formula_number="1";
  if(use_formula2) formula_number="2";
  
ObjectDelete("DPS"+pivot_day+formula_number);
ObjectDelete("DPS_l"+pivot_day+formula_number);


   return(0);
  }




int start()
  {
////////////////////////////////////////////////////////////////////////////////////////////  
  if(use_formula1) formula_number="1";
  if(use_formula2) formula_number="2";


  double price_D_pivot = 0;
 
  if(use_formula1) price_D_pivot = (iHigh(Symbol(),PERIOD_D1,pivot_day)+iLow(Symbol(),PERIOD_D1,pivot_day))/2; 
  if(use_formula2) price_D_pivot = (iHigh(Symbol(),PERIOD_D1,pivot_day)+iLow(Symbol(),PERIOD_D1,pivot_day)+iClose(Symbol(),PERIOD_D1,pivot_day))/3;
 
  if(use_formula1 && use_formula2) price_D_pivot = 0;
  
  
  
ObjectCreate("DPS"+pivot_day+formula_number,OBJ_HLINE,0,0,0);
 ObjectSet("DPS"+pivot_day+formula_number,OBJPROP_PRICE1,price_D_pivot);
 ObjectSet("DPS"+pivot_day+formula_number,OBJPROP_WIDTH,line_width);
 ObjectSet("DPS"+pivot_day+formula_number,OBJPROP_COLOR,line_color);
 
 
ObjectCreate("DPS_l"+pivot_day+formula_number,OBJ_TEXT,0,0,0);
 ObjectSet("DPS_l"+pivot_day+formula_number,OBJPROP_PRICE1,price_D_pivot-2*Point+label_shift_up*Point);
 ObjectSetText("DPS_l"+pivot_day+formula_number,label_name,label_size,"Arial",label_color);
 ObjectSet("DPS_l"+pivot_day+formula_number,OBJPROP_TIME1,Time[1+label_shift_left]);
  
  
  
  return;
}

Recommend