StrongDay+OCHL
Download scriptThis indicator is designed to identify significant price movements by highlighting "strong" candles that deviate substantially from the recent average market activity. Instead of relying on simple moving averages, it uses a dynamic calculation of volatility to pinpoint moments where the market experienced a high-impact shift in direction.
How the Logic Works
The script operates through three primary stages of analysis:
1. Establishing a Baseline (Average Volatility) The tool first looks back at a specific number of previous bars (defined by the user) to calculate the "normal" size of price movements. It measures the average distance between the opening and closing prices over this period. This creates a benchmark for what a standard candle looks like in the current market environment.
2. Identifying "Strong" Candles The script then compares the most recent candles against that established baseline. A candle is flagged as "Strong" only if it meets two specific criteria:
- Magnitude: The body of the candle must be significantly larger than the average size (based on a user-defined percentage).
- Relative Strength: The script ensures that the movement is substantial relative to the total range of the candle. This prevents "noisy" price action from being flagged if the price moved a long distance but was balanced by an equally large move in the opposite direction within the same timeframe.
3. Determining Directional Signals Once a "Strong" candle is identified, the script determines whether the movement represents potential buying or selling pressure based on where the current price sits relative to the center point of that strong candle:
- Bullish Indicators: If the price opens above the midpoint of a strong candle, the tool identifies it as upward momentum and places a visual marker at the bottom.
- Bearish Indicators: If the price opens below the midpoint of a strong candle, the tool identifies it as downward momentum and places a visual marker at the top.
Summary for the User
In essence, this script filters out minor market fluctuations to show you only the most decisive moves. It highlights instances where the market "broke" its usual rhythm with a high-momentum candle, providing clear visual cues on whether that break was aggressively bullish or bearish.
//+------------------------------------------------------------------+
//| StrongDay+OCHL.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_chart_window
extern int HistCountBars=300; //ñòðèì èíäèêàòîð íå ïî âñåé èñòîðèè à òîëüêî íà îïðåäåëåííîå êîëè÷åñòâî áàðîâ íàçàä
extern int DeltaBars=28; //êîëè÷åñòâî áàðîâ äëÿ ðàñ÷åòà ñðåäíåé äëèíû ñâå÷è
extern int MoreThen=60; //ïðîöåíò îò ñðåäíåé äëèíû ñâå÷è, êîòîðûé õîòèì èñïîëüçîâàòü
double CBuffer[];
double UpBuffer[];
double DownBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID);
SetIndexArrow(0,225);
SetIndexBuffer(0,UpBuffer);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID);
SetIndexArrow(1,226);
SetIndexBuffer(1,DownBuffer);
SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,1,Orange);
SetIndexArrow(2,108);
SetIndexBuffer(2,CBuffer);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=HistCountBars;
double Sd;
//----
// if(counted_bars>0) counted_bars--;
// for(int i=HistCountBars; i>0; i--) {
for(int i=0; i<HistCountBars; i++) {
Sd = 0;
for (int j=1; j<=DeltaBars; j++)
{
Sd = Sd + MathAbs(Open[i+j]-Close[i+j]);
}
Sd = Sd/DeltaBars;
Sd = (Sd*MoreThen)/100;
if (MathAbs(Open[i+1]-Close[i+1])> Sd && (MathAbs(Open[i+1]-Close[i+1])/MathAbs(High[i+1]-Low[i+1]))>0.4) CBuffer[i+1]=(Open[i+1]+Close[i+1]+High[i+1]+Low[i+1])/4;
if (MathAbs(Open[i+1]-Close[i+1])> Sd && (MathAbs(Open[i+1]-Close[i+1])/MathAbs(High[i+1]-Low[i+1]))>0.4 && Open[i] > ((Open[i+1]+Close[i+1]+High[i+1]+Low[i+1])/4)) UpBuffer[i]=Low[i]-5*Point;
if (MathAbs(Open[i+1]-Close[i+1])> Sd && (MathAbs(Open[i+1]-Close[i+1])/MathAbs(High[i+1]-Low[i+1]))>0.4 && Open[i] < ((Open[i+1]+Close[i+1]+High[i+1]+Low[i+1])/4)) DownBuffer[i]=High[i]+5*Point;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments