PercentR - PCR1
Download scriptThe PercentR indicator is designed to provide a visual representation of where the current market price sits relative to its recent price range. It acts as a momentum and sentiment tool, helping traders identify whether an asset is overextended or approaching a potential turning point.
How it Works
The logic behind this script revolves around three key components: the Highest High, the Lowest Low, and the Current Closing Price within a specific timeframe.
- Defining the Range: The indicator looks back at a set number of previous candles (the "Period"). Within this window, it automatically identifies the highest price point reached and the lowest price point reached. This creates a dynamic "boundary" or channel for the market's recent activity.
- Calculating the Position: Instead of just looking at whether the price is going up or down, the script calculates exactly where the current closing price sits within that high-to-low range. It converts this position into a percentage value between 0 and 100.
- If the price is trading near the recent highs, the indicator moves toward the top of its scale (near 100%).
- If the price is trading near the recent lows, the indicator moves toward the bottom (near 0%).
- Visual Representation: The result is displayed as a continuous line in a separate window below your main chart. This allows you to see the "pulse" of the market's strength independently from the price action.
Practical Application
By using this percentage-based logic, traders can identify extreme market conditions:
- Overbought Conditions: When the line climbs toward the upper limit (e.g., 80%), it suggests that the price has reached the top of its recent range and may be due for a pullback or reversal.
- Oversold Conditions: When the line drops toward the lower limit (e.g., 20%), it indicates that the price is testing the bottom of its recent range, potentially signaling a time to look for a bounce.
In short, this tool simplifies complex price movements into a clear percentage scale, helping you visualize market exhaustion and potential entry or exit points more effectively.
//+------------------------------------------------------------------+
//| PercentR - PCR.mq4 |
//| Copyright © 2006 Scorpion@fxfisherman.com |
//+------------------------------------------------------------------+
#property copyright "FxFisherman.com"
#property link "http://www.fxfisherman.com"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Lime
#property indicator_level1 80
#property indicator_level2 20
extern int HL_Period=20;
extern int Shift_Bars=0;
extern int Bars_Count= 1000;
//---- buffers
double v1[];
double val1;
int init()
{
IndicatorBuffers(1);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexDrawBegin(0,-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0,"PCR");
watermark();
return(0);
}
int start()
{
int shift, limit;
double h, l, p;
int counted_bars = IndicatorCounted();
if (counted_bars > 0) counted_bars--;
limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
{
shift = i + Shift_Bars;
h = High[Highest(Symbol(), Period(), MODE_HIGH, HL_Period, shift + 1)];
l = Low[Lowest(Symbol(), Period(), MODE_LOW, HL_Period, shift + 1)];
p = Close[shift];
if (h > 0 && p > 0 && l > 0)
{
v1[i] = ((p-l)/(h-l))*100;
// v1[i] = ((h-p)/(h-l))*100;
}
}
return(0);
}
//+------------------------------------------------------------------+
void watermark()
{
ObjectCreate("fxfisherman", OBJ_LABEL, 0, 0, 0);
ObjectSetText("fxfisherman", "fxfisherman.com", 11, "Lucida Handwriting", RoyalBlue);
ObjectSet("fxfisherman", OBJPROP_CORNER, 2);
ObjectSet("fxfisherman", OBJPROP_XDISTANCE, 5);
ObjectSet("fxfisherman", OBJPROP_YDISTANCE, 10);
return(0);
}
Comments