Four_legs
Download scriptThis tool is designed to provide a clear visual representation of the four fundamental price points that make up every candle on a financial chart: the High, the Low, the Open, and the Close. While standard charts often show these elements combined into a single candlestick, this indicator separates them into individual lines to help traders analyze the relationship between different price levels more effectively.
Core Functionality
The primary purpose of the logic is to map out the "four legs" of price action. Instead of looking at the candle as one cohesive unit, the script isolates each specific price data point:
- High: Tracks the maximum price reached during a specific period.
- Low: Tracks the minimum price reached during that same period.
- Open: Records the price at which the period began.
- Close: Records the price at which the period ended.
How it Works
The script functions by scanning through the historical data of the market. For every bar on your chart, it extracts these four specific values and plots them as distinct lines in a separate window below your main price graph.
Because each value is plotted independently, you can easily observe:
- Price Spread: The distance between the High and Low lines shows the total volatility of that period.
- Body Dynamics: By comparing the Open and Close lines, you can see the direction and size of the price movement (the "body" of the candle).
- Interaction: You can visualize how closely these four points interact with one another, providing a more granular view of market sentiment than a standard candlestick alone can offer.
User Experience
The indicator is designed to be straightforward. It uses a customizable period setting that determines how many bars are processed at once, ensuring that the data displayed aligns perfectly with your preferred timeframe. By presenting this information in a dedicated sub-window, it allows for a clean, organized view of price structure without cluttering your primary trading screen.
//+------------------------------------------------------------------+
//| This has been coded by MT-Coder |
//| |
//| Email: mt-coder@hotmail.com |
//| Website: mt-coder.110mb.com |
//| |
//| For a price I can code for you any strategy you have |
//| in mind into EA, I can code any indicator you have in mind |
//| |
//| Don't hesitate to contact me at mt-coder@hotmail.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| This indicator shows how the lines of Highs, Lows, Opens, |
//| and Closes can interact |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MT-Coder."
#property link "http://mt-coder.110mb.com/"
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 AliceBlue
#property indicator_color2 DodgerBlue
#property indicator_color3 LightPink
#property indicator_color4 Seashell
//---- input parameters
extern int FLPeriod=1;
//---- buffers
double HighBuffer[];
double OpenBuffer[];
double CloseBuffer[];
double LowBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,HighBuffer);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,OpenBuffer);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,CloseBuffer);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,LowBuffer);
//---- name for DataWindow and indicator subwindow label
short_name="Four legs by mt-coder@hotmail.com ("+FLPeriod+")";
IndicatorShortName(short_name);
SetIndexLabel(0,"High");
SetIndexLabel(1,"Open");
SetIndexLabel(2,"Close");
SetIndexLabel(3,"Low");
//----
SetIndexDrawBegin(0,FLPeriod);
SetIndexDrawBegin(1,FLPeriod);
SetIndexDrawBegin(2,FLPeriod);
SetIndexDrawBegin(3,FLPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Four legs |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=FLPeriod) return(0);
//----
i=Bars-FLPeriod-1;
if(counted_bars>=FLPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
HighBuffer[i]=High[i];
OpenBuffer[i]=Open[i];
CloseBuffer[i]=Close[i];
LowBuffer[i]=Low[i];
i--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments