<jupyter_start><jupyter_text>Inverse Fisher Transform https://www.motivewave.com/studies/inverse_fisher_transform.htmhttps://www.metastock.com/customer/resources/tasc/?id=60https://www.mesasoftware.com/papers/TheInverseFisherTransform.pdf<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

import warnings
warnings.filterwarnings("ignore")

# yfinance is used to fetch data 
import yfinance as yf
yf.pdr_override()
# input
symbol = 'AAPL'
start = '2018-01-01'
end = '2019-01-01'

# Read data 
df = yf.download(symbol,start,end)

# View Columns
df.head()
import talib as ta
v1 = 0.1 * (ta.RSI(df['Adj Close'], timeperiod=5) - 50)
v2 = ta.WMA(v1, timeperiod=9)
df['IFT'] = pd.Series((np.exp(2 * v2) - 1) / (np.exp(2 * v2) + 1))
df.head(20)
fig = plt.figure(figsize=(14,10))
ax1 = plt.subplot(2, 1, 1)
ax1.plot(df['Adj Close'])
ax1.set_title('Stock '+ symbol +' Closing Price')
ax1.set_ylabel('Price')

ax2 = plt.subplot(2, 1, 2)
ax2.plot(df['IFT'], label='Inverse Fisher Transform', color='red')
#ax2.axhline(y=0, color='blue', linestyle='--')
ax2.axhline(y=0.5, color='darkblue')
ax2.axhline(y=-0.5, color='darkblue')
ax2.grid()
ax2.set_ylabel('Inverse Fisher Transform')
ax2.set_xlabel('Date')
ax2.legend(loc='best')<jupyter_output><empty_output><jupyter_text>Candlestick with Inverse Fisher Transform<jupyter_code>from matplotlib import dates as mdates
import datetime as dt

dfc = df.copy()
dfc['VolumePositive'] = dfc['Open'] < dfc['Adj Close']
#dfc = dfc.dropna()
dfc = dfc.reset_index()
dfc['Date'] = pd.to_datetime(dfc['Date'])
dfc['Date'] = dfc['Date'].apply(mdates.date2num)
dfc.head()
from mpl_finance import candlestick_ohlc

fig = plt.figure(figsize=(14,10))
ax1 = plt.subplot(2, 1, 1)
candlestick_ohlc(ax1,dfc.values, width=0.5, colorup='g', colordown='r', alpha=1.0)
ax1.xaxis_date()
ax1.xaxis.set_major_formatter(mdates.DateFormatter('%d-%m-%Y'))
ax1.grid(True, which='both')
ax1.minorticks_on()
ax1v = ax1.twinx()
colors = dfc.VolumePositive.map({True: 'g', False: 'r'})
ax1v.bar(dfc.Date, dfc['Volume'], color=colors, alpha=0.4)
ax1v.axes.yaxis.set_ticklabels([])
ax1v.set_ylim(0, 3*df.Volume.max())
ax1.set_title('Stock '+ symbol +' Closing Price')
ax1.set_ylabel('Price')

ax2 = plt.subplot(2, 1, 2)
ax2.plot(df['IFT'], label='Inverse Fisher Transform', color='red')
ax2.axhline(y=0.5, color='darkblue')
ax2.axhline(y=-0.5, color='darkblue')
ax2.grid()
ax2.set_ylabel('Inverse Fisher Transform')
ax2.set_xlabel('Date')
ax2.legend(loc='best')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18668252080856124, 'fraction_numerical': 0.042409829567974636, 'mean_word_length': 6.489614243323442, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '79257', 'license': 'MIT', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1055, 'n_words': 185, 'path': 'Python_Stock/Technical_Indicators/Inverse_Fisher_Transform.ipynb', 'repo_name': 'eu90h/Stock_Analysis_For_Quant', 'size': '2523'}