This technical indicator is designed to identify and visualize specific price action patterns on a trading chart by monitoring the relationship between consecutive price candles. Instead of relying on standard moving averages or complex oscillators, it focuses on "structural" movements—specifically identifying points where the price establishes new peaks or troughs.
Core Logic and Mechanics
The tool works by constantly scanning the historical price data to detect two specific types of movement:
- Upward Strength (Higher Highs and Higher Lows): The script monitors for instances where the current candle’s high and low prices are both higher than the previous candle. When this occurs, it tracks the progression to determine if a sustained upward trend is forming.
- Downward Strength (Lower Highs and Lower Lows): Conversely, the script looks for moments where both the high and low of the current candle are lower than the previous one. This identifies consistent downward pressure.
How the Visual Data is Filtered
To ensure the indicator remains useful and isn't cluttered with every minor price fluctuation, it employs a "Qualification" system:
- Sequential Counting: The script keeps an internal tally of how many times these specific movements occur in a row. It essentially "counts" the momentum.
- Threshold Requirements: A user-defined parameter (the Qualification level) determines how many consecutive moves are required before the indicator actually draws a line on your chart. This helps filter out "noise"—small, insignificant wiggles in the price—and focuses only on significant trend shifts.
- Visual Representation: Once the movement meets the required threshold, the script plots two distinct lines on the chart:
- One line tracks the historical lows during an upward trend (shown in Aqua).
- The other line tracks the historical highs during a downward trend (shown in Yellow).
Summary for Traders
In plain terms, this indicator acts as a visual guide for trend structure. It waits for the market to prove its direction through a series of consecutive higher or lower candles. Once that movement is "qualified" by your settings, it draws lines that highlight the key structural boundaries (the peaks and valleys) of that move, helping you see the primary path the market is taking while ignoring minor fluctuations.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| Taf.mq4 |
//| Copyright © 2004, Poul_Trade_Forum |
//| Aborigen |
//| http://forex.kbpauk.ru/ |
//+------------------------------------------------------------------+
#property copyright "Poul Trade Forum"
#property link "http://forex.kbpauk.ru/"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Yellow
//---- input parameters
extern int BQUALIFY=2;
//---- buffers
double HighBuffer[];
double LowBuffer[];
double VALUE1,VALUE2,VALUE3,VALUE4,VALUE5,VALUE6;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
SetIndexStyle(0,DRAW_SECTION,EMPTY,1,Aqua);
SetIndexStyle(1,DRAW_SECTION,EMPTY,1,Yellow);
SetIndexBuffer(0,HighBuffer);
SetIndexBuffer(1,LowBuffer);
SetIndexEmptyValue(0,0);
SetIndexEmptyValue(1,0);
//---- name for DataWindow and indicator subwindow label
short_name="Taf";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
//----
SetIndexDrawBegin(0,100);
SetIndexDrawBegin(1,100);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted(),i,shift;
//---- TODO: add your code here
i=(Bars-counted_bars)-1;
for (shift=i; shift>=0;shift--)
{
LowBuffer[shift]=0;
HighBuffer[shift]=0;
if (High[shift]>=High[shift+1] && Low[shift]>=Low[shift+1])
{
if ( VALUE2 >= BQUALIFY ) LowBuffer[shift]=Low[shift+1];
if ( VALUE2 > 0 ) VALUE5=Low[shift+1];
VALUE1 = VALUE1+1;
VALUE3 = VALUE1;
VALUE2 = 0;
}
if (Low[shift]<=Low[shift+1] && High[shift]<=High[shift+1])
{
if ( VALUE1 >= BQUALIFY ) HighBuffer[shift]=High[shift+1];
if ( VALUE1 > 0 ) VALUE6=High[shift+1];
VALUE2 = VALUE2+1;
VALUE4 = VALUE2;
VALUE1 = 0;
}
//----
}
return(0);
}
//+------------------------------------------------------------------+
Comments