Attachments forums

List of attachments posted on this forum.


All files on forums: 164303

Re: Ehlers Indicators for TradeStation

Banzai, Sun Dec 14, 2025 6:20 am

The Reversion Index

Links: |TradingView|TradeStation|NinjaTrader|MT4|MT5|Python|

Image


TradeStation: January 2026

In John Ehlers’ article in this issue, “The Reversion Index,” he presents an indicator that produces timely buy and sell signals for mean-reversion strategies by summing bar-to-bar price changes and normalizing them by their absolute values. He explains that the summation should cover about half of the dominant cycle in the data, and that peaks and valleys are identified by the crossings of two SuperSmoother filters with different lengths. The reversion index is a normalized sum of price differences that oscillates between -1 and +1.

EasyLanguage code for the reversion index is shown here. A sample chart of the reversion index is shown in the picture below.

Code: Select all

{
	TASC JAN 2026
	Reversion Index
	(C) 2005 John F. Ehlers
}

inputs:
	Length( 20 );
	
variables:
	DeltaSum( 0 ),
	AbsDeltaSum( 0 ),
	Count( 0 ),
	Ratio( 0 ),
	Smooth( 0 ),
	Trigger( 0 );

DeltaSum = 0;
AbsDeltaSum = 0;

for Count = 0 to Length - 1 
begin
	DeltaSum = DeltaSum + Close[Count] - Close[Count + 1];
	AbsDeltaSum = AbsDeltaSum + AbsValue( Close[Count] 
	 - Close[Count + 1] );
end;

if AbsDeltaSum <> 0 then 
	Ratio = DeltaSum / AbsDeltaSum;

Smooth = $SuperSmoother( Ratio, 8 );
Trigger = $SuperSmoother( Ratio, 4 );

Plot1( Smooth, "Smooth" );
Plot2( 0, "Zero" );
Plot3( Trigger, "Triger" );

Function: $SuperSmoother

{
	SuperSmoother Function
 	(C) 2025 John F. Ehlers
}

inputs:
	Price(numericseries),
	Period(numericsimple);

variables:
	a1( 0 ),
	b1( 0 ),
	c1( 0 ),
	c2( 0 ),
	c3( 0 );

a1 = ExpValue(-1.414 * 3.14159 / Period);
b1 = 2 * a1 * Cosine(1.414 * 180 / Period);
c2 = b1;
c3 = -a1 * a1;
c1 = 1 - c2 - c3;

if CurrentBar >= 4 then 
	$SuperSmoother = c1*(Price + Price[1]) / 2 
	 + c2 * $SuperSmoother[1] + c3 * $SuperSmoother[2];
if CurrentBar < 4 then 
	$SuperSmoother = Price;

------------------------------------------------------------------------------------------------
DOWNLOAD:
ReversionIndex.pdf
All files in topic