_MTF_Candles_v1

Download script
Author: Copyright � 2006, Eli Hayun
_MTF_Candles_v1

This tool is designed to provide a visual summary of higher-timeframe price action directly on your current trading chart. It allows you to see the "bigger picture" without having to constantly switch between different time periods, helping you identify historical price movements at a glance.

How it Works

The script functions by scanning specific historical data from a higher timeframe (which you can customize in the settings) and projecting those details onto your active screen. Here is the step-by-step logic of how the tool processes this information:

  • Timeframe Synchronization: The script looks at a larger time interval (for example, 4-hour candles) and retrieves the core price data—specifically the opening, closing, high, and low prices for those periods.
  • Dynamic Visual Mapping: Instead of just showing simple lines, the script translates each historical candle into a series of visual objects on your chart. It calculates the specific time coordinates to ensure that the information aligns correctly with the flow of time on your screen.
  • Color-Coded Trends: The logic automatically detects the direction of the movement. If the price closed higher than it opened during that timeframe, the script applies a "bullish" color (Light Blue). If it closed lower, it applies a "bearish" color (Red). This allows you to instantly recognize whether the market was trending up or down during those periods.
  • Visual Representation: For every period it analyzes, the script draws distinct shapes that represent the price boundaries. It captures the "body" of the movement and its extremes, creating a clear visual map of where the price spent most of its time.

Key Benefits for the User

By using this logic, you gain a multi-dimensional view of the market. You can see how larger historical trends are structured while staying on your preferred trading timeframe. It effectively bridges the gap between "macro" and "micro" analysis, providing a cleaner, more organized way to visualize historical price action.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains open prices of each barSeries array that contains close prices for each bar
13 Views
0 Downloads
0 Favorites
_MTF_Candles_v1
//+------------------------------------------------------------------+
//|                                                 #MTF Candles.mq4 |
//|                                      Copyright © 2006, Eli Hayun |
//|                                          http://www.elihayun.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Eli Hayun"
#property link      "http://www.elihayun.com"
//----
#property indicator_chart_window
//---- input parameters
extern int       CandlesTF=240;
extern color     UpCandleColor=LightBlue;
extern color     DownCandleColor=Red;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   double dif=MathAbs(Time[1] - Time[2]);
   int ix=0;
   datetime dtStart=dif * 8 + Time[0];
   for(int ii=0; ii<8; ii+=2)
     {
      ObjectDelete("rect"+ii); ObjectDelete("OTrnd"+ii); ObjectDelete("CTrnd"+ii);
      ObjectCreate("rect"+ii,OBJ_TREND, 0, dtStart, iLow(NULL, CandlesTF,ix), dtStart, iHigh(NULL,CandlesTF,ix));
      color clr=DownCandleColor; if (iOpen(NULL, CandlesTF,ix) < iClose(NULL, CandlesTF,ix)) clr=UpCandleColor;
      ObjectSet("rect"+ii, OBJPROP_COLOR, clr);
      ObjectSet("rect"+ii, OBJPROP_WIDTH, 3);
      ObjectSet("rect"+ii, OBJPROP_RAY, False);
      ObjectCreate("OTrnd"+ii, OBJ_TREND, 0, dtStart, iOpen(NULL, CandlesTF,ix), dtStart-dif, iOpen(NULL,CandlesTF,ix));
      ObjectSet("OTrnd"+ii, OBJPROP_WIDTH, 2);
      ObjectSet("OTrnd"+ii, OBJPROP_RAY, False);
      ObjectSet("CTrnd"+ii, OBJPROP_WIDTH, 2);
      ObjectCreate("CTrnd"+ii, OBJ_TREND, 0, dtStart, iClose(NULL, CandlesTF,ix), dtStart+dif, iClose(NULL,CandlesTF,ix));
      ObjectSet("CTrnd"+ii, OBJPROP_WIDTH, 2);
      ObjectSet("CTrnd"+ii, OBJPROP_RAY, False);
      dtStart-=dif * 2;
      ix++;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments