CDRW
Download scriptThis tool is designed to analyze market price action by identifying key structural shifts in trading momentum. It operates by comparing the physical size of recent price candles against the volume of trading activity occurring during those periods. By evaluating these two factors simultaneously, the script identifies specific "zones" where the market may be showing signs of exhaustion or a potential change in direction.
Core Logic and Mechanics
The logic functions by examining a set number of historical bars (defaulting to 300) and comparing the current price movement against the previous one. It looks for specific discrepancies between Price Expansion (how far the price moved) and Trading Volume (how much activity occurred).
1. Identifying Market Reversals and Trends
The script distinguishes between "Demand" and "Supply" based on where the price closed relative to its high and low points:
- Demand Zones: When the market shows a significant price move, but the closing price is near the bottom of the candle with decreasing volume, the tool identifies this as a potential area of buying interest.
- Supply Zones: Conversely, if the price moves significantly but closes near the top of the candle with decreasing volume, it flags a potential area of selling pressure.
- Reversals: The tool looks for specific "exhaustion" signatures where the price movement is large but the supporting volume is shrinking, marking these as potential reversal points.
2. Volume Confirmation
A key component of this logic is its reliance on volume comparison. It doesn't just look at price direction; it validates whether the move is "healthy."
- If a candle is larger than the previous one but occurs on lower volume, it suggests a lack of conviction behind the move, which often precedes a trend change.
- If a candle is smaller than the previous one but occurs on higher volume, it acts as a signal for the tool to trigger a "Warning," indicating that while price movement is slowing down, heavy activity is still occurring, potentially leading to a sharp volatility spike or a shift in trend.
Visual Indicators
The script translates these complex calculations into four distinct visual markers on your chart:
- Demand/Supply: These highlights show you where the market is currently "pushing" against specific price levels.
- Reversal Signals: These indicate areas where the current momentum is losing steam and may flip in the opposite direction.
- Warnings: These serve as alerts for high-activity zones where price movement is compressing, signaling that a significant move could be imminent.
By filtering out "noise" and focusing on the relationship between price expansion and volume participation, this script helps traders identify where the market is overextended or where new structural zones are forming.
#property copyright ""
#property link ""
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Magenta
#property indicator_color2 Aqua
#property indicator_color3 Red
#property indicator_color4 Yellow
extern int NumberOfBars = 300;
extern double Offset = 5;
double R[],D[],S[],W[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
Offset = Offset*Point;
SetIndexBuffer(0,R);
SetIndexStyle(0,DRAW_ARROW,0,2);
SetIndexArrow(0, 119);
SetIndexLabel(0,"Reversal");
SetIndexBuffer(1,D);
SetIndexStyle(1,DRAW_ARROW,0,0);
SetIndexArrow(1, 233);
SetIndexLabel(1,"Demand");
SetIndexBuffer(2,S);
SetIndexStyle(2,DRAW_ARROW,0,0);
SetIndexArrow(2,234);
SetIndexLabel(2,"Supply");
SetIndexBuffer(3,W);
SetIndexStyle(3,DRAW_ARROW,0,1);
SetIndexArrow(3, 251);
SetIndexLabel(3,"Warning");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double spd1,spd2,v1,v2;
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=NumberOfBars; //Bars-counted_bars;
for(int i=limit; i>=0; i--)
{
spd1 = High[i+1] - Low[i+1];
spd2 = High[i+2] - Low[i+2];
R[i]=0; D[i]=0; S[i]=0; W[i]=0;
v1=iVolume(NULL,0,i+1);
v2=iVolume(NULL,0,i+2);
if ( spd1 > spd2 )
{
if ( v1 < v2 )
{
if ( High[i+1]-Close[i+1] < Close[i+1]-Low[i+1] )
{
R[i+1] = High[i+1] + Offset;
S[i+1] = 0;
}
if ( High[i+1]-Close[i+1] > Close[i+1]-Low[i+1] )
{
R[i+1] = Low[i+1] - Offset;
D[i+1] = 0;
}
}
if ( v1 > v2 )
{
if ( High[i+1]-Close[i+1] < Close[i+1]-Low[i+1] )
{
D[i+1] = Low[i+1] - Offset;
R[i+1] = 0;
}
if ( High[i+1]-Close[i+1] > Close[i+1]-Low[i+1] )
{
S[i+1] = High[i+1] + Offset;
R[i+1] = 0;
}
}
}
if ( spd1 < spd2 )
if ( v1 > v2 )
W[i+1] = High[i+1] + Offset;
}
//----
//----
return(0);
}
//+------------------------------------------------------------------+
Comments