Now we have Market Experts:118 Market Indicators:77 Source code:15125 ,E-mail:[email protected]

Symphonie_Pivots_LHDT.mq4

Indicators Views
Download link:Symphonie_Pivots_LHDT.mq4 Size:3.6KB
Contact us:[email protected]
//+------------------------------------------------------------------+
//|                                                  Pivots_LHDT.mq4 |
//|                                           Copyright © 2012, LHDT |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, LHDT"
#property link      ""

#property indicator_chart_window

extern string Pivots = "---- Pivot Lines ----";
extern bool  useAlarms = true;
extern color Daily_Pivot_color=Magenta;
extern color Daily_R1_color=LimeGreen;
extern color Daily_S1_color=Crimson;
extern color Daily_R2_color=Gray;
extern color Daily_S2_color=Gray;
extern color Daily_R3_color=Gray;
extern color Daily_S3_color=Gray;

string shortname = "PivotsLHDT";
int oldBars;
double prevBid;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
   
   if ( oldBars < Bars ) {
   
      double DHigh = NormalizeDouble(iHigh(NULL,PERIOD_D1,1),4);
      double DLow = NormalizeDouble(iLow(NULL,PERIOD_D1,1),4);
      double DClose = NormalizeDouble(iClose(NULL,PERIOD_D1,1),4);
   
      double Pivot = NormalizeDouble(((DHigh + DLow + DClose)/3),4);
      double R1 = (2*Pivot)-DLow;
      double S1 = (2*Pivot)-DHigh;
      double R2 = Pivot+(R1-S1);
      double S2 = Pivot-(R1-S1); 
      double R3 = ( 2.0 * Pivot) + ( DHigh - ( 2.0 * DLow ) );
      double S3 = ( 2.0 * Pivot) - ( ( 2.0 * DHigh ) - DLow );   
   
      drawHorizontalLine("Daily Pivot",Pivot,1,Daily_Pivot_color);
      drawHorizontalLine("Daily R1",R1,1,Daily_R1_color);
      drawHorizontalLine("Daily S1",S1,1,Daily_S1_color);
      drawHorizontalLine("Daily R2",R2,1,Daily_R2_color);
      drawHorizontalLine("Daily S2",S2,1,Daily_S2_color);
      drawHorizontalLine("Daily R3",R3,1,Daily_R3_color);
      drawHorizontalLine("Daily S3",S3,1,Daily_S3_color);
      
      oldBars = Bars;
      
    
  }
   
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

void drawHorizontalLine(string lineName, double linePos, int lineWidth, int lineColor)
{
   ObjectDelete(shortname+"_"+lineName);
   ObjectCreate(shortname+"_"+lineName, OBJ_HLINE, 0, TimeCurrent(), linePos);
   ObjectSet(shortname+"_"+lineName, OBJPROP_BACK, true);
   ObjectSet(shortname+"_"+lineName, OBJPROP_COLOR, lineColor);
   ObjectSet(shortname+"_"+lineName, OBJPROP_WIDTH, lineWidth);
   ObjectSet(shortname+"_"+lineName, OBJPROP_STYLE, STYLE_SOLID);
   
   if(ObjectFind(shortname+"_"+lineName+"_Label") != 0)
   {
      ObjectCreate(shortname+"_"+lineName+"_Label", OBJ_TEXT, 0, Time[20], linePos);
      ObjectSetText(shortname+"_"+lineName+"_Label", (lineName), 8, "Arial", lineColor);
   }
   else
   {
      ObjectMove(shortname+"_"+lineName+"_Label", 0, Time[20], linePos);
   }
}
Download link:Symphonie_Pivots_LHDT.mq4 Size:3.6KB
Contact us:[email protected]