test3_v1
Download scriptThis indicator is designed to help traders visually identify significant price movements by highlighting specific types of "swings" or candle bodies on a trading chart. Instead of looking at every minor fluctuation, the tool filters the data to point out moments where the price has moved with a specific level of intensity.
How it Works
The script scans the historical price data on your chart and looks for a discrepancy between two specific points: the Opening Price and the Closing Price of each individual candle.
It calculates the "gap" or change that occurred during that specific period. If that change is larger than a pre-defined threshold (the "Swing" value you set in the settings), the indicator triggers a visual marker.
Key Features
- Bearish Movement Detection: When the price closes significantly lower than it opened (meaning there was a strong downward push), the script places a specific marker on the chart. This helps identify areas where selling pressure was dominant.
- Bullish Movement Detection: Conversely, when the price closes significantly higher than it opened (indicating strong upward momentum), the script places a different marker.
- Customizable Sensitivity: The "Swing" parameter allows you to control how sensitive the tool is. By adjusting this value, you can decide whether you want to see every small price move or only the most significant, large-scale swings.
Visual Representation
The indicator uses two distinct types of arrows to distinguish between these movements:
- Red Markers: These highlight instances where there was a notable drop in price from open to close.
- White Markers: These highlight instances where there was a notable rise in price from open to close.
By providing these visual cues, the script allows you to quickly scan a chart and identify "high-impact" candles where the market moved decisively in one direction, making it easier to spot trends or potential reversals at a glance.
//+------------------------------------------------------------------+
//| Large Close Swings Indicator.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link "http://www.lightpatch.com/forex"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 White
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//----
int ExtCountedBars=0;
// indicator parameters
extern double Swing=0.0010;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
SetIndexStyle(0,DRAW_ARROW);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexArrow(0,226);
SetIndexStyle(1,DRAW_ARROW);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexArrow(1,225);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double sum=0;
double oldsum=0;
double change=0;
int i;
int pos=Bars-ExtCountedBars-1;
if(Bars<=10) return(0);
ExtCountedBars=IndicatorCounted();
// check for possible errors
if (ExtCountedBars<0) return(-1);
// last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
while(pos>=0)
{
change=Open[pos]-Close[pos];
if (change>Swing)
{
ExtMapBuffer1[pos]=Close[pos];
ExtMapBuffer2[pos]=0;
}
if (change<(Swing*(-1)))
{
ExtMapBuffer1[pos]=0;
ExtMapBuffer2[pos]=Close[pos];
}
pos--;
}
//---- zero initial bars
// if(ExtCountedBars<1)
// {
// for(i=1;i<MA_Period;i++) ExtMapBuffer1[Bars-i]=0;
// for(i=1;i<MA_Period;i++) ExtMapBuffer2[Bars-i]=0;
// }
return(0);
}
//+------------------------------------------------------------------+
Comments