Author: Copyright � 2005, MetaQuotes Software Corp.
Tick_Chart

This custom indicator is designed to provide a visual representation of real-time price movement by tracking the flow of "ticks" (the smallest and most frequent changes in price) rather than standard time-based candles. It focuses on capturing the immediate history of the market to help traders visualize recent volatility and price progression.

Core Functionality

The script operates by creating a dynamic visual map that captures a specific window of historical price data. Instead of looking at hourly or daily trends, it looks backward through a set number of recent ticks to show how the price has traveled from one moment to the next.

How the Logic Works:

  • Historical Windowing: The script maintains a buffer (a memory list) that stores a large number of previous price points. This allows it to draw a continuous line representing the "path" the price has taken over a specific duration.
  • Real-Time Tracking: Every time the market moves, the script updates this history. It records both the "Bid" (the price at which you can sell) and the "Ask" (the price at which you can buy), ensuring that the visual output reflects the actual spread and movement of the market.
  • Price Extremes Identification: The logic automatically scans the current window of data to identify the highest and lowest prices reached during that period.
  • Dynamic Visual Boundaries: Based on these identified highs and lows, the script calculates specific boundaries. If the current price is near a recent high or low, the indicator updates its visual markers accordingly. This helps in identifying whether the price is currently pushing toward a new extreme or consolidating within a recent range.
  • Rolling Update System: To ensure the chart remains fluid and doesn't become cluttered with outdated data, the script periodically refreshes its entire memory buffer. Every 10 ticks, it clears out the old "tail" of the data and begins recording the new price movements, providing a moving window of active market activity.

Summary for the User

Essentially, this tool acts like a high-speed "breadcrumb trail." While standard charts might show you where the price closed an hour ago, this script shows you the micro-movements of the last several thousand price changes, highlighting the most recent peaks and valleys to give you a clearer sense of current momentum.

Miscellaneous
Implements a curve of type %1
7 Views
0 Downloads
0 Favorites
Tick_Chart
//+------------------------------------------------------------------+
//|                                                   Tick Chart.mq4 |
//|     Copyright © 2005, MetaQuotes Software Corp. © 2010, J.Arent. |
//|              http://www.metaquotes.net/, http://www.fxtools.info |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Cornsilk
#property indicator_color3 Blue

extern int period=2000;
extern int width=50;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

int tik,t;
double buf[],buf2[],MaxB,MinB=1000;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_SECTION);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_NONE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_SECTION);
   SetIndexBuffer(2,ExtMapBuffer3);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i,b;
//---- 
t++;
b=period;
ArrayResize(buf,b); 
ArrayResize(buf2,b); 

if(tik==0)
   {
   for(i=0;i<b;i++)
      {
      buf[i]=Bid;
      buf2[i]=Ask;
      }
   ExtMapBuffer2[0]=Bid+width*Point;   
   ExtMapBuffer2[1]=Bid-width*Point;   
   tik=1;
   }
   MaxB=0;MinB=1000;
   for(i=b-1;i>0;i--)
      {
      buf[i]=buf[i-1];
      if(MaxB<buf[i])MaxB=buf[i];
      if(MinB>buf[i])MinB=buf[i];
      buf2[i]=buf2[i-1];
      if(MaxB<buf2[i])MaxB=buf2[i];
      if(MinB>buf2[i])MinB=buf2[i];
      } 
buf[0]=Bid;
buf2[0]=Ask;
for(i=0;i<b;i++)
   {
   ExtMapBuffer1[i]=buf[i];
   ExtMapBuffer3[i]=buf2[i];
   }
if(MathCeil(t/10)*10==t)
   {
   for(i=b;i<Bars;i++)
      {
      ExtMapBuffer1[i]=Bid;
      ExtMapBuffer3[i]=Ask;
      }
      ArrayInitialize(ExtMapBuffer2,Bid); 
      if(MaxB-Bid<width*Point)ExtMapBuffer2[0]=Bid+width*Point;
      if(Bid-MinB<width*Point)ExtMapBuffer2[1]=Bid-width*Point;
      //Print(MaxB,"+",Bid,"+",MinB);
   }   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments