{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"<h4>Created by Jaswinder Singh</h4>\n<h1><center>💸G-Research💸 Indicators 🔧plug and play🔧 features !</center></h1>\n","metadata":{}},{"cell_type":"markdown","source":"## Update \n- [Volume-Moving-Average-Convergence-Divergence](#Volume-Moving-Average-Convergence-Divergence)\n- [Typical Value Moving Average Convergence Divergence](#Typical-Value-Moving-Average-Convergence-Divergence)    \n- [Typical Value Volume Weighted Moving Average](#Typical-Value-Volume-Weighted-Moving-Average)\n- [Typical Value](#Typical-Value)\n- [Percentage Value Oscillator](#Percentage-Value-Oscillator)\n- [Kaufman Efficiency](#Kaufman-Efficiency)\n","metadata":{}},{"cell_type":"markdown","source":"<hr >\n\n# <span class=\"title-section w3-xxlarge\" id=\"outline\">Table Of Content 📑</span>\n\n\n1. [IMPORTS](#IMPORTS) \n\n2. [Installing NitroFe](#Installing-NitroFe) \n\n3. [Creating Features](#Creating-Features)\n    \n    3.1 [Series Weighted Moving Feature](#Series-Weighted-Moving-Feature)\n    \n    3.2 [Percentage Value Oscillator](#Percentage-Value-Oscillator)\n\n    3.3 [Moving Average Convergence Divergence](#Moving-Average-Convergence-Divergence)\n    \n    3.4 [Typical Value](#Typical-Value)\n    \n    3.5 [Kaufman Efficiency](#Kaufman-Efficiency)\n    \n    3.6 [Average Directional Movement Index](#Average-Directional-Movement-Index)\n    \n    3.7 [Moving average Features](#Moving-average-Features)\n    \n    3.8 [Relative Strength Index](#Relative-Strength-Index)\n    \n    3.9 [Inverse Fisher Relative Strength Index](#Inverse-Fisher-Relative-Strength-Index)\n    \n    3.10 [Aroon Oscillator](#Aroon-Oscillator)\n    \n    3.11 [Triple Exponential Moving Average Oscillator](#Triple-Exponential-Moving-Average-Oscillator)\n    \n4. [Combination Features](#Combination-Features)\n\n    4.1 [Typical Value Moving Average Convergence Divergence](#Typical-Value-Moving-Average-Convergence-Divergence)\n    \n    4.2 [Typical Value Volume Weighted Moving Average](#Typical-Value-Volume-Weighted-Moving-Average)\n    \n    4.3 [Volume-Moving-Average-Convergence-Divergence](#Volume-Moving-Average-Convergence-Divergence)\n\n\n<hr >","metadata":{}},{"cell_type":"markdown","source":"<span id=\"IMPORTS\"><h1><center>IMPORTS</center></h1></span>","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport plotly.express as px\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots\nimport plotly.express as px","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:15:59.623567Z","iopub.execute_input":"2022-01-17T14:15:59.623975Z","iopub.status.idle":"2022-01-17T14:16:01.141391Z","shell.execute_reply.started":"2022-01-17T14:15:59.623881Z","shell.execute_reply":"2022-01-17T14:16:01.140392Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<hr >\n\n\n<span id=\"Installing-NitroFe\"><h1><center>Installing NitroFe</center></h1></span>","metadata":{}},{"cell_type":"code","source":"!pip install NitroFe","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-01-17T14:16:01.143170Z","iopub.execute_input":"2022-01-17T14:16:01.143455Z","iopub.status.idle":"2022-01-17T14:16:19.725221Z","shell.execute_reply.started":"2022-01-17T14:16:01.143412Z","shell.execute_reply":"2022-01-17T14:16:19.724497Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"📚 To read more about NitroFe you can visit the documentation page https://github.com/NITRO-AI/NitroFE.\n\n\n\n🌟 Like this Project? Give us a star on GitHub\n<hr >","metadata":{}},{"cell_type":"markdown","source":"<span id=\"Preparing-data\"><h1><center>Preparing data</center></h1></span>","metadata":{}},{"cell_type":"code","source":"data = pd.read_csv('../input/g-research-crypto-forecasting/train.csv') \nasset_details = pd.read_csv('../input/g-research-crypto-forecasting/asset_details.csv') ","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:16:19.726334Z","iopub.execute_input":"2022-01-17T14:16:19.726572Z","iopub.status.idle":"2022-01-17T14:17:20.978307Z","shell.execute_reply.started":"2022-01-17T14:16:19.726544Z","shell.execute_reply":"2022-01-17T14:17:20.977527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"btc = data[data[\"Asset_ID\"]==1].reset_index(drop = True)\nbtc['timestamp'] = pd.to_datetime(btc['timestamp'], unit='s')\nbtc = btc.set_index('timestamp')[-500:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:20.980836Z","iopub.execute_input":"2022-01-17T14:17:20.981240Z","iopub.status.idle":"2022-01-17T14:17:21.474881Z","shell.execute_reply.started":"2022-01-17T14:17:20.981193Z","shell.execute_reply":"2022-01-17T14:17:21.473859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":" ## Philosophy\n The goal here is to provide you basic-elements/lego pieces, such that you can stack them to create your own features ! \n \n \n You can create a volume weighted moving average out of typical value  or create MACD out of a hull moving average, so on and so forth !","metadata":{}},{"cell_type":"markdown","source":"<hr >\n\n\n<span id=\"Creating-Features\"><h1><center>Creating Features</center></h1></span>","metadata":{}},{"cell_type":"markdown","source":"<span id=\"Series-Weighted-Moving-Feature\"><h2><center>Series Weighted Moving Feature</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Series \\ Weighted \\ Moving \\ Feature[t] = \\frac{\\operatorname{operation} (dataframe[(t-'lookback \\ period') \\to t] * dataframe \\ for \\ weight[(t-'lookback \\ period') \\to t])}{\\operatorname{operation} (dataframe \\ for \\ weight[(t-'lookback \\ period') \\to t])} $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import SeriesWeightedMovingFeature\nob = SeriesWeightedMovingFeature(lookback_period=8, operation= np.mean)\nres = ob.fit(btc['Close'][-500:],btc['Volume'][-500:],first_fit=True)['Close'][-100:]\n\nfrom NitroFE import ExponentialMovingFeature\nob = ExponentialMovingFeature(span=8)\nres2 = ob.fit(btc['Close'][-500:], first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:21.476109Z","iopub.execute_input":"2022-01-17T14:17:21.476337Z","iopub.status.idle":"2022-01-17T14:17:22.248648Z","shell.execute_reply.started":"2022-01-17T14:17:21.476310Z","shell.execute_reply":"2022-01-17T14:17:22.247966Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\n\ncandlestick.add_trace(go.Scatter(x=data.index, y=res.values,mode='lines',line=dict(color='royalblue', width=5),name='Volume Weighted Closing Moving Feature'))\ncandlestick.add_trace(go.Scatter(x=data.index, y=res2.values,mode='lines',line=dict(color='yellow', width=5),name='Exponential Moving Feature'))\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1500,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:22.249895Z","iopub.execute_input":"2022-01-17T14:17:22.250401Z","iopub.status.idle":"2022-01-17T14:17:23.361450Z","shell.execute_reply.started":"2022-01-17T14:17:22.250366Z","shell.execute_reply":"2022-01-17T14:17:23.360547Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Percentage-Value-Oscillator\"><h2><center>Percentage Value Oscillator</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Fast \\ exponential \\ moving \\ feature \\ (FEMF) = Exponential \\ moving \\ feature \\ of \\ 'fast \\ period' \\ span $$\n\n$$ Slow \\ exponential \\ moving \\ feature \\ (SEMF) = Exponential \\ moving \\ feature \\ of \\ 'slow \\ period' \\ span $$\n\n$$ Raw \\ Percentage \\ Value \\ Oscillator = \\frac{SEMF - FEMF}{FEMF} $$\n\n$$ Percentage \\ Value \\ Oscillator = Exponential \\ moving \\ feature \\ of \\ 'smoothing \\ period' \\ span \\ over \\ 'Raw \\ Percentage \\ Value \\ Oscillator' $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import PercentageValueOscillator\nob=PercentageValueOscillator(fast_period=15, slow_period=10,smoothing_period=20)\nres=ob.fit(btc['Close'][-500:],first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:23.362674Z","iopub.execute_input":"2022-01-17T14:17:23.363017Z","iopub.status.idle":"2022-01-17T14:17:23.370493Z","shell.execute_reply.started":"2022-01-17T14:17:23.362982Z","shell.execute_reply":"2022-01-17T14:17:23.369576Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\nfeaturefig=go.Figure(go.Scatter(x=data.index,y=[0]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values>=0,res.values, 0),mode='lines', fill='tonexty', line_color='green'))\nfeaturefig.add_trace(go.Scatter(x=data.index,y=[0]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values<0,res.values,0),mode='lines',fill='tonexty',line_color='red'))\n\nfeaturefig.update_layout(title = {'text': 'Percentage Value Oscillator','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:23.371536Z","iopub.execute_input":"2022-01-17T14:17:23.371769Z","iopub.status.idle":"2022-01-17T14:17:23.477537Z","shell.execute_reply.started":"2022-01-17T14:17:23.371739Z","shell.execute_reply":"2022-01-17T14:17:23.476622Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Moving-Average-Convergence-Divergence\"><h2><center>Moving Average Convergence Divergence</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Moving \\ average \\ convergence \\ divergence \\ (MACD) = Exponential \\ moving \\ average \\ of \\ (Absolute \\ Price \\ Oscillator) $$\n\n<br>\n\n$$ Moving average \\ convergence \\ divergence \\ histogram = (Absolute \\ Price \\ Oscillator)- (Exponential \\ moving \\ average \\ of \\ (Absolute \\ Price)) $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import MovingAverageConvergenceDivergence\nob=MovingAverageConvergenceDivergence(fast_period=26, slow_period=12, smoothing_period=9)\nres=ob.fit(btc['Close'][-500:],first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:23.479066Z","iopub.execute_input":"2022-01-17T14:17:23.479298Z","iopub.status.idle":"2022-01-17T14:17:23.486189Z","shell.execute_reply.started":"2022-01-17T14:17:23.479270Z","shell.execute_reply":"2022-01-17T14:17:23.485480Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\nfeaturefig=go.Figure(data = go.Bar(x=data.index, y=res.values,\n                             marker_color=pd.Series(res.values).rolling(2,min_periods=2).agg(lambda x: 1 if x[-1:].values[0]>=x[-2:].values[0] else 0 ).\\\n                             fillna(1).replace(1,'green').replace(0,'red').values))\nfeaturefig.update_layout(title = {'text': 'Moving Average Convergence Divergence Chart','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:23.488844Z","iopub.execute_input":"2022-01-17T14:17:23.489320Z","iopub.status.idle":"2022-01-17T14:17:23.603750Z","shell.execute_reply.started":"2022-01-17T14:17:23.489270Z","shell.execute_reply":"2022-01-17T14:17:23.602759Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Typical-Value\"><h2><center>Typical Value</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Typical \\ Value[t]= \\frac{ \\max{(dataframe[(t-lookback \\ period) \\to t])} +\\min{(dataframe[(t-lookback \\ period) \\to t])} + dataframe[t] }{3} $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import TypicalValue\nob = TypicalValue(lookback_period=32)\nres = ob.fit(btc['Close'][-500:],first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:23.605006Z","iopub.execute_input":"2022-01-17T14:17:23.605308Z","iopub.status.idle":"2022-01-17T14:17:23.872035Z","shell.execute_reply.started":"2022-01-17T14:17:23.605278Z","shell.execute_reply":"2022-01-17T14:17:23.871011Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\n\ncandlestick.add_trace(go.Scatter(x=data.index, y=res.values,mode='lines',line=dict(color='royalblue', width=5),name='Typical Value'))\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1500,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:23.873476Z","iopub.execute_input":"2022-01-17T14:17:23.873811Z","iopub.status.idle":"2022-01-17T14:17:23.927849Z","shell.execute_reply.started":"2022-01-17T14:17:23.873767Z","shell.execute_reply":"2022-01-17T14:17:23.926982Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Kaufman-Efficiency\"><h2><center>Kaufman Efficiency</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Kaufman \\ Efficiency[t]= \\frac{|dataframe[t]-dataframe[t-lookback \\ period]|}{\\sum_{i=t-lookback \\ period+1}^{t}|dataframe[i]-dataframe[i-1]|} $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import KaufmanEfficiency\nob = KaufmanEfficiency(lookback_period=12)\nres = ob.fit(btc['Close'][-500:], first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:23.928918Z","iopub.execute_input":"2022-01-17T14:17:23.929132Z","iopub.status.idle":"2022-01-17T14:17:24.213593Z","shell.execute_reply.started":"2022-01-17T14:17:23.929106Z","shell.execute_reply":"2022-01-17T14:17:24.212790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\nfeaturefig=go.Figure(data = go.Scatter(x=data.index, y=res.values,mode='lines',line=dict(color='yellow', width=5)))\nfeaturefig.update_layout(title = {'text': 'Kaufman Efficiency','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:24.214586Z","iopub.execute_input":"2022-01-17T14:17:24.214822Z","iopub.status.idle":"2022-01-17T14:17:24.302739Z","shell.execute_reply.started":"2022-01-17T14:17:24.214795Z","shell.execute_reply":"2022-01-17T14:17:24.301913Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Average-Directional-Movement-Index\"><h2><center>Average Directional Movement Index</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Raw \\ Positive \\ Directional \\ Movement[t] = \\max{(dataframe[(t-directional \\ movement \\ lookback \\ period ) \\to t])} - \\max{(dataframe[(t-2*directional\\ movement \\ lookback \\ period) \\to (t-directional \\ movement \\ lookback \\ period)])} $$\n\n<br>\n\n$$ Raw \\ Negative \\ Directional \\ Movement[t] = \\min{(dataframe[(t-2*directional \\ movement \\ lookback \\ period) \\to (t-directional \\ movement \\ lookback \\ period)])} - \\min{(dataframe[(t-directional \\ movement \\ lookback \\ period) \\to t)} $$\n\n<br>\n\n$$ Positive \\ Directional \\ Movement[t] \\ (+DM) = if (Raw \\ Positive \\ Directional_Movement[t] > Raw \\ Negative \\ Directional \\ Movement[t]) \\ and \\ (Raw \\ Positive \\ Directional \\ Movement[t] >0), then \\ Raw \\ Positive \\ Directional \\ Movement[t] \\ else \\ 0 $$\n\n<br>\n\n$$ Negative \\ Directional \\ Movement[t] \\ (-DM) = if (Raw \\ Negative \\ Directional \\ Movement[t] > Raw \\ Positive \\ Directional \\ Movement[t]) \\ and \\ (Raw \\ Negative \\ Directional \\ Movement[t] >0), then \\ Raw \\ Negative \\ Directional \\ Movement[t] \\ else \\ 0 $$\n\n<br>\n\n$$ Positive \\ Directional \\ Index \\ (+DI) = 100*\\frac{Smoothed \\ moving \\ average \\ of \\ Positive \\ Directional \\ Movement \\ with \\ length \\ 'directional \\ movement \\ smoothing \\ period' }{Average \\ True \\ Range \\ of \\ dataframe} $$\n\n<br>\n\n$$ Negative_Directional_Index \\ (-DI) = 100*\\frac{Smoothed \\ moving \\ average \\ of \\ Negative\\ Directional \\ Movement \\ with \\ length \\ 'directional \\ movement \\ smoothing \\ period' }{Average \\ True \\ Range \\ of \\ dataframe} $$\n\n<br>\n\n$$ average \\ directional \\ index \\ (ADX) = Smoothed \\ moving \\ average \\ of \\ 100*\\frac{+DI - -DI}{+DI + -DI} \\ with \\ length \\ 'average \\ directional \\ movement \\ smoothing \\ period' $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import AverageDirectionalMovementIndex\nob = AverageDirectionalMovementIndex(\n    directional_movement_lookback_period=8,\n    directional_movement_smoothing_period=8,\n    average_directional_movement_smoothing_period=8,\n    directional_movement_smoothing_min_periods=0,\n    true_range_lookback=8,\n    average_true_range_span=8,\n    average_directional_movement_min_periods=None)\nres = ob.fit(btc['Close'][-500:], first_fit=True)['Close'][-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:24.304130Z","iopub.execute_input":"2022-01-17T14:17:24.304362Z","iopub.status.idle":"2022-01-17T14:17:25.057688Z","shell.execute_reply.started":"2022-01-17T14:17:24.304333Z","shell.execute_reply":"2022-01-17T14:17:25.056676Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\nfeaturefig=go.Figure(data = go.Bar(x=data.index, y=res.values,\n                             marker_color=pd.Series(res.values).rolling(2,min_periods=2).agg(lambda x: 1 if x[-1:].values[0]>=x[-2:].values[0] else 0 ).\\\n                             fillna(1).replace(1,'green').replace(0,'red').values))\nfeaturefig.update_layout(title = {'text': 'Average Directional Movement Index','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:25.059047Z","iopub.execute_input":"2022-01-17T14:17:25.059252Z","iopub.status.idle":"2022-01-17T14:17:25.162809Z","shell.execute_reply.started":"2022-01-17T14:17:25.059227Z","shell.execute_reply":"2022-01-17T14:17:25.161974Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Moving-average-Features\"><h2><center>Moving average Features</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"<h4>Hull moving average</h4>","metadata":{}},{"cell_type":"markdown","source":"$$ \\operatorname{WMA_(\\frac{window}{2})} = Weighted \\ Moving \\ Average \\ of \\ length \\ \\frac{window}{2} \\ over \\ dataframe $$\n\n$$ \\operatorname{WMA_(window)} = Weighted \\ Moving \\ Average \\ of \\ length \\ window \\ over \\ dataframe $$\n\n$$ \\operatorname{Raw \\ Hull \\ Moving \\ Average} = 2*\\operatorname{WMA_(\\frac{window}{2})} - \\operatorname{WMA_(window)} $$\n\n$$ \\operatorname{Hull \\ Moving \\ Average} = Weighted \\ Moving \\ Average \\ of \\ length \\ \\sqrt(window) over \\operatorname{Raw \\ Hull \\ Moving \\ Average} $$","metadata":{}},{"cell_type":"markdown","source":"<h4>Kaufman Adaptive Moving Average</h4>","metadata":{}},{"cell_type":"markdown","source":"$$ Current \\ value[t] = dataframe[t] $$\n<br>\n$$ ER[t] = Kaufman \\ Efficiency \\ Ratio[t] $$\n<br>\n$$ fast \\ ema \\ alpha = \\frac{2}{1+fast \\ ema \\ span} $$\n<br>\n$$ slow \\ ema \\ alpha = \\frac{2}{1+slow \\ ema \\ span} $$\n<br>\n$$ Smoothing \\ Constant[t] = (ER[t] * (fast \\ ema \\ alpha - slow \\ ema \\ alpha ) + slow \\ ema \\ alpha)^{2} $$\n<br>\n$$ KAMA[t]= KAMA[t-1] + Smoothing \\ Constant[t] * ( Current \\ value[t] - KAMA[t-1] ) $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import HullMovingFeature\nob = HullMovingFeature(window=20,operation=np.sum)\nres = ob.fit(btc['Close'][-500:], first_fit=True)[-100:]\n\nfrom NitroFE import KaufmanAdaptiveMovingAverage\nob = KaufmanAdaptiveMovingAverage(kaufman_efficiency_lookback_period=8,kaufman_efficiency_min_periods=0)\nres2 = ob.fit(btc['Close'][-500:], first_fit=True)['Close'][-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:25.164060Z","iopub.execute_input":"2022-01-17T14:17:25.164263Z","iopub.status.idle":"2022-01-17T14:17:27.189127Z","shell.execute_reply.started":"2022-01-17T14:17:25.164238Z","shell.execute_reply":"2022-01-17T14:17:27.188302Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\n\ncandlestick.add_trace(go.Scatter(x=data.index, y=res.values,mode='lines',line=dict(color='royalblue', width=5),name='Hull Moving Average'))\ncandlestick.add_trace(go.Scatter(x=data.index, y=res2.values,mode='lines',line=dict(color='yellow', width=5),name='Kaufman Adaptive Moving Average'))\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1500,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:27.190446Z","iopub.execute_input":"2022-01-17T14:17:27.190834Z","iopub.status.idle":"2022-01-17T14:17:27.249368Z","shell.execute_reply.started":"2022-01-17T14:17:27.190790Z","shell.execute_reply":"2022-01-17T14:17:27.248833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Relative-Strength-Index\"><h2><center>Relative Strength Index</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Difference \\ value[t] (DFV) = dataframe[t] - dataframe[t-1] $$\n<br>\n$$ Upwards \\ movement[t] (UM) = DFV[t] \\ if \\ DFV[t]>0 \\ else \\ 0 $$\n<br>\n$$ Downward \\ movement[t] (DM) = |DFV[t]| \\ if \\ DFV[t]<0 \\ else \\ 0 $$\n<br>\n$$ RS = \\frac{Smoothed \\ moving \\ average \\ of \\ UM \\ over \\ 'lookback \\ period' \\ period }{Smoothed \\ moving \\ average \\ of \\ DM \\ over \\ 'lookback \\ period' \\ period} $$\n<br>\n$$ RSI = 100 -\\frac{100}{1+RS} $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import RelativeStrengthIndex\nob = RelativeStrengthIndex(lookback_period=8)\nres = ob.fit(btc['Close'][-500:], first_fit=True)['Close'][-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:27.250342Z","iopub.execute_input":"2022-01-17T14:17:27.251078Z","iopub.status.idle":"2022-01-17T14:17:29.993538Z","shell.execute_reply.started":"2022-01-17T14:17:27.251044Z","shell.execute_reply":"2022-01-17T14:17:29.992626Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\n#featurefig=go.Figure(data = go.Scatter(x=data.index, y=res.values,mode='lines'))\n#fig.add_trace(go.Scatter(x=data.index,y=[50]*len(data.index),mode='lines'))\n\nfeaturefig=go.Figure(go.Scatter(x=data.index,y=[50]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values>=50,res.values, 50),mode='lines', fill='tonexty', line_color='green'))\nfeaturefig.add_trace(go.Scatter(x=data.index,y=[50]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values<50,res.values,50),mode='lines',fill='tonexty',line_color='red'))\n\nfeaturefig.update_layout(title = {'text': 'Relative Strength Index','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:29.994765Z","iopub.execute_input":"2022-01-17T14:17:29.995010Z","iopub.status.idle":"2022-01-17T14:17:30.094817Z","shell.execute_reply.started":"2022-01-17T14:17:29.994980Z","shell.execute_reply":"2022-01-17T14:17:30.093677Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Inverse-Fisher-Relative-Strength-Index\"><h2><center>Inverse Fisher Relative Strength Index</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ RSI = Relative \\ Strength \\ Index $$\n<br>\n$$ ranged \\ RSI = 0.1 * (RSI - 50) $$\n<br>\n$$ wRSI = weighted \\ moving \\ average \\ of ranged \\ RSI \\ of \\ size \\ 'lookback \\ for \\ inverse \\ fisher' $$\n<br>\n$$ IFRSI = \\frac{\\exp(2wRSI)-1}{\\exp(2wRSI)+1} $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import InverseFisherRelativeStrengthIndex\nob = InverseFisherRelativeStrengthIndex(lookback_period=8,lookback_for_inverse_fisher=8)\nres = ob.fit(btc['Close'][-500:], first_fit=True)['Close'][-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:30.096112Z","iopub.execute_input":"2022-01-17T14:17:30.096901Z","iopub.status.idle":"2022-01-17T14:17:33.052359Z","shell.execute_reply.started":"2022-01-17T14:17:30.096849Z","shell.execute_reply":"2022-01-17T14:17:33.051430Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\n#featurefig=go.Figure(data = go.Scatter(x=data.index, y=res.values,line=dict(color='yellow', width=5)))\n\nfeaturefig=go.Figure(go.Scatter(x=data.index,y=[0]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values>=0,res.values, 0),mode='lines', fill='tonexty', line_color='green'))\nfeaturefig.add_trace(go.Scatter(x=data.index,y=[0]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values<0,res.values,0),mode='lines',fill='tonexty',line_color='red'))\n\nfeaturefig.update_layout(title = {'text': 'Inverse Fisher Relative Strength Index','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:33.053587Z","iopub.execute_input":"2022-01-17T14:17:33.053862Z","iopub.status.idle":"2022-01-17T14:17:33.150498Z","shell.execute_reply.started":"2022-01-17T14:17:33.053832Z","shell.execute_reply":"2022-01-17T14:17:33.149685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Aroon-Oscillator\"><h2><center>Aroon Oscillator</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Aroon \\ Up[t] = \\frac{'lookback \\ period'- Period \\ since \\ 'lookback \\ period' \\ High }{'lookback \\ period'} $$\n<br>\n$$ Aroon \\ Down[t] = \\frac{'lookback \\ period'- Period \\ since \\ 'lookback \\ period' \\ Low }{'lookback \\ period'} $$\n<br>\n$$ Aroon \\ Oscillator[t] = Aroon \\ Up[t] - Aroon \\ Down[t] $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import AroonOscillator\nob = AroonOscillator(lookback_period=8)\nres = ob.fit(btc['Close'][-500:], first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:33.151861Z","iopub.execute_input":"2022-01-17T14:17:33.152213Z","iopub.status.idle":"2022-01-17T14:17:33.287455Z","shell.execute_reply.started":"2022-01-17T14:17:33.152183Z","shell.execute_reply":"2022-01-17T14:17:33.286679Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\n#featurefig=go.Figure(data = go.Scatter(x=data.index, y=res.values,line=dict(color='yellow', width=5)))\n\nfeaturefig=go.Figure(go.Scatter(x=data.index,y=[0]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values>=0,res.values, 0),mode='lines', fill='tonexty', line_color='green'))\nfeaturefig.add_trace(go.Scatter(x=data.index,y=[0]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values<0,res.values,0),mode='lines',fill='tonexty',line_color='red'))\n\n\nfeaturefig.update_layout(title = {'text': 'Aroon Oscillator','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:33.288615Z","iopub.execute_input":"2022-01-17T14:17:33.288885Z","iopub.status.idle":"2022-01-17T14:17:33.390625Z","shell.execute_reply.started":"2022-01-17T14:17:33.288854Z","shell.execute_reply":"2022-01-17T14:17:33.389865Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Triple-Exponential-Moving-Average-Oscillator\"><h2><center>Triple Exponential Moving Average Oscillator</center></h2></span>","metadata":{}},{"cell_type":"markdown","source":"$$ Triple \\ Exponential \\ Moving \\ Average \\ Oscillator[t] = \\frac{Triple \\ Exponential \\ Moving \\ Average[t]-Triple \\ Exponential \\ Moving \\ Average[t-1]}{Triple \\ Exponential \\ Moving \\ Average[t-1]} $$","metadata":{}},{"cell_type":"code","source":"from NitroFE import TripleExponentialMovingAverageOscillator\nob = TripleExponentialMovingAverageOscillator(span=8)\nres = ob.fit(btc['Close'][-500:], first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:33.392094Z","iopub.execute_input":"2022-01-17T14:17:33.394943Z","iopub.status.idle":"2022-01-17T14:17:33.457718Z","shell.execute_reply.started":"2022-01-17T14:17:33.394898Z","shell.execute_reply":"2022-01-17T14:17:33.456901Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\n#featurefig=go.Figure(data = go.Scatter(x=data.index, y=res.values,line=dict(color='yellow', width=5)))\n\nfeaturefig=go.Figure(go.Scatter(x=data.index,y=[0]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values>=0,res.values, 0),mode='lines', fill='tonexty', line_color='green'))\nfeaturefig.add_trace(go.Scatter(x=data.index,y=[0]*len(data.index),mode='lines'))\nfeaturefig.add_trace(go.Scatter(x=data.index, y=np.where(res.values<0,res.values,0),mode='lines',fill='tonexty',line_color='red'))\n\nfeaturefig.update_layout(title = {'text': 'Triple Exponential Moving Average Oscillator','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:33.458761Z","iopub.execute_input":"2022-01-17T14:17:33.458982Z","iopub.status.idle":"2022-01-17T14:17:33.560123Z","shell.execute_reply.started":"2022-01-17T14:17:33.458956Z","shell.execute_reply":"2022-01-17T14:17:33.559225Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Combination-Features\"><h1><center>Combination Features</center></h1></span>","metadata":{}},{"cell_type":"markdown","source":"Here are a few examples of the complex features you can make with the combination of the basic set of features !","metadata":{}},{"cell_type":"markdown","source":"<span id=\"Typical-Value-Moving-Average-Convergence-Divergence\"><h2><center>Typical Value Moving Average Convergence Divergence</center></h2></span>","metadata":{}},{"cell_type":"code","source":"from NitroFE import TypicalValue\nob = TypicalValue(lookback_period=32)\nres = ob.fit(btc['Close'][-500:],first_fit=True)\n\n\nfrom NitroFE import MovingAverageConvergenceDivergence\nob=MovingAverageConvergenceDivergence(fast_period=26, slow_period=12, smoothing_period=9)\nres=ob.fit(res,first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:33.561123Z","iopub.execute_input":"2022-01-17T14:17:33.561321Z","iopub.status.idle":"2022-01-17T14:17:33.817139Z","shell.execute_reply.started":"2022-01-17T14:17:33.561296Z","shell.execute_reply":"2022-01-17T14:17:33.815949Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\nfeaturefig=go.Figure(data = go.Bar(x=data.index, y=res.values,\n                             marker_color=pd.Series(res.values).rolling(2,min_periods=2).agg(lambda x: 1 if x[-1:].values[0]>=x[-2:].values[0] else 0 ).\\\n                             fillna(1).replace(1,'#1f77b4').replace(0,'#9467bd').values))\nfeaturefig.update_layout(title = {'text': 'Typical Value Moving Average Convergence Divergence Chart','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:33.821527Z","iopub.execute_input":"2022-01-17T14:17:33.821821Z","iopub.status.idle":"2022-01-17T14:17:33.929188Z","shell.execute_reply.started":"2022-01-17T14:17:33.821785Z","shell.execute_reply":"2022-01-17T14:17:33.928354Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Typical-Value-Volume-Weighted-Moving-Average\"><h2><center>Typical Value Volume Weighted Moving Average</center></h2></span>","metadata":{}},{"cell_type":"code","source":"from NitroFE import TypicalValue\nob = TypicalValue(lookback_period=32)\nres = ob.fit(btc['Close'][-500:],first_fit=True)\n\nfrom NitroFE import SeriesWeightedMovingFeature\nob = SeriesWeightedMovingFeature(lookback_period=8, operation= np.mean)\nres = ob.fit(res,btc['Volume'][-500:],first_fit=True)['Close'][-100:]\n\nfrom NitroFE import ExponentialMovingFeature\nob = ExponentialMovingFeature(span=8)\nres2 = ob.fit(btc['Close'][-500:], first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:33.930419Z","iopub.execute_input":"2022-01-17T14:17:33.930657Z","iopub.status.idle":"2022-01-17T14:17:34.371387Z","shell.execute_reply.started":"2022-01-17T14:17:33.930629Z","shell.execute_reply":"2022-01-17T14:17:34.370063Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\n\ncandlestick.add_trace(go.Scatter(x=data.index, y=res.values,mode='lines',line=dict(color='#1f77b4', width=5),name='Typical Value Volume Weighted Moving Average'))\ncandlestick.add_trace(go.Scatter(x=data.index, y=res2.values,mode='lines',line=dict(color='#9467bd', width=5),name='Exponential Moving Feature'))\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1500,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:34.372789Z","iopub.execute_input":"2022-01-17T14:17:34.373042Z","iopub.status.idle":"2022-01-17T14:17:34.430830Z","shell.execute_reply.started":"2022-01-17T14:17:34.373011Z","shell.execute_reply":"2022-01-17T14:17:34.430003Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<span id=\"Volume-Moving-Average-Convergence-Divergence\"><h2><center>Volume Moving Average Convergence Divergence</center></h2></span>","metadata":{}},{"cell_type":"code","source":"from NitroFE import TypicalValue\nob = TypicalValue(lookback_period=32)\nres = ob.fit(btc['Volume'][-500:],first_fit=True)\n\n\nfrom NitroFE import MovingAverageConvergenceDivergence\nob=MovingAverageConvergenceDivergence(fast_period=26, slow_period=12, smoothing_period=9)\nres=ob.fit(res,first_fit=True)[-100:]","metadata":{"execution":{"iopub.status.busy":"2022-01-17T14:17:34.432537Z","iopub.execute_input":"2022-01-17T14:17:34.433130Z","iopub.status.idle":"2022-01-17T14:17:34.701505Z","shell.execute_reply.started":"2022-01-17T14:17:34.433085Z","shell.execute_reply":"2022-01-17T14:17:34.700598Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=btc[-100:]\ncandlestick = go.Figure(data = [go.Candlestick(x =data.index, \n                                           open = data[('Open')], \n                                           high = data[('High')], \n                                           low = data[('Low')], \n                                           close = data[('Close')])])\ncandlestick.update_xaxes(title_text = 'Time',\n                         rangeslider_visible = True)\n\ncandlestick.update_layout(title = {'text': 'BTC Candelstick Chart','y':0.90,'x':0.5} , template=\"plotly_white\",autosize=False,width=1200,height=500)\ncandlestick.update_yaxes(title_text = 'Price in USD')\ncandlestick.show()\n\nfeaturefig=go.Figure(data = go.Bar(x=data.index, y=res.values,\n                             marker_color=pd.Series(res.values).rolling(2,min_periods=2).agg(lambda x: 1 if x[-1:].values[0]>=x[-2:].values[0] else 0 ).\\\n                             fillna(1).replace(1,'#1f77b4').replace(0,'#9467bd').values))\nfeaturefig.update_layout(title = {'text': 'Volume Moving Average Convergence Divergence','y':0.90,'x':0.5},autosize=False,width=1200,height=500 ,template=\"plotly_white\")\nfeaturefig.update_yaxes(title_text = 'Feature Value')\nfeaturefig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-01-17T14:17:34.703184Z","iopub.execute_input":"2022-01-17T14:17:34.703495Z","iopub.status.idle":"2022-01-17T14:17:34.807758Z","shell.execute_reply.started":"2022-01-17T14:17:34.703452Z","shell.execute_reply":"2022-01-17T14:17:34.806979Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h2><center>Do check out the feature selection library \"Zoofs\" as well !</center></h2>","metadata":{}},{"cell_type":"markdown","source":"📚 To read more about Zoofs you can visit the documentation page https://jaswinder9051998.github.io/zoofs/.\n\nYou can find examples for feature selection using all six available algorithms.\n\n\n🌟 Like this Project? Give us a star on GitHub","metadata":{}}]}