TickUpDown_Ron_v01a
Download scriptThis tool is designed to provide a visual representation of market momentum by tracking the direction of price movement on a "tick-by-tick" basis. Instead of looking at large price changes over minutes or hours, it focuses on the smallest possible fluctuations in the market—the "ticks."
Core Functionality
The primary purpose of this script is to count every time the current price moves upward compared to its previous position, and every time it moves downward. It essentially acts as a live scoreboard for the market's immediate volatility.
How the Logic Works
The script operates in real-time, monitoring the price constantly. Here is the step-by-step logic it follows:
- Tracking Movement: Every time the market price updates, the tool compares the new price to the one immediately preceding it.
- Upward Momentum (Green): If the new price is higher than the previous price, the script registers an "up" move. It increments a counter represented by a green indicator on your chart.
- Downward Momentum (Red): If the new price is lower than the previous price, the script registers a "down" move and increments a counter represented by a red indicator.
- Session Reset: To ensure the data remains relevant to the current trading period, the tool automatically resets its counters at the start of every new candle (time bar). This allows you to see the specific momentum occurring within the most recent timeframe.
Visual Representation
On your trading platform, this logic manifests as a series of visual markers:
- Green Dots: These represent the cumulative count of upward price movements.
- Red Dots: These represent the cumulative count of downward price movements.
By observing these two counters, you can get a quick, at-a-glance summary of whether the market has been predominantly pushing in one direction or fluctuating rapidly between both directions during the current bar.
//+------------+
//| TickUpDown |
//+------------+
#property copyright "Copyright 2008 Ron Thompson"
#property link "http://www.forexmt4.com/"
/*
This indicator counts ticks up and down
*/
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- buffers
double B1[]; //Green
double B2[]; //Red
double currTick;
double prevTick;
// bar open handling
datetime bartime=0;
//+-----------+
//| Init |
//+-----------+
int init()
{
// 233 up arrow
// 234 down arrow
// 158 little dot
// 159 big dot
// 168 open square
// 120 box with X
SetIndexBuffer(0,B1); //Green
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0,159);
SetIndexBuffer(1,B2); //Red
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1,159);
Print("Init complete");
}
//+-----------+
//| DE-Init |
//+-----------+
int deinit()
{
Print("DE-Init complete");
}
//+-----------+
//| Each Tick |
//+-----------+
int start()
{
if(bartime!=iTime(Symbol(),0,0))
{
bartime=iTime(Symbol(),0,0);
B1[0]=0;
B2[0]=0;
}
prevTick=currTick;
currTick=Close[0];
if(currTick>prevTick) B1[0]++;
if(currTick<prevTick) B2[0]++;
}//start
Comments