_2523MTF-Dinapoli_Target

Download script
_2523MTF-Dinapoli_Target

This script is a specialized technical analysis tool designed for the MetaTrader platform. Its primary purpose is to synchronize and display specific price targets—derived from the "Dinapoli Targets" system—across different timeframes simultaneously.

Core Functionality

The main objective of this script is to allow traders to view higher-level market data on a lower-level chart. For example, if you are trading on a small timeframe (like a 5-minute chart) but want to see the target levels calculated for a larger timeframe (like a 15-minute chart), this tool bridges that gap automatically.

How the Logic Works

To achieve this, the script performs several key actions:

  • Multi-Timeframe Synchronization: The tool looks at a "Higher Period" (a setting you define) to fetch data. It ensures that the price levels shown on your current chart are consistent with what is happening on that larger timeframe.
  • Dynamic Time Tracking: The script keeps track of time across different periods. It uses an internal logic to identify where specific bars sit in relation to the higher timeframe's history. This prevents the "shifting" errors that often occur when trying to view multi-timeframe data manually.
  • Data Retrieval: Instead of calculating the Dinapoli Targets from scratch, the script "calls" another existing indicator named DinapoliTargets. It pulls the specific values from that source and maps them onto your current chart based on the calculated time offsets.
  • Visual Representation: The script displays these targets as visual markers (arrows) on your screen. This allows you to see exactly where significant price objectives are located without needing to switch back and forth between different charts.

Safety Feature

The script includes a built-in check: if you try to use it on a timeframe that is larger than the "Upper Period" you have selected, it will provide an alert. This ensures that the data remains accurate and that the logic of the tool is not being forced into a configuration that would yield incorrect results.

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

//+------------------------------------------------------------------+ 
//|                                          MTF-Dinapoli_Target.mq4 | 
//+------------------------------------------------------------------+
//MTF == Muliple Time Frame 
#property copyright "klot" //Basic code
#property link      "klot@mail.ru" 

#property indicator_chart_window 
#property indicator_buffers 1 
#property indicator_color1 Yellow 
//---- input parameters 
extern int UpperPeriod=15; 
//---- buffers 
double ExtMapBuffer1[]; 
datetime daytimes[]; 
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 
//---- indicators 
   SetIndexStyle(0,DRAW_ARROW); 
   SetIndexArrow(0,159); 
   SetIndexBuffer(0,ExtMapBuffer1); 
   SetIndexEmptyValue(0,0.0); 
//---- 
   if (Period()>UpperPeriod) { Alert("UpperPeriod<TimeFrame!!change UpperPeriod on Indikator(MTF-Dinapoli_Target) please!!!", UpperPeriod); return(0); } 
   ArrayCopySeries(daytimes,MODE_TIME,Symbol(),UpperPeriod); 
   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()<=UpperPeriod) bigshift++; 
     } 
  ExtMapBuffer1[i]=iCustom(NULL,UpperPeriod,"DinapoliTargets",0,bigshift); 
   } 
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 

Comments