Crypto MACD Quandrant

Apr 8, 2023

2 min read


programmer-with-chrome

What Idea about Crypto MACD Quadrant ?


The Crypto MACD Quadrant Chart represents an overhead analysis of MACD, including multiple cryptocurrencies in a single chart.


First, import the necessary libraries and dataset:


import pandas as pd
import yfinance as yf
import pandas_ta as ta

Create a ticker list and download data with a 2-day period and 1-day interval from Yahoo Finance:


ticker_list = ['ETH-USD','BNB-USD',
            'MATIC-USD','SOL-USD',
             'STETH-USD',
               'APE18876-USD','APT21794-USD','RPL-USD','MINA-USD','GMX11857-USD']
data=yf.download(ticker_list,period='2y',interval='1d',group_by='column')
data.fillna(method='ffill',inplace=True)
data
[*********************100%***********************]  10 of 10 completed

Adj CloseVolume
APE18876-USDAPT21794-USDBNB-USDETH-USDGMX11857-USDMATIC-USDMINA-USDRPL-USDSOL-USDSTETH-USD
Date
2021-03-05NaNNaN226.3725591533.275024NaN0.215171NaN9.58704212.6104431487.038452
2021-03-06NaNNaN226.6668551654.741577NaN0.212986NaN11.09638813.0364581598.337280
2021-03-07NaNNaN240.1792141723.153809NaN0.212243NaN11.57469413.8777321635.332031
2021-03-08NaNNaN240.3186651834.727905NaN0.216622NaN11.50101713.6021881782.575073
2021-03-09NaNNaN293.4632261868.048828NaN0.298981NaN11.46394814.8463111828.224976
2023-03-015.07936913.468860302.9074711663.43371676.8843921.2482360.98707347.01009822.5064321654.108276
2023-03-024.98806212.849195299.9461671647.31933672.6963121.2247730.97557644.17937121.9848791634.482910
2023-03-034.79689511.733995290.2828371569.16760367.8854291.1677570.88047741.08084121.3993531564.199707
2023-03-044.74028611.285681289.5038761566.92395065.6825941.1264450.82392839.20427320.9668391560.422241
2023-03-054.82766811.350739290.9761661570.85839868.4854131.1404720.83468240.37232621.2513411560.697998

731 rows × 60 columns


Stack and sort the data:


df=data.stack()
df=df.sort_index(level=1) 
df.index.names=['Date','Crypto']
df

Adj CloseCloseHighLowOpenVolume
DateCrypto
2022-03-18APE18876-USD12.96282012.96282017.7540138.5304088.5304088.934642e+09
2022-03-19APE18876-USD11.56420611.56420614.54362111.51511213.0015952.837336e+09
2022-03-20APE18876-USD9.6035059.60350511.9055759.53602211.6131402.048782e+09
2022-03-21APE18876-USD10.49565910.49565910.9819399.5931039.6043872.104739e+09
2022-03-22APE18876-USD12.26429112.26429112.53939810.26408610.5261842.496987e+09
2023-03-01STETH-USD1654.1082761654.1082761654.1082761603.7503661606.5428478.079148e+06
2023-03-02STETH-USD1634.4829101634.4829101656.5449221618.1588131654.0720211.228412e+07
2023-03-03STETH-USD1564.1997071564.1997071637.8090821554.2475591634.4329831.160703e+07
2023-03-04STETH-USD1560.4222411560.4222411576.0328371552.5396731563.8502205.734705e+06
2023-03-05STETH-USD1560.6979981560.6979981574.1517331556.5196531559.8454594.187357e+06

6058 rows × 6 columns


Reset the index and apply the MACD indicator:


df2=df.reset_index().set_index('Crypto')
df2.ta.macd(append=True)
df2

DateAdj CloseCloseHighLowOpenVolumeMACD_12_26_9MACDh_12_26_9MACDs_12_26_9
Crypto
APE18876-USD2022-03-1812.96282012.96282017.7540138.5304088.5304088.934642e+09NaNNaNNaN
APE18876-USD2022-03-1911.56420611.56420614.54362111.51511213.0015952.837336e+09NaNNaNNaN
APE18876-USD2022-03-209.6035059.60350511.9055759.53602211.6131402.048782e+09NaNNaNNaN
APE18876-USD2022-03-2110.49565910.49565910.9819399.5931039.6043872.104739e+09NaNNaNNaN
APE18876-USD2022-03-2212.26429112.26429112.53939810.26408610.5261842.496987e+09NaNNaNNaN
STETH-USD2023-03-011654.1082761654.1082761654.1082761603.7503661606.5428478.079148e+0619.224583-3.99318623.217769
STETH-USD2023-03-021634.4829101634.4829101656.5449221618.1588131654.0720211.228412e+0718.686858-3.62473022.311587
STETH-USD2023-03-031564.1997071564.1997071637.8090821554.2475591634.4329831.160703e+0712.445969-7.89249420.338463
STETH-USD2023-03-041560.4222411560.4222411576.0328371552.5396731563.8502205.734705e+067.113214-10.58020017.693414
STETH-USD2023-03-051560.6979981560.6979981574.1517331556.5196531559.8454594.187357e+062.876064-11.85387914.729944

6058 rows × 10 columns


set date index


df3=df2.reset_index().set_index('Date')
df3

CryptoAdj CloseCloseHighLowOpenVolumeMACD_12_26_9MACDh_12_26_9MACDs_12_26_9
Date
2022-03-18APE18876-USD12.96282012.96282017.7540138.5304088.5304088.934642e+09NaNNaNNaN
2022-03-19APE18876-USD11.56420611.56420614.54362111.51511213.0015952.837336e+09NaNNaNNaN
2022-03-20APE18876-USD9.6035059.60350511.9055759.53602211.6131402.048782e+09NaNNaNNaN
2022-03-21APE18876-USD10.49565910.49565910.9819399.5931039.6043872.104739e+09NaNNaNNaN
2022-03-22APE18876-USD12.26429112.26429112.53939810.26408610.5261842.496987e+09NaNNaNNaN
2023-03-01STETH-USD1654.1082761654.1082761654.1082761603.7503661606.5428478.079148e+0619.224583-3.99318623.217769
2023-03-02STETH-USD1634.4829101634.4829101656.5449221618.1588131654.0720211.228412e+0718.686858-3.62473022.311587
2023-03-03STETH-USD1564.1997071564.1997071637.8090821554.2475591634.4329831.160703e+0712.445969-7.89249420.338463
2023-03-04STETH-USD1560.4222411560.4222411576.0328371552.5396731563.8502205.734705e+067.113214-10.58020017.693414
2023-03-05STETH-USD1560.6979981560.6979981574.1517331556.5196531559.8454594.187357e+062.876064-11.85387914.729944

6058 rows × 10 columns


Rename the columns for better readability:


df3['Crypto'] = df3['Crypto'].replace(['APE18876-USD', 'GMX11857-USD', 'APT21794-USD','STETH-USD'], ['APE-USD', 'GMX-USD', 'APT-USD','LIDO-USD'])

df4=df3.loc['2023-03-02']
df4

CryptoAdj CloseCloseHighLowOpenVolumeMACD_12_26_9MACDh_12_26_9MACDs_12_26_9
Date
2023-03-02APE-USD4.9880624.9880625.1040614.9213885.0792579.000440e+07-0.104042-0.059181-0.044860
2023-03-02APT-USD12.84919512.84919513.64270512.57170313.4666475.861577e+08-0.308790-0.211423-0.097368
2023-03-02BNB-USD299.946167299.946167303.554169296.519165302.9161073.705169e+08-1.571700-1.541174-0.030525
2023-03-02ETH-USD1647.3193361647.3193361672.0511471622.5999761663.5490727.080951e+0915.701750-4.31691220.018662
2023-03-02GMX-USD72.69631272.69631277.67150170.99840576.8803715.926574e+072.728219-1.0629143.791132
2023-03-02MATIC-USD1.2247731.2247731.2513121.1944671.2482773.711185e+080.011767-0.0304690.042236
2023-03-02MINA-USD0.9755760.9755761.0295030.9373740.9868328.006786e+070.035254-0.0188540.054108
2023-03-02RPL-USD44.17937144.17937147.09061442.89750747.0022281.258407e+071.549927-0.9662282.516155
2023-03-02SOL-USD21.98487921.98487922.57521621.73251022.5053143.225454e+080.018106-0.2722080.290314
2023-03-02LIDO-USD1634.4829101634.4829101656.5449221618.1588131654.0720211.228412e+0718.686858-3.62473022.311587


visulization section

import plotly.express as px

fig = px.scatter(df4,x='MACD_12_26_9',y='MACDh_12_26_9',color='Crypto',text='Crypto',hover_data=['Crypto','Close'],title='RSI Quadrant : CRYPTO 10 TOKEN')
fig.update_traces(marker={'size':14})
fig.update_traces(textposition='top center')

fig.add_vline(x=0,line_color="red")
fig.add_hline(y=0,line_color="red")

fig.show()


This code provides a comprehensive overview of the MACD values for various cryptocurrencies in a single chart, allowing for easier analysis and comparison.


Conclusion


In conclusion, the Crypto MACD Quadrant Chart provides a comprehensive and efficient way to analyze the performance of multiple cryptocurrencies in a single visual representation. By incorporating MACD indicators, the chart offers valuable insights into the market momentum and potential trend reversals, enabling investors to make informed decisions when trading or investing in cryptocurrencies.


The benefits of using the Crypto MACD Quadrant Chart include:


Time-saving: Instead of analyzing individual charts for each cryptocurrency, the quadrant chart consolidates the information, allowing for a quick and efficient overview of market trends.


Enhanced decision-making: By utilizing the MACD indicator, the chart provides valuable information on market momentum, enabling investors to identify potential buy or sell signals.


Comparative analysis: The quadrant chart allows for easy comparison of the performance of various cryptocurrencies,


Improved risk management: By gaining a better understanding of market trends and momentum, investors can develop more effective risk management strategies and protect their investments from potential losses.