This technical script is designed to provide traders with a real-time visual representation of price action dynamics directly on their trading platform. It functions by tracking the movement of the current market price and identifying specific extremes within a rolling timeframe.
Core Functionality
The tool works by maintaining a constant "memory" of recent price movements. Instead of looking at every single price change ever recorded, it focuses on a specific window of data (defined by a user-set period). This allows the indicator to filter out historical noise and concentrate on what is happening in the market right now.
How the Logic Works
To provide a clear picture of market behavior, the script follows three main logic steps:
- Price Tracking: The tool continuously monitors the "Bid" price (the current market price). Every time the market moves, the script updates its internal memory to reflect the new position.
- Boundary Detection: As new prices arrive, the script automatically identifies the highest and lowest points reached during the specified timeframe. It calculates these boundaries to determine how far the price has stretched in either direction relative to where it started.
- Visual Feedback: The indicator translates this data into a visual format on your chart. It creates a "section" that shows the progression of the price and uses specific markers to highlight when the price is nearing its extreme limits (the highest or lowest points).
Key Behavior for the Trader
One of the unique aspects of this script is its timing logic. It doesn't update every single millisecond; instead, it performs a comprehensive refresh of its data at specific intervals. This ensures that the visual information remains steady and readable, preventing the chart from becoming cluttered with erratic movements while still providing timely updates on market extremes.
In summary, this tool acts as a dynamic "boundary tracker," helping you visualize where the price has been recently and identifying when it is pushing toward its current high or low limits within your chosen timeframe.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| 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