#MTF-Dinapoli_Target_001

Download script
#MTF-Dinapoli_Target_001

This tool is designed to help traders visualize specific market price targets by integrating data from different timeframes into a single, unified view. Its primary purpose is to allow you to see "higher-level" technical analysis on your current chart without having to constantly switch back and forth between different tabs or windows.

Core Functionality

The script acts as a bridge. It retrieves specialized target data from a parent indicator (specifically the "DinapoliTargets" system) and projects it onto your active screen. By doing this, it ensures that your trading decisions are informed by broader market trends while you are looking at smaller, more immediate price movements.

Key Logic Breakdown

  • Multi-Timeframe Coordination: The tool is built to look at a larger timeframe than the one you are currently viewing. It uses a user-defined "Upper Period" to decide which higher timeframe to pull data from. This ensures that the targets displayed are relevant to the bigger picture of the market.
  • Smart Synchronization (Time Alignment): One of the most complex parts of this logic is how it handles time. Because a single candle on a large timeframe (like a Daily chart) covers many candles on a small timeframe (like a 15-minute chart), the script performs a "search" to align the correct data points. It identifies exactly which moment in the past corresponds to the current price, ensuring the target lines you see are perfectly synced with the actual time.
  • Automatic Adjustment: The logic includes a safeguard that checks your settings. If you try to use a timeframe that is too small for the data you are trying to pull, the tool will alert you. It essentially ensures that the visual data remains logically consistent and accurate.
  • Seamless Visual Overlay: The final result is a smooth line drawn directly on your chart. Instead of seeing raw numbers or complex calculations, you see a clear visual representation of the price targets, allowing for a more intuitive understanding of where the market might be heading next based on the Dinapoli analysis.

Summary for the Trader

In short, this script simplifies your workflow. It takes heavy-duty analysis from a larger timeframe and "shrinks" it down so you can see it clearly while trading on a faster, more active chart. It handles all the difficult math of aligning different times behind the scenes, providing you with a cleaner, more informed view of potential price targets.

Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
12 Views
0 Downloads
0 Favorites
#MTF-Dinapoli_Target_001
//+------------------------------------------------------------------+ 
//|                                          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 AliceBlue 
#property indicator_width1 4
//---- input parameters 
extern int UpperPeriod=15; 
//---- buffers 
double ExtMapBuffer1[]; 
datetime daytimes[]; 
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 
//---- indicators 
   SetIndexStyle(0,DRAW_SECTION); 
   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