-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #781 #797
Issue #781 #797
Conversation
Hi @Adewale-1, Out of curiosity, are you using an (auto) linter? A bunch of additional whitespace and newlines have been added. Anyhow, I plan to merge it into developement hopefully no later than the end of the coming week. Kind Regards |
Upon further review, this will take longer. |
Yes I used Autolinter |
Also @Adewale-1, What are the required columns to return? Which columns are optional? Thanks ✅ |
The required columns are time, High, Low, The optional columns are up, down, |
Awesome! Next, of those... what are required to return/append to the DataFrame and which can be excluded? |
The returned Dataframe contains the required columns, and also the optional columns that could be excluded are the up, down,doji, body_hi, body_lo, body, body_avg, small_body, long_body,white_body, black_body, up_shadow, dn_shadow, has_up_shadow,has_dn_shadow, down_trend, volatility, vol_avg,top_imbalance_flag, bottom_imbalance_flag. For the image, I used plotly, and the method shows the imbalance by using the required columns returned from the modified Dataframe : def indicator(df, fig):
df = smc(df)
print(df.head())
for index, row in df.iterrows():
if (
index > 1 and row["high_volatility"]
): # Only consider high volatility situations
if row["top_imbalance_size"] > 0 and row["top_imbalance_percentage"] > 1:
fig.add_shape(
type="rect",
x0=df.loc[index - 1, "time"],
x1=row["time"],
y0=df.loc[index - 2, "Open"],
y1=row["High"],
xref="x",
yref="y",
fillcolor="rgba(255, 0, 0, 0.5)",
opacity=0.5,
line=dict(color="rgba(255, 0, 0, 0.5)", width=7),
)
if (
row["bottom_imbalance_size"] > 0
and row["bottom_imbalance_percentage"] > 1
):
fig.add_shape(
type="rect",
x0=df.loc[index - 1, "time"],
x1=row["time"],
y0=row["Low"],
y1=df.loc[index - 2, "High"],
xref="x",
yref="y",
fillcolor="rgba(0, 255, 0, 0.5)",
opacity=0.5,
line=dict(color="rgba(0, 255, 0, 0.5)", width=7),
)
indicator(dataFrame, figure)
# Update the layout of the chart
figure.update_layout(
title="BTC-USD Candlestick Chart with Moving Averages and Imbalances",
xaxis_title="Time",
yaxis_title="Price",
xaxis_rangeslider_visible=False,
)
# Show the plot
figure.show() |
Thank you, I noticed I forgot to cite my name in the source section of the method, do I need to fork the repo again? |
You have already forked it. However, you can make another PR from the current development branch and add your name to the indicator docstring. That would be the easiest to do on your end. 😎 Also if you submit another indicator, please follow the indicator programming convention on the development branch. For instance, none of the indicators take a DataFrame as indicator input. This library follows the classical style of TA Lib; see ADX for example. Note it is not a hard rule, but it does reduce the turn around time for inclusion. Thanks |
Added
smc.py
in thepandas_ta/momentum
folder for the Smart Money Indicator (SMI).smc
in thepandas_ta/__init__.py
for module-level access.def smc(self, fast=None, slow=None, signal=None, scalar=None, offset=None, **kwargs):
topandas_ta/core.py
for core functionality of the SMI/ SMCFixed