MarketHeartBeat_02
Download scriptThe MarketHeartBeat tool is designed to provide traders with a real-time, minute-by-minute breakdown of market activity and price movement trends directly on their trading chart. Instead of looking at general price history, this script focuses on the "heartbeat" of the market—specifically tracking how many times the price moves (ticks) and the direction of those movements within every individual minute of an hour.
Core Functionality
The script monitors the live price feed and performs three primary tasks simultaneously:
- Tick Counting: It tracks the frequency of price updates. By counting every "tick" (the smallest possible price change), it allows you to see how active or volatile a specific minute is compared to others.
- Directional Tracking: The tool distinguishes between upward and downward movements. It calculates the total number of points gained during positive price movements and the total number of points lost during negative price movements.
- Minute-by-Minute Mapping: Rather than providing a single average for the whole hour, it organizes this data into a 60-minute timeline. This allows you to see exactly which minutes are experiencing high activity and whether the momentum is shifting toward buying or selling.
Data Visualization
The script generates a live on-screen display that lists all 60 minutes of the current hour. For each minute, it provides:
- The Minute Marker (M): A chronological list from 0 to 59.
- Total Ticks (T): The volume of activity for that specific minute.
- Positive Movement (Pl): The cumulative distance the price moved upward.
- Negative Movement (Mi): The cumulative distance the price moved downward.
Dynamic Refresh & Reset
To ensure the data remains relevant, the script features an automated management system. It continuously updates the current minute's statistics as new prices arrive and pre-clears the data for the upcoming minute to ensure a clean start. Once the hour concludes (at minute 59), it resets the entire cycle to begin the next hour with fresh data.
Practical Application
For a trader, this tool acts as a diagnostic map of market behavior. It helps identify patterns such as "accumulation" (high ticks with low price movement) or "exhaustion" (sudden large movements in a single minute), providing a granular view of the market's pulse that standard charts might overlook.
/*------------------------------------------------------------------+
| MarketHeartBeat_02.mq4 |
| Copyright © 2010 |
+------------------------------------------------------------------*/
#property copyright "Copyright © 2010, basisforex@gmail.com"
#property link "basisforex@gmail.com"
//+-----------------------------------------------------------------+
#property indicator_chart_window
//------------------------------
double dPrice;
double nTick[60];
double SumTickPl[60];
double SumTickMn[60];
string T[60];
string t;
string m = " <---";
//+-----------------------------------------------------------------+
int init()
{
return(0);
}
//+-----------------------------------------------------------------+
int start()
{
if(dPrice == 0) dPrice = Bid;
nTick[Minute()] = nTick[Minute()] + 1;
if(Bid - dPrice > 0)
{
SumTickPl[Minute()] = SumTickPl[Minute()] + ((Bid - dPrice) / Point);
dPrice = Bid;
}
if(Bid - dPrice < 0)
{
SumTickMn[Minute()] = SumTickMn[Minute()] + ((dPrice - Bid) / Point);
dPrice = Bid;
}
//-----
t = "";
for(int i = 0; i < 60; i++)
{
if(i == Minute())
{
T[i] = "M" + i + " T= " + DoubleToStr(nTick[i], 0) + " Pl= " + DoubleToStr(SumTickPl[i], 0) + " Mi= " + DoubleToStr(SumTickMn[i], 0) + m + "\n";
}
else T[i] = "M" + i + " T= " + DoubleToStr(nTick[i], 0) + " Pl= " + DoubleToStr(SumTickPl[i], 0) + " Mi= " + DoubleToStr(SumTickMn[i], 0) + "\n";
//-----
t = t + T[i];
}
if(Minute() == 59)
{
nTick[0] = 0;
SumTickPl[0] = 0;
SumTickMn[0] = 0;
}
else
{
nTick[Minute() + 1] = 0;
SumTickPl[Minute() + 1] = 0;
SumTickMn[Minute() + 1] = 0;
}
Comment(t);
}
Comments