MTF_ang_AZad_C[cw]
Download scriptThis script is designed as a sophisticated multi-timeframe technical analysis tool for MetaTrader. Its primary purpose is to allow traders to visualize specific market data from higher timeframes directly onto their current trading chart without having to switch back and forth between different screens.
Core Functionality
The tool acts as a bridge, pulling data from a separate calculation engine (the ang_AZad_Css indicator) and projecting it onto the user's active view. By doing this, it helps traders identify long-term trends or structural shifts that might be invisible on shorter, faster price movements.
Key Logical Components
- Multi-Timeframe Integration: The script allows you to select a specific timeframe (such as an hour or a day) to monitor while you are looking at a smaller timeframe (like minutes). It synchronizes the data so that the information remains consistent and aligned with the current price action.
- Dual Data Streams: The tool tracks two distinct lines simultaneously. These represent different calculation "shifts." By showing two related sets of data, it provides a more complete picture of market momentum or volatility, rather than relying on a single data point.
- Dynamic Offsetting: To ensure the information is readable and doesn't overlap confusingly with the price candles, the script applies specific mathematical shifts. This creates a visual "buffer," positioning the indicator lines clearly so they can be analyzed alongside the main price action.
- Historical Synchronization: The logic includes a specialized loop that scans historical data. It ensures that as time progresses, the indicator accurately maps the past values of the higher timeframe to the correct positions on your current chart, preventing "repainting" issues or visual glitches.
Summary for Traders
Essentially, this tool provides a "big picture" perspective. It automatically performs the heavy lifting of calculating complex data from a higher time interval and displays it as two smooth lines on your current chart. This allows you to make trading decisions based on broader market context while maintaining the precision of your immediate timeframe.
//+------------------------------------------------------------------+
//| MTF_ang_AZad(C)[cw] ang_Zad(C).mq4 ik |
//| www.forex-tsd.com Copyright © 2006, ANG3110@latchess.com |
//+------------------------------------------------------------------+
#property copyright "ANG3110@latchess.com"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Indigo
#property indicator_color2 DarkSlateBlue
//----
extern int TimeFrame=0;
extern int ki = 2;
extern int Shift=1;
extern int zShift=2;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if(TimeFrame==0) TimeFrame = Period();
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0, Shift-1);
SetIndexShift( 0, Shift*TimeFrame/Period());
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1, Shift+zShift-1);
SetIndexShift(1, (Shift+zShift)*TimeFrame/Period());
SetIndexLabel(0,"MTF_ang_AZad,Z("+ki+")TF"+TimeFrame+"s"+Shift+"");
SetIndexLabel(1,"MTF_ang_AZad,Z2("+ki+")TF"+TimeFrame+"zs"+zShift+"");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator start function |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,shift,limit,y=0,counted_bars=IndicatorCounted();
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars+TimeFrame/Period();
for(i=0,y=0;i<limit;i++) {
if (Time[i]<TimeArray[y]) {y++;}
ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"ang_AZad_Css[cw]",ki,Shift,0,y);
ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"ang_AZad_Css[cw]",ki,Shift,zShift,1,y);
}
return(0);
}
//+------------------------------------------------------------------+
Comments