0% found this document useful (0 votes)
459 views21 pages

Creating A Modified Fisher Transformation For Profitable Trading.

Creating a Modified Fisher Transformation for Profitable Trading.

Uploaded by

FabioSantos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
459 views21 pages

Creating A Modified Fisher Transformation For Profitable Trading.

Creating a Modified Fisher Transformation for Profitable Trading.

Uploaded by

FabioSantos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 21
You have 2tree member-only stories left this month. Sign up for Medium and getan extra one Creating a Modified Fisher Transformation for Profitable Trading. How to Create the Fisher Transformation Indicator to Trade the Markets Profitably. SofienKaabar Jan 30:8 min oad smoot tng tee est Pale Ty Soto ‘We know that financial returns are not normally distributed which makes most statistical analyses not quite accurate. We can however transform the data to make it more normal. One of the ways to do so is to use the Fisher ‘Transformation. In this article, we will discuss a modified version of the Fisher Transformation and apply it to trading through a back-test of two different and yet promising strategies. Ifyou are also interested in more transformation, feel free to check out the below article that presents a type of strategy on the Relative Strength Index, oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 rng ae Fiar anaomson or Pre rg [by Stan Katha Sap, 204 Masa ‘The RST Delta Indicator. Enhancing Momentum Trading. Creating and Coding a New Momentum Strategy in Python. The Normal Distribution Concept One of the pillars of descriptive statistics is the normal distribution curve. It describes how random variables are distributed and centered around a central value. It often resembles a bell. Some data in the world are said to be normally distributed. This means that their distribution is symmetrical with 50% of the data lying to the left of the mean and 50% of the data lying to the right of the mean. Its mean, median, and mode are also equal as seen in the below curve. ‘Normal Distribution Curve SP. Moxiinedinanioabizesing rat herlockt 60876 was ‘moot Cr ated tanamaton or Prtale g [y Stan Kaatr [ha Stn, 204 Masa ‘An example ofthe Normal Distribution Curve. Image by Author) The above curve shows the number of values within a number of standard deviations. For example, the area shaded in red represents around 1.33x of standard deviations away from the mean of zero. We know that if data is normally distributed then: * About 68% of the data falls within 1 standard deviation of the mean, ‘* About 95% of the data falls within 2 standard deviations of the mean. * About 99% of the data falls within 3 standard deviations of the mean, oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 was Crain Meso Fata Tartan Potiate Tr y Stan Presumably, this can be used to approximate the way to use financial returns data, but studies show that financial data is not normally distributed. For the moment, we can assume it is so that we can use such indicators. The flaw of the method does not hinder much its usefulness. Let us now see how to create the Modified Fisher Transformation which is basically like the original one but with some minor changes to enhance the results and make them easier to obtain. Creating the Modified Fisher Transformation Created John F. Ehlers, the indicator seeks to transform the p1 normal Gaussian (normal) distribution. This is very helpful in detecting reversals which is the main point of the article. The steps to create the Modified Fisher Transformation are somewhat similar to the original Fisher ‘Transformation. Here is how we do it: eintoa + Select a lookback period and calculate a normalized version of the OHLC data using the original Stochastic formula as seen in the formula below: oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 ea ‘moot ng ted Fe Taremtn Pratl Try Son i x xX — Xmin ‘normalized = Xmax — Xmin + Trap the values from the first step between -1 and +1 using the following normalization formula: Xnew = 2 * Xnormatizea — 1 * Create a condition that eliminates the -1.00's and +1.00's and transforms them into -0.999's and +0.999's so that we do not get infinite values. This also serves to make the indicator bounded between two levels we will see later. + Apply the following formula to the results from the last step: Fisher T tion = = *] ( ) =<« isher Transformation n oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 eas ‘moot rng ae tanamaon Pratl ag [by Stan Kat [ha Stn, 204 Mase Now that we have the Modified Fisher Transformation Indicator, we can proceed by coding it in Python before starting the back-tests, The below plot shows a S-period Modified Fisher Transformation with subjective boundaries at -2.00 and +2.00. =| af LUSOCHE inte frst panel withthe 5-poros Modified Fisher Transformation inthe Moxiinedinanioabizesing rat helomatocrnheatng 608676 res ‘moot rng ae tanamaon Pratl ag [by Stan Kat [ha Stn, 204 Mase det stoc astic(Data, lookback, what, where): for i in range (len (Data) ): bey: Datall, where] = (Data[i, what) - min(Daza[i - lookback + Ask +4, 21)) / {maw{Davali lookbace + 1: #1, 1]} = min(Datali ~ lookback # 2:4 + 1, 21)) except Valucirror: pase Datals, where] = Data(:, xh return Data def modified fisher transform(Data, lookback, what, where): Data = stochastic(Data, lookback, what, where) Data{:, where] = Datalt, where) / 100 Datai:, where] = (2 * Data(:, shere]) - 1 for £ in range (Len (Data) ) if Dataliy where] == 1: Batali, where] = 9.999 Af pata(i, where) <= -1: Batali, where] = -0.999 for 4 in range(len (Data) ) Data[i, where | 1) = 0.5 * (mp.log({1 + Dacali, where}} / (1 ~ Datali, where])}) return Data 4 Using the Transformation on an OHLC array with a few extra columns ny_chle data = medified *isher_transform(ny_chle data, 5, 3, 4) oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 tas Naturally with the correction I have added, the maximum values will be 3.80 and the minimum values will be -3.80. Therefore, we can say that the indicator is now bounded even though the original version was not shown to be bounded, e oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 was ‘moot ng tee aration Pratl Tr hy Son i EURUSD inthe frst panel wth the S-perod Mositeg Fisher Transformation inthe escond panel (mage by Author) Back-testing a Simple Strategy We can simply create strategy relying on subjective boundaries. This means that we can create the following conditions to trade the indicator: + Go long (Buy) whenever the Fisher Transformation Indicator reaches -2.00. Hold this position until getting a contrarian signal. * Go short (Sell) whenever the Fisher Transformation Indicator reaches +2.00, Hold this position until getting a contrarian signal. + The risk management system relies on the Average True Range Indicator which we will see later in the chapter. ‘The barriers are manually chosen across time as it seems that the historical Modified Fisher Transformation Indicator is bounded by a -2.00 and +2.00 ‘most of the time. Let us the below results following the above strategy on hourly OHLC data since January 2011. oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 so ‘moot ‘rang ata Fa Taran ral a by Satan Kar [Toa Sap n,271|Man HitKatio | Expectancy | Profit Factor | Theoretical Risk-Reward | Realized Rsk-Reward | Break-even Mit Ratio | Namber of Trades EURUSD 8s ame 14] a8 a6 | [USDCHE| 76.20%] 268e 12 o-0| re 2057 [cprusp| 7.800 Bae «a3 039) re 1922 fAuDusD| 749696] sane a 30 794% 2055 [apusp| nat 300 . oa ro.) 20st) ESDCAD| es Hise | 0] 742 215 URCAD] 747096) sabe 24] a Ee >on) EURGHP) 735806) ome va oe] 743% ‘ce [EURCHF) 80.2%] se 275] oa 70.42% 10 [AUDEAD| 76 wae a ou e389 1985 Performance Summary Table. (Image by Author) Modified Fisher Transformation Strategy ‘moot rng atta tanaomaon trae rg [by Sean Kat [ha Sap, 204 Mss Equity curves following the Fisher Transformation strategy. imagoby Author) ‘The signal function used for the above strategy is written as the following: def signal (ata, what, buy, sell): for i in range (len (Data) ): 2 Data[i, what] < lower_bavrier and Data[i - 1, what] > lower_barrier and’ bats[i - 2, what] > loser barrier + Datali, buy} = 1 Af Datali, what] > upper_barrier and Datali ~ 1, what] < upper_barrier and bata[i = 2, what] < upper_barrier + Data[i, sell] The 3.80 Extreme Strategy oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 ses It is obvious that with the extremes we have at -3.80 and +3.80, we can try forming an extreme strategy that will undoubtedly have rare signals but probably of a higher quality. The conditions are simple. First of all, we will increase the lookback period of the Modified Fisher Transformation Indicator to 50 periods and then we will simply: * Go long (Buy) whenever the indicator touches -3.80. Hold the position until getting a contrarian signal or getting stopped out by the Average True Range risk management system (either profitably or with aloss). * Go short (Sell) whenever the indicator touches +3.80. Hold the position until getting a contrarian signal or getting stopped out by the Average True Range risk management system (either profitably or with a loss). ate ad ead ‘moot ng tea arming hy Son i EURCHF inthe frst panel wth tne S0-pariod Modifie Fisher Transformation inthe sacand panel. (Image by Author) With the above parameters, we can get the following si 1500 values. Notice how rare the signals are but also notice how they seem to predict a market reversal. nals on the last “hei Moxiinedinaniealzsing rai hecreomatocrchatng 80876 62s Stnal chart onthe EURCHF following the 80 strategy. Image by Author) And now, let us back-test the strategy on the EURCHF hourly data since 2011. Below is the equity curve with an average spread of 0.2 pips. Modified Fisher Transformation Strategy anor ae 0 Ap 2000 p Equity cuve onthe EURCHF following the 380 strategy. Image by Author) Even though we have only made 149 trades since 2011, the hit ratio was an astonishing 90%. However, it is very rare to get a signal and therefore, the strategy can be left as a serious confirmation factor in the trades we initiate. Clarification on the Risk Management System ‘When I say I use ATR-based risk management system (Average True Range), it means that the algorithm will do the following steps with regards to the position it takes. oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 02s ‘moot ng tee aration Pratl Tr hy Son i Along (Buy) position: + The algorithm initiates a buy order after a signal has been generated following a certain strategy. + Then, the algorithm will monitor the ticks and whenever the high equals certain constant multiplied by ATR value at the time of the trade inception, an exit (at profit) order is initiated. Simultaneously, if alow equals a certain constant multiplied by ATR value at the time of the trade inception is seen, an exit (at loss) is initiated. The exit encountered first is naturally the taken event. Ashort (Sell) position: + The algorithm initiates a short sell order after a signal has been generated following a certain strategy. © Then, the algorithm will monitor the ticks and whenever the low equals acertain constant multiplied by ATR value at the time of the trade inception, an exit (at profit) order is initiated. Simultaneously, if a high equals a certain constant multiplied by ATR value at the time of the trade inception is seen, an exit (at loss) is initiated. The exit encountered first is naturally the taken event. oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 ares ‘nooae rng ate Fier tanaomaton Prt reg y Setar Kat [ha Sap, 204 Mss oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 ‘noone ng ested Tareamton Pratl Trad hy Son i [EURUSD houtly data with the 50-perod Exponential Average True Range. Image by Author The plot above shows the Average True Range I generally use. It is based on an exponential moving average as opposed to the original smoothed moving average. ‘Take a look at the latest value on the ATR. It is around 0.0014 (14 pips). If we initiate a buy order following a simple 2.00 risk-reward ratio (risking half of what we expect to gain), we can place an order this way: + Buy at current market price. + Take profit at current market price + (2x 14 pips). * Stop the position at current market price — (1 x 14 pips). In case you are interested in seeing a technical indicator that uses the ATR in its function, you can check out this article: ‘The Super'Trend Indicator in Python — Coding and Back-Testing Its Strategy How to code it, back-test, and evaluate it on FX Trading Moxiinedinanioabizeing rat ihenomatrcrich-atng 608676 82s ‘moot ng tee aration Pratl Tr hy Son i Conclusion ‘Why was this article written? It is certainly not a spoon-feeding method or the way to a profitable strategy. If you follow my articles, you will notice that I place more emphasize on how to do it also provide functions not full replicable code. In the financial industry, you should combine the pieces yourself from other exogenous information and data, only then, will you master the art of research and trading. \stead of here it is and that I Lalways advise you to do the proper back-tests and understand any risks relating to trading. For example, the above results are not very indicative as the spread we have used is very competitive and may be considered hard to constantly obtain in the retail trading world (but not impossible). However, with institutional bid/ask spreads, it may be possible to lower the costs such as that a systematic medium-frequency strategy starts being very profitable. oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 woe ‘moot rng ae tanamaon Pratl ag [by Stan Kat [ha Stn, 204 Mase DataScience MachneLoaming —Arificianeligonce Investing Fnance Learn more. Make Medium yours. Share your thinking. oxiinedinanioabizesing rat nhenlomatocrnheatng 608676 aves

You might also like