FDM i-ParamonWorkTime

Download script
Author: Copyright � 2008, Forex Day Monster
FDM i-ParamonWorkTime

This script is a visual trading tool designed to highlight specific time windows on a MetaTrader price chart. It allows traders to clearly identify and focus on key periods of market activity by overlaying colored boxes directly onto the historical data.

Core Functionality

Time Zone Highlighting The primary purpose of this tool is to automatically draw two distinct shaded regions on your chart based on specific times of the day. You can customize these timeframes (for example, a morning session and an afternoon session) and assign unique colors to each. This makes it easy to see at a glance when high-volatility periods occur or when certain trading sessions begin and end.

Dynamic Visual Mapping Rather than just drawing static lines, the script identifies the highest and lowest price points reached during your chosen timeframes. It then uses these price extremes to draw rectangular blocks on the chart.

  • By default, the script calculates these boundaries based on the actual market high and low within the period.
  • There is also a toggle option provided in the settings that allows you to adjust how these price levels are displayed if you prefer a different visual style.

Historical Backtracking The tool does not just show today's boxes; it automatically populates the chart with these highlights for a specified number of previous days (defaulting to 50 days). This allows traders to analyze historical price action and observe how the market behaved during these specific windows over a long period.

Smart Date Handling The script includes built-in logic to handle the complexities of the calendar. It is designed to skip over weekends and correctly calculate dates, ensuring that the shaded boxes appear consistently across different months and leap years without manual adjustment from the user.

How it Benefits the Trader

  • Visual Organization: It cleans up your chart by clearly demarcating "trading zones," helping you stay focused on the times of day that matter most for your strategy.
  • Historical Analysis: By looking back over several weeks of data, you can quickly identify patterns that repeat during these specific sessions.
  • Customization: Users can easily adjust the start times, end times, and colors to align perfectly with their specific brokerage hours or preferred trading styles.
Miscellaneous
It issuies visual alerts to the screen
11 Views
0 Downloads
0 Favorites
FDM i-ParamonWorkTime
/*
  
*/
#property copyright "Copyright © 2008, Forex Day Monster"
#property link      "http://www.forexprofitmonster.com"

#property indicator_chart_window

extern int NumberOfDays = 50;
extern string Begin_1 = "08:00";
extern string End_1 = "11:00";
extern color Color_1 = DarkBlue;
extern string Begin_2 = "14:00";
extern string End_2 = "17:00";
extern color Color_2 = Brown;
extern bool HighRange = FALSE;

void init() {
   DeleteObjects();
   for (int l_count_0 = 0; l_count_0 < NumberOfDays; l_count_0++) {
      CreateObjects("PWT1" + l_count_0, Color_1);
      CreateObjects("PWT2" + l_count_0, Color_2);
   }
   Comment("");
}

void deinit() {
   DeleteObjects();
   Comment("");
}

void CreateObjects(string a_name_0, color a_color_8) {
   ObjectCreate(a_name_0, OBJ_RECTANGLE, 0, 0, 0, 0, 0);
   ObjectSet(a_name_0, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet(a_name_0, OBJPROP_COLOR, a_color_8);
   ObjectSet(a_name_0, OBJPROP_BACK, TRUE);
}

void DeleteObjects() {
   for (int l_count_0 = 0; l_count_0 < NumberOfDays; l_count_0++) {
      ObjectDelete("PWT1" + l_count_0);
      ObjectDelete("PWT2" + l_count_0);
   }
}

void start() {
   string ls_0 = "2015.11.01";
   int l_str2time_8 = StrToTime(ls_0);
   if (TimeCurrent() >= l_str2time_8) {
      Alert(" Trial version has expired! Email support@forexprofitmonster.com with broker account number for rights to full version!");
      return;
   }
   int l_datetime_12 = TimeCurrent();
   for (int l_count_16 = 0; l_count_16 < NumberOfDays; l_count_16++) {
      DrawObjects(l_datetime_12, "PWT1" + l_count_16, Begin_1, End_1);
      DrawObjects(l_datetime_12, "PWT2" + l_count_16, Begin_2, End_2);
      for (l_datetime_12 = decDateTradeDay(l_datetime_12); TimeDayOfWeek(l_datetime_12) > 5; l_datetime_12 = decDateTradeDay(l_datetime_12)) {
      }
   }
}

void DrawObjects(int ai_0, string a_name_4, string as_12, string as_20) {
   int l_str2time_28 = StrToTime(TimeToStr(ai_0, TIME_DATE) + " " + as_12);
   int l_str2time_32 = StrToTime(TimeToStr(ai_0, TIME_DATE) + " " + as_20);
   int l_shift_52 = iBarShift(NULL, 0, l_str2time_28);
   int l_shift_56 = iBarShift(NULL, 0, l_str2time_32);
   double l_high_36 = High[iHighest(NULL, 0, MODE_HIGH, l_shift_52 - l_shift_56, l_shift_56)];
   double ld_44 = Low[iLowest(NULL, 0, MODE_LOW, l_shift_52 - l_shift_56, l_shift_56)];
   if (!HighRange) {
      l_high_36 = 0;
      ld_44 = 2.0 * ld_44;
   }
   ObjectSet(a_name_4, OBJPROP_TIME1, l_str2time_28);
   ObjectSet(a_name_4, OBJPROP_PRICE1, l_high_36);
   ObjectSet(a_name_4, OBJPROP_TIME2, l_str2time_32);
   ObjectSet(a_name_4, OBJPROP_PRICE2, ld_44);
}

int decDateTradeDay(int ai_0) {
   int li_4 = TimeYear(ai_0);
   int li_8 = TimeMonth(ai_0);
   int li_12 = TimeDay(ai_0);
   int l_hour_16 = TimeHour(ai_0);
   int l_minute_20 = TimeMinute(ai_0);
   li_12--;
   if (li_12 == 0) {
      li_8--;
      if (li_8 == 0) {
         li_4--;
         li_8 = 12;
      }
      if (li_8 == 1 || li_8 == 3 || li_8 == 5 || li_8 == 7 || li_8 == 8 || li_8 == 10 || li_8 == 12) li_12 = 31;
      if (li_8 == 2) {
         if (MathMod(li_4, 4) == 0.0) li_12 = 29;
         else li_12 = 28;
      }
      if (li_8 == 4 || li_8 == 6 || li_8 == 9 || li_8 == 11) li_12 = 30;
   }
   return (StrToTime(li_4 + "." + li_8 + "." + li_12 + " " + l_hour_16 + ":" + l_minute_20));
}

Comments