#MTF Candles

Author: Copyright � 2006, Eli Hayun
#MTF Candles

This tool is designed to enhance your trading chart by visually projecting information from higher timeframes directly onto your current view. Its primary purpose is to help traders see the "big picture" without having to constantly switch between different tabs or windows.

Core Functionality

The script automatically identifies and displays the price action of specific candles from a larger timeframe (for example, a 4-hour candle) on your current lower timeframe chart. Instead of just showing a single line or point, it recreates the visual structure of those larger candles to give you a clearer sense of market structure.

How it Works

The logic follows a systematic process to translate complex data into simple visuals:

  • Multi-Timeframe Synchronization: You can choose a specific timeframe (such as 240 minutes) that the script should monitor. The tool looks at these larger candles and pulls their data—specifically the high, low, open, and close prices.
  • Visual Reconstruction: For each identified candle on the higher timeframe, the script draws three distinct elements on your screen:
    1. The Body: A rectangular shape representing the main "meat" of the candle (the difference between the opening and closing price).
    2. The Upper Wick: A line extending upwards to show the highest point reached during that period.
    3. The Lower Wick: A line extending downwards to show the lowest point reached.
  • Color Coding: To make the data easy to read at a glance, the script automatically assigns colors based on market movement. If the higher timeframe candle closed higher than it opened, the visual is colored blue (Up); if it closed lower, it is colored red (Down).
  • Dynamic Positioning: The script calculates the precise timing and placement of these shapes so they align correctly with your current chart's timeline. It ensures that as new data arrives, the visuals are updated to reflect the most recent market activity.

Practical Use for Traders

By using this logic, you can keep your eyes on a fast-moving chart while still seeing the "footprints" of larger trends. It provides a visual map of where previous higher-timeframe price action occurred, helping you identify potential support, resistance, and overall momentum more intuitively.

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
11 Views
0 Downloads
0 Favorites
#MTF Candles
//+------------------------------------------------------------------+
//|                                                 #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 = Blue;
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_RAY, False);

      ObjectCreate("OTrnd"+ii, OBJ_TREND, 0, dtStart, iOpen(NULL, CandlesTF,ix), dtStart-dif, iOpen(NULL,CandlesTF,ix));
      ObjectSet("OTrnd"+ii, OBJPROP_RAY, False);
      ObjectCreate("CTrnd"+ii, OBJ_TREND, 0, dtStart, iClose(NULL, CandlesTF,ix), dtStart+dif, iClose(NULL,CandlesTF,ix));
      ObjectSet("CTrnd"+ii, OBJPROP_RAY, False);
      
      dtStart -= dif * 2;
      ix++;
    }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments