Support_and_Resistance_FOREX





//+-------------------------------------------------------+\\
//| Support_and_Resistance_FOREX.mq4 Release 20061106-rc1 |\\
//|     Copyright © 2006, jnrtrading (Jason Robinson)     |\\
//|    Contact @ http://www.spreadtrade2win.com/forum/    |\\
//+-------------------------------------------------------+\\
#property copyright "Copyright © 2006, Jason Robinson (jnrtrading)"
#property link      "http://www.spreadtrade2win.com/forum/"

#property indicator_chart_window
extern int How_Many_Days_To_Calculate = 10;
extern color High_Line_Colour = Red;
extern color Low_Line_Colour = Blue;
extern color Todays_High_Line_Colour = Red;
extern color Todays_Low_Line_Colour = Blue;
extern color SR_Line_Colour = Black;
int x;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
//---- indicators
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() {
//----
   for (x = 0; x <=How_Many_Days_To_Calculate; x++) {
      ObjectDelete("HighLine"+x);
      ObjectDelete("LowLine"+x);
      ObjectDelete("SRa"+x);
      ObjectDelete("SRb"+x);
   }
   ObjectDelete("TodaysHighLine");
   ObjectDelete("TodaysLowLine");
   
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   double Rates[][6];
   int i = 0;
   static datetime prevtime = 0;
   ArrayCopyRates(Rates,Symbol(),PERIOD_D1);
//----
   
   
   for (i=1; i<How_Many_Days_To_Calculate; i++) {
      ObjectDelete("HighLine"+i);
      ObjectCreate("HighLine"+i,OBJ_TREND,0, iTime(NULL,PERIOD_D1,i), Rates[i][3], iTime(NULL,PERIOD_D1,i-1)+86400, Rates[i][3]);
      ObjectSet("HighLine"+i, OBJPROP_RAY, false);
      ObjectSet("HighLine"+i, OBJPROP_BACK, true);
      ObjectSet("HighLine"+i, OBJPROP_STYLE, STYLE_DASH);
      ObjectSet("HighLine"+i, OBJPROP_COLOR, High_Line_Colour);
      
      ObjectDelete("LowLine"+i);
      ObjectCreate("LowLine"+i,OBJ_TREND,0, iTime(NULL,PERIOD_D1,i), Rates[i][2], iTime(NULL,PERIOD_D1,i-1)+86400, Rates[i][2]);
      ObjectSet("LowLine"+i, OBJPROP_RAY, false);
      ObjectSet("LowLine"+i, OBJPROP_BACK, true);
      ObjectSet("LowLine"+i, OBJPROP_STYLE, STYLE_DASH);
      ObjectSet("LowLine"+i, OBJPROP_COLOR, Low_Line_Colour);
   }
   if (Rates[0][3] > Rates[1][3]) {
      ObjectDelete("TodaysHighLine");
      ObjectCreate("TodaysHighLine",OBJ_TREND,0, iTime(NULL,PERIOD_D1,0), Rates[0][3], iTime(NULL,PERIOD_D1,0)+86400, Rates[0][3]);
      ObjectSet("TodaysHighLine", OBJPROP_RAY, false);
      ObjectSet("TodaysHighLine", OBJPROP_BACK, true);
      ObjectSet("TodaysHighLine", OBJPROP_STYLE, STYLE_DASH);
      ObjectSet("TodaysHighLine", OBJPROP_COLOR, Todays_High_Line_Colour);      
   }
   if (Rates[0][2] < Rates[1][2]) {
      ObjectDelete("TodaysLowLine");
      ObjectCreate("TodaysLowLine",OBJ_TREND,0, iTime(NULL,PERIOD_D1,0), Rates[0][2], iTime(NULL,PERIOD_D1,0)+86400, Rates[0][2]);
      ObjectSet("TodaysLowLine", OBJPROP_RAY, false);
      ObjectSet("TodaysLowLine", OBJPROP_BACK, true);
      ObjectSet("TodaysLowLine", OBJPROP_STYLE, STYLE_DASH);
      ObjectSet("TodaysLowLine", OBJPROP_COLOR, Todays_Low_Line_Colour);      
   }
   for (i=2; i<=How_Many_Days_To_Calculate; i++) {
      ObjectDelete("SRa"+(i-2));
      ObjectCreate("SRa"+(i-2),OBJ_TREND,0, iTime(NULL,PERIOD_D1,1), Rates[i][3], iTime(NULL,PERIOD_D1,0)+86400, Rates[i][3]);
      ObjectSet("SRa"+(i-2), OBJPROP_RAY, false);
      ObjectSet("SRa"+(i-2), OBJPROP_BACK, true);
      ObjectSet("SRa"+(i-2), OBJPROP_STYLE, STYLE_DOT);
      ObjectSet("SRa"+(i-2), OBJPROP_COLOR, SR_Line_Colour);

      ObjectDelete("SRb"+(i-2));
      ObjectCreate("SRb"+(i-2),OBJ_TREND,0, iTime(NULL,PERIOD_D1,1), Rates[i][2], iTime(NULL,PERIOD_D1,0)+86400, Rates[i][2]);
      ObjectSet("SRb"+(i-2), OBJPROP_RAY, false);
      ObjectSet("SRb"+(i-2), OBJPROP_BACK, true);
      ObjectSet("SRb"+(i-2), OBJPROP_STYLE, STYLE_DOT);
      ObjectSet("SRb"+(i-2), OBJPROP_COLOR, SR_Line_Colour);
   }
   ObjectsRedraw();
//----
   return(0);
}
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: