MTF_PriceActionChanel
Download scriptThis technical tool is designed to provide traders with a visual representation of market boundaries by creating a dynamic "channel" or "envelope" on a price chart. Rather than showing a single average price, it identifies an upper and lower range, helping users visualize the area where the market currently fluctuates.
Core Functionality
The script operates by calculating two distinct lines simultaneously:
- Upper Boundary: Represents the ceiling of the current price action.
- Lower Boundary: Represents the floor of the current price action.
By looking at these two lines together, a trader can see the "width" of the market's movement. When the distance between these lines expands, it suggests increased volatility; when they tighten, it indicates a period of consolidation or stability.
Key Technical Features
Multi-Timeframe Analysis One of the most sophisticated aspects of this script is its ability to perform Multi-Timeframe (MTF) analysis. This means that even if you are looking at a "small" timeframe chart (like a 1-minute or 5-minute chart), you can configure the indicator to pull and display data from a "larger" timeframe (such as 1-hour or Daily). This allows traders to keep an eye on the broader market trend without constantly switching windows.
Customizable Smoothing and Pricing The logic is highly flexible, allowing users to define exactly how the boundaries are calculated through several adjustable parameters:
- Moving Average Methods: You can choose between different mathematical ways to smooth out price data (such as Simple, Exponential, or Weighted averages). This determines whether the lines react quickly to new price spikes or stay "smooth" and steady.
- Applied Price Points: The script can calculate its boundaries based on various data points, such as the opening price, closing price, the highest price reached, or the lowest price reached during a specific period.
Practical Application
For a non-technical user, this tool acts as a visual guide for market "room." By identifying these price action channels, it helps in determining whether the current price is pushing against the limits of its recent range or if it is moving comfortably within the established boundaries. It effectively filters out minor market noise to highlight the significant price zones.
//+------------------------------------------------------------------+
//| MTF PriceActionChanel.mq4 PAC ik |
//| PriceActionChanel Envelopes |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net www.forex-tsd.com"
//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DarkGoldenrod
#property indicator_color2 DarkGoldenrod
#property indicator_width1 2
#property indicator_width2 2
//---- indicator parameters
extern int TimeFrame=0;
extern int MA_Period=5;
extern int MA_Shift=0;
extern int MA_Method=2;
extern int Applied_Price=0;
extern double Deviation=0.0;
extern int ______;
extern int SMA_0_EMA1_SMMA2_LWMA3;
extern int priceC0_O1_H2_L3;
extern int Md4_Tp_5_WC6;
/*************************************************************************
---------------------------------------
PRICE_CLOSE 0 Close price.
PRICE_OPEN 1 Open price.
PRICE_HIGH 2 High price.
PRICE_LOW 3 Low price.
PRICE_MEDIAN 4 Median price, (high+low)/2.
PRICE_TYPICAL 5 Typical price, (high+low+close)/3.
PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4.
You must use the numeric value of the Applied Price that you want to use
when you set the 'applied_price' value with the indicator inputs.
---------------------------------------
MODE_SMA 0 Simple moving average,
MODE_EMA 1 Exponential moving average,
MODE_SMMA 2 Smoothed moving average,
MODE_LWMA 3 Linear weighted moving average.
You must use the numeric value of the MA Method that you want to use
when you set the 'ma_method' value with the indicator inputs.
**************************************************************************/
//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
int draw_begin;
string short_name;
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexShift(0,MA_Shift*TimeFrame/Period());
SetIndexShift(1,MA_Shift*TimeFrame/Period());
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
if(MA_Period<2) MA_Period=14;
draw_begin=MA_Period-1;
//---- indicator short name
IndicatorShortName("PAC("+MA_Period+")");
SetIndexLabel(0,"Env("+MA_Period+")Upper;TF"+TimeFrame+"s"+MA_Shift+"");
SetIndexLabel(1,"Env("+MA_Period+")Lower;TF"+TimeFrame+"s"+MA_Shift+"");
SetIndexDrawBegin(0,draw_begin);
SetIndexDrawBegin(1,draw_begin);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
if(Deviation<0) Deviation=0;
if(Deviation>100.0) Deviation=100.0;
//---- initialization done
return(0);
}
// SetIndexLabel(0,"MTF_ADXBarsSmd("+ADXPeriod+")TF"+TimeFrame+"s"+Shift+"");
//----
int start()
{
datetime TimeArray[];
int i,shift,limit,y=0,counted_bars=IndicatorCounted();
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars+TimeFrame/Period();
for(i=0,y=0;i<limit;i++) {
if (Time[i]<TimeArray[y]) {y++;}
ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"PriceActionChanel",MA_Period,MA_Method,MA_Shift,Applied_Price, 0,y);
ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"PriceActionChanel",MA_Period,MA_Method,MA_Shift,Applied_Price, 1,y);
}
return(0);
}
Comments