Tick_on_Chart_001

Download script
Author: Copyright � 2005, MetaQuotes Software Corp.
Tick_on_Chart_001

This tool is designed to provide a visual representation of price movement dynamics within the MetaTrader platform. Instead of focusing on standard candle patterns, it creates a specialized visual map that tracks how the current market price interacts with recent historical data.

Core Functionality

The script functions by maintaining a "sliding window" of price data. It looks back at a specific number of previous price points (defined by a user-set period) to establish a reference range. By analyzing this range, the tool identifies the highest and lowest price levels reached during that timeframe.

How the Logic Works

The logic follows a continuous cycle every time the market updates:

  • Data Collection: The script constantly captures the latest "Bid" price. It organizes these prices into a sequence so it can see what the market has done recently.
  • Range Analysis: Every few seconds (specifically, every 10 ticks), the script scans the collected data to find the peak maximum and the lowest minimum.
  • Dynamic Visual Mapping: The tool then projects this information onto a separate window on your chart. It creates a visual section that shows where the current price sits in relation to those historical highs and lows.
  • Visual Alerts: The script includes specific logic to monitor "proximity." If the current market price moves very close to either the recent high or the recent low, it adjusts certain visual markers on the chart. This highlights instances where the price is testing significant boundaries.

Summary for the User

Essentially, this tool acts as a visual tracker for volatility and range boundaries. It simplifies complex price history into a readable map, allowing you to see at a glance how the current price is behaving relative to the "highs" and "lows" of the recent past. It is particularly useful for identifying when the market is approaching key levels or establishing new price boundaries.

Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
Tick_on_Chart_001
//+------------------------------------------------------------------+
//|                                                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 2
#property indicator_color1 Cornsilk
#property indicator_color2 Red
//---- 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(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