Click here to Login




Inverse Fisher Transform: Indicator, composite and trading system

Updated on 2012-06-21





Published in the Technical Analysis of Stocks and Commodities magazine in the May 2004 issue, the inverse fisher transform is an indicator created by John Ehlers. The Inverse Fisher Transform was developed to help traders and investors with their timing decisions to buy and sell securities. It does this by altering the probability distribution function (PDF) of any indicator and makes it appear smoother.


Inverse Fisher Transform Indicator

In this article, I will first show you how to create a custom indicator that calculates the inverse fisher transform of other indicators.
Even though the implementation of the inverse fisher transform is not necessary (I will show you why in the next paragraph), this is a good exercise to help you learn how to implement your own trading indicators with QuantShare trading software.

- Select "Tools" then "Create Functions"
- Click on "Add" to create a new function
- Type the function name (Example: InverseFT) then click on "Save"

The Inverse Fisher Transform equation is as follows:

y = ( Exp(2 * x) - 1 ) / ( Exp(2 * x) + 1 )

Under the "Parameters" panel, click on "Add parameter" then rename "NoName0" to "series".
In the "Script" panel, type the following code:

for(int i=0;i < result.Length;i++)
{
double x = series[i];
result[i] = (Math.Exp(2 * x) - 1 ) / ( Math.Exp(2 * x) + 1 );
}


The above code loops through each trading bar and calculates the inverse fisher transform based on the above equation.

Notes:
- "series" is a vector that is passed as an argument to the "InverseFT" function.
- The result should always be associated with a vector whose name is "result".
- You can download this indicator (ready to use) from the sharing server: Inverse Fisher Transform




As you see in the above plot of the inverse fisher transform, the input should be in the range of -5 to 5. All values above 5 or below -5 will generate a result that is almost equal to 1 or -1.


Plot it on a Chart

Let us transform the relative strength index and plot it on a chart.

The RSI indicator values are in the range of 0 to 100. Before applying the inverse fisher transform, we must change that range to [-5, 5].

a = 0.1 * (rsi(14) - 50);

As I said in the previous paragraph, we can apply the inverse fisher transformation without creating a custom indicator. The above indicator (InverseFT) we have created can be implemented directly using QuantShare language.

a = 0.1 * (rsi(14) - 50);
ivt = ( Exp(2 * a) - 1 ) / ( Exp(2 * a) + 1);


Using the "InverseFT" function, we can plot the inverse fisher transform of the relative strength index by typing:

a = rsi(14);
a = 0.1 * ( a - 50 );
a = inverseft(a);
plot(a, "");


Reminder:
- To update a pane/chart formula, right click on it then select "Edit Formula".
- After you change your formula, click on "Update graph" to submit changes and refresh the chart.




Inverse Fisher Transform of Put/Call ratio

The inverse fisher transform can be applied to any trading indicator. For example, you can apply it to the individual stocks put/call ratio and thus create a time-series that generates clearer buy and sell signals.

Put/call ratio for stocks is calculated using put and call volume data that can be retrieved using the following downloader: Individual Stocks Put and Call Volume.

More information can be found here:
How to plot put/call ratio of individual stocks
How to create trading rules based on Put and Call volume data
Put-Call Ratio for Individual Stocks

Before using the "inverseft" function, we should transform the put/call ratio values. Let us say that these values fluctuate between -2 and 2.

ratio1 = GetData("putcall_volume", "put_total", LastData) / GetData("putcall_volume", "call_total", LastData);
a = ratio1 * 2.5; // Transform to the [-5, 5] interval
a = inverseft(a);


If you want to use [-5, 5] as max/low levels for the put/call ratio values then there is no need to transform the data.


Market index based on Inverse Fisher Transform

Using the composite tool, we will create a market index that calculates the average inverse fisher transform of RSI for all stocks.

- Select "Tools" then "Composites"
- Click on "Add" to create a new composite
- Select all symbols or choose symbols from a specific exchange then click on "Next"
- Select "Calculate the average of the values added..." then type the following formula:

a = rsi(14);
a = 0.1 * ( a - 50 );
a = inverseft(a);
composite = a; // Result should be associated with the "composite" variable


- Click on "Next" twice then type a name for your composite. Example: IFT_RSI.
- Click on "Next" again then save your item

The composite calculation will start automatically. Once done, a new symbol will be added to your database (_IFT_RSI).
You can display this symbol on a chart or use it in the screener, watchlist or simulator tools using the "GetSeries" function:

a = GetSeries("_IFT_RSI", close);

Note:
- Composite symbol names always start with "_".


Example of a trading system

Here, we will create a basic trading system that shows you how to simulate and backtest the inverse fisher transform.

Read the following how-to article to learn how to create a simple trading system:
How to create a trading system

In your trading system, you can use the following formula to buy securities when the inverse fisher transform of RSI is above 70.
(In the "Create a trading system" form, select "Create a trading system using the formula editor)

a = rsi(14);
a = 0.1 * ( a - 50 );
a = inverseft(a);
a = (a + 1) * 50; // Restore the [0, 100] interval

buy = a > 70;



Inverse Fisher Transform Experiment

We can create a variable in our trading system that let us compare the result of a simulation that uses a basic indicator and the result of another simulation that uses the inverse fisher transform of that indicator.

Open the previously created trading system then update its formula:

a = rsi(14);
b = 0.1 * ( a - 50 ); // Change variable to "b" so we can have access to "a" (RSI) later
b = inverseft(b);
b = (b + 1) * 50; // Restore the [0, 100] interval

Optimize("c", 0, 1, 1); // Create an optimizable variable. Its value is either 0 or 1.

rule1 = iff(c == 0, a > 70, b > 70); // If the optimizable variable is 0 then use RSI, otherwise use Inverse Fisher Transform of RSI
buy = rule1;


Save this trading system then click on "Optimize".














no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1232 days ago

Profile Graphs
Posted 1337 days ago

QuantShare
Previous Posts

More Posts

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.