Author: ��������2011��1��9�գ�2011��6��25�����޸�
YangTrader

This tool is designed to provide traders with a visual representation of where the current price sits relative to its recent price extremes. Rather than looking at raw price action, it converts market movements into a percentage-based scale, making it easier to identify overbought or oversold conditions at a glance.

How the Logic Works

1. Identifying Price Boundaries The script constantly scans the market history to find two critical values: the highest high and the lowest low achieved within a specific "look-back" window (determined by the Time Window setting). This establishes a temporary range or "corridor" for the price action during that period.

2. Calculating Relative Position Once the highs and lows are identified, the script calculates exactly where the current closing price falls between those two points. It expresses this position as a percentage from 0 to 100:

  • If the price is at the very bottom of the range, the value is near 0.
  • If the price is at the very top of the range, the value is near 100.
  • This essentially "normalizes" different types of assets into a single uniform scale.

3. Smoothing the Data Because raw percentage calculations can sometimes be jumpy or erratic as prices fluctuate rapidly, the script applies a mathematical smoothing process (a Linear Weighted Moving Average). This filters out the "noise" of minor price spikes, resulting in a much smoother line that highlights the primary trend of the price momentum.

Visual Interpretation

The final output is a smooth line displayed in a separate window below your main chart. By observing where this line moves in relation to predefined horizontal levels (such as 15, 35, and 80), you can more easily perceive:

  • Momentum Trends: Whether the price is consistently pushing toward the upper limits or retreating toward the lower limits.
  • Market Extremes: Identifying areas where the price may be stretched too far in one direction, potentially signaling a cooling-off period or a trend reversal.
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
YangTrader
//--  Original Author : yangshu --//
//--  copyright YangShu 2011    --//
//--  Email:yangshu@yangshu.net --//
//--  Web: http://yangshu.net   --//
#property copyright "ÑîÊ÷´´ÓÚ2011Äê1ÔÂ9ÈÕ£¬2011Äê6ÔÂ25ÈÕÔÙÐÞ¸Ä" 
#property link      "http://yangshu.net" 
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1  DeepSkyBlue

#property indicator_level1 15
#property indicator_level2 35
#property indicator_level3 80
#property indicator_levelcolor Gray

#property indicator_minimum 0
#property indicator_maximum 100
extern int TimeWindow=34;
extern int Sensitive=8;
double buf[];
double buf2[];

int init()
  {
   SetIndexBuffer(0,buf);
   ArraySetAsSeries(buf,true);
   SetIndexStyle(0,DRAW_LINE);
   IndicatorShortName("YangTrader (13,21,34,55,89,144) - http://yangshu.net");
   return(0);
  }

int start()
  {
   int limit=Bars;

   ArrayResize(buf2,limit); 
   ArraySetAsSeries(buf2,true);
   for(int i=0; i<limit; i++)
    {
       double HHV=High[iHighest(NULL,0,MODE_HIGH,TimeWindow,i)];
       double LLV=Low[iLowest(NULL,0,MODE_LOW,TimeWindow,i)]; 
       buf2[i]=100*(Close[i]-LLV)/(HHV-LLV);
    }
   ArrayResize(buf,limit); 
   ArraySetAsSeries(buf,true);
   for(i=0; i<limit; i++) buf[i]=iMAOnArray(buf2,limit,Sensitive,0,MODE_LWMA,i);  
   return(0);
  }

Comments