Tick_on_Chart Own Window

Author: Copyright � 2005, MetaQuotes Software Corp.
Tick_on_Chart  Own Window

This script is designed as a visual tool for the MetaTrader trading platform that tracks and displays price fluctuations in real-time. Rather than focusing on complex predictive algorithms, its primary purpose is to provide a clear, visual representation of current market movement relative to recent history.

Core Functionality

The logic operates by continuously capturing the latest market price (the "Bid") and organizing it into a structured sequence. It maintains a rolling window of these prices—specifically looking at a set number of historical points—to help you see how the current price compares to the immediate past.

How the Logic Works

  • Data Collection: Every time the market moves (a "tick"), the script captures the latest price. It organizes these prices into a buffer, creating a continuous stream of information that updates instantly as the market breathes.
  • Historical Comparison: The tool automatically identifies the highest and lowest price points within its defined look-back period. By calculating these extremes, the script creates a "boundary" for current price action.
  • Visual Smoothing: Instead of showing erratic jumps, the logic organizes the data into a histogram format. This allows you to see the trajectory of the price movement over a specific timeframe.
  • Dynamic Updating: The script is programmed to refresh its visual output at regular intervals. It checks the passage of time and, once certain thresholds are met, it updates the history, resets the "boundaries" based on new highs and lows, and redraws the current price position.

User Experience

From a practical standpoint, this tool acts as a high-frequency tracker. It provides a visual "echo" of market activity, helping you observe the volatility and the range of price movement in real-time. By visualizing the relationship between the current price and the recent highs and lows, it helps you see the immediate "shape" of the market trend more clearly on your chart.

Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
Tick_on_Chart Own Window
//+------------------------------------------------------------------+
//|                                                Tick_on_Chart.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Orange
#property indicator_color2 Yellow
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
int tik,t;
   double buf[],MaxB,MinB=1000;
extern int period=200;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexStyle(0,DRAW_SECTION);
   SetIndexBuffer(0,ExtMapBuffer1);
   //SetIndexStyle(1,DRAW_NONE);
   //SetIndexBuffer(1,ExtMapBuffer2);
   
//----
   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);

if(tik==0)
   {
   for(i=0;i<b;i++)
      {
      buf[i]=Bid;
      }
   ExtMapBuffer2[0]=Bid+5*Point;   
   ExtMapBuffer2[1]=Bid-5*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];
      } 
buf[0]=Bid;
for(i=0;i<b;i++)
   {
   ExtMapBuffer1[i]=buf[i];
   }
if(MathCeil(t/10)*10==t)
   {
   for(i=b;i<Bars;i++)
      {
      ExtMapBuffer1[i]=Bid;
      }
      ArrayInitialize(ExtMapBuffer2,Bid); 
      if(MaxB-Bid<5*Point)ExtMapBuffer2[0]=Bid+5*Point;
      if(Bid-MinB<5*Point)ExtMapBuffer2[1]=Bid-5*Point;
      //Print(MaxB,"+",Bid,"+",MinB);
   }   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments