Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Range Expansion Index for Amibroker (AFL)
over 10 years ago
Amibroker (AFL)

3 / 5 (Votes 2)
oscillator, amibroker, moving average

The DeMark Range Expansion Index is a market-timing oscillator described in DeMark on Day Trading Options, by T.R. DeMark and T.R. Demark, Jr., McGraw Hill, 1999. The oscillator is arithmetically calculated and is designed to overcome problems with exponentially calculated oscillators, like MACD. The TD REI oscillator typically produces values of -100 to +100 with 45 or higher indicating overbought conditions and -45 or lower indicating oversold. Here is how Tom DeMark describes the calculation of Range Expansion Index:

“The first step in calculating the REI is to add together the respective differences between the current day’s high and the high two days earlier and the current day’s low and the low two days earlier. These values will be positive or negative depending on whether the current day’s high and low are greater or less than the high and low two days earlier. To prevent buying or selling prematurely into a steep price decline or advance, two additional conditions should be met to qualify a positive or negative value on a particular day: 1) either the high two days earlier must be greater than or equal to the close seven or eight days ago, or the current day’s high must be greater than or equal to the low five or six days ago; 2) either the low two days earlier must be less than or equal to the close seven or eight days ago, or the current day’s low must be less than or equal to the high five or six days ago. If either of these conditions are not satisfied, a zero value is assigned to that day. If they both are, the daily values (the differences between the highs and lows) are summed , and the specific value for that next day is determined. Next, all the positives and negative values are added together over a five-day period. This value is then divided by the absolute value price movement of each day over the five-day period. The numerator of the calculation can be either positive, negative or zero, because each day’s value is summed for five days, but the denominator is always positive because it is only concerned with the differential price movement itself. This value is then multiplied by 100. Consequently, the REI can fluctuate between +100 and -100.”


Similar Indicators / Formulas

Fisher Transform
Submitted by abc555 over 9 years ago
Submitted by prasadmuni almost 8 years ago
Submitted by prasadbrao almost 8 years ago
Fast Bos with Band colour
Submitted by anandnst almost 8 years ago
Better Volume Indicator from ThinkScript
Submitted by vole_00 almost 7 years ago
Hull Moving Average (HMA)
Submitted by kaiji over 10 years ago

Indicator / Formula

Copy & Paste Friendly
TD1 = H-Ref(H,-2);
TD2= L-Ref(L,-2);
TD3 = Iif((H>=Ref(L,-5) OR H>=Ref(L,-6)) AND (L<=Ref(H,-5) OR L<=Ref(H,-6)),1,0);
TD4 = Iif((Ref(H,-2)>=Ref(C,-7) OR Ref(H,-2)>=Ref(C,-8)) AND (Ref(L,-2)<=Ref(C,-7) OR Ref(L,-2)<=Ref(C,-8)),1,0);
TD6 = (TD1) + (TD2);
TD5 = Iif((TD3) + (TD4)>=1, (TD6), 0);
TD7 = Abs(TD1) + Abs(TD2);
TDREI =((TD5) + Ref(TD5,-1) + Ref(TD5,-2) + Ref(TD5,-3) + Ref(TD5,-4))/ (TD7) + Ref(TD7,-1) + Ref(TD7,-2) + Ref(TD7,-3) + Ref(TD7,-4)*100;
Plot(TDREI, _DEFAULT_NAME(), colorRed); 


1. Suseda

Hai Mr Kaji
I need your help.
I need AFL for TD Combo.
Could you share about that AFL Please
Thank You verymuch

Leave Comment

Please login here to leave a comment.