Taf
Download scriptThis trading indicator is designed to identify specific structural patterns in price action by monitoring how high and low prices move relative to one another from one candle to the next. It serves as a visual tool to help traders spot potential trend shifts or significant price levels based on consecutive movements.
Core Logic Overview
The script scans the historical price data, comparing each current candle's high and low points against the previous candle. It focuses on two specific scenarios:
- Upward Momentum Detection: The indicator looks for instances where both the high and the low of a new candle are higher than those of the preceding candle. When this happens, it tracks how many times these consecutive upward moves occur in a row.
- Downward Momentum Detection: Conversely, it monitors for situations where both the high and the low of a new candle are lower than the previous ones. It keeps a running tally of these consecutive downward moves.
Filtering and Plotting Rules
To ensure that only significant movements are highlighted rather than every minor price flicker, the script uses a qualification system:
- The Qualification Threshold: There is a user-defined setting (the "BQUALIFY" parameter) that determines the minimum number of consecutive candles in the same direction required before the indicator takes action.
- Plotting Points:
- If the price moves upward consecutively and reaches the required threshold, the script identifies the low point of a previous candle and marks it on the chart with an Aqua colored line.
- If the price moves downward consecutively and reaches the required threshold, the script identifies the high point of a previous candle and marks it with a Yellow colored line.
Summary for Traders
Essentially, this tool filters out "noise" by only acknowledging sustained moves in a single direction. By requiring a specific number of consecutive candles to move in one direction before plotting a level, it helps traders visualize price ceilings and floors that have been established by consistent momentum. The resulting lines on your chart represent these significant structural points where the market has shown clear, repeated strength or weakness.
//+------------------------------------------------------------------+
//| 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