Author: klot
DT-RFTL

Overview

The DT-FATL tool is a specialized technical indicator designed for the MetaTrader 4 platform. Its primary purpose is to synchronize and display specific market data from a higher timeframe onto a lower timeframe chart. It acts as a bridge, allowing traders to visualize information that typically occurs over longer periods without having to switch back and forth between different charts.

Core Logic and Functionality

The script operates based on three main logical pillars:

1. Timeframe Compatibility and Validation Before performing any calculations, the tool checks to ensure that the current chart's timeframe is compatible with its requirements. It looks for a specific "Gross Period" (set by default at 240 minutes). If the user attempts to run the indicator on a timeframe larger than this limit, the script will issue an alert and stop, ensuring that the data remains accurate and relevant to the intended analysis.

2. Data Retrieval Coordination The heart of this indicator is its ability to "fetch" data from another source. It identifies specific timestamps and organizes them to match the visual flow of the current chart. Instead of simply plotting a moving average or a standard line, it looks back into a history of price movements to find corresponding values from a secondary calculation (referred to as "RFTL").

3. Dynamic Mapping and Alignment To ensure that the information appears correctly on your screen, the script performs a "search and match" operation:

  • It compares the current candle's time against a sorted list of significant time markers.
  • It calculates a "shift"—a mathematical offset—to determine exactly where a specific piece of data from the larger timeframe belongs on the smaller timeframe.
  • Once this alignment is found, it draws a visual marker (represented as a magenta arrow) on the chart.

Summary for the Trader

Essentially, this script automates the process of "mapping" high-level market trends onto your immediate trading view. It calculates where important signals from a larger time horizon should appear on your current screen and marks those exact points with visual indicators, helping you identify key levels or transitions that might otherwise be missed when looking at shorter price fluctuations.

Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
14 Views
0 Downloads
0 Favorites
DT-RFTL
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+ 
//|                                                       DT-FATL.mq4 | 
//+------------------------------------------------------------------+ 
#property copyright "klot" 
#property link      "klot@mail.ru" 

#property indicator_chart_window 
#property indicator_buffers 1 
#property indicator_color1 Magenta 

extern int GrossPeriod=240; // Ñòàðøèé ïåðèîä â ìèíóòàõ 

datetime daytimes[]; 
//---- buffers 
double ExtMapBuffer1[]; 
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 
//---- indicators 
   SetIndexStyle(0,DRAW_ARROW); 
   SetIndexArrow(0,159); 
   SetIndexBuffer(0,ExtMapBuffer1); 
   SetIndexEmptyValue(0,0.0); 
   if (Period()>GrossPeriod) { Alert("DT-RSTL: Òåêóùèé òàéìôðåéì äîëæåí áûòü ìåíüøå ÷åì ", GrossPeriod); return(0); } 
//---- 


// Âñå Time[] ñåðèè âðåìåíè îòñîðòèðîâàíî â íàïðàâëåíèè óáûâàíèÿ 
ArrayCopySeries(daytimes,MODE_TIME,Symbol(),GrossPeriod); 

   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custor indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
  { 
//---- 
    
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
int start() 
  { 
   int    limit, bigshift; 
   int    counted_bars=IndicatorCounted(); 
//---- 
   if (counted_bars<0) return(-1); 
    
   if (counted_bars>0) counted_bars--; 
    
   limit=Bars-counted_bars; 
    
   for (int i=0; i<limit; i++) 
   { 
   if(Time[i]>=daytimes[0]) bigshift=0; 
   else 
     { 
      bigshift = ArrayBsearch(daytimes,Time[i-1],WHOLE_ARRAY,0,MODE_DESCEND); 
      if(Period()<=GrossPeriod) bigshift++; 
     } 
  ExtMapBuffer1[i]=iCustom(NULL,GrossPeriod,"RFTL",0,bigshift); 
   } 
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 

Comments