chandelier_exit
See original GitHub issueHere is a code that i have written for chandelier_exit, if possible add to repo
def chandelier_exit(df1, atr_length=14, roll_length=22, mult=2, use_close=False):
df = df1.copy()
df.columns = df.columns.str.lower()
my_atr = ta.Strategy(
name="atr",
ta=[{"kind": "atr", "length": atr_length, "col_names": ("ATR",)}]
)
# Run it
df.ta.strategy(my_atr, append=True)
if use_close:
df['chandelier_long'] = df.rolling(roll_length)["close"].max() + df.iloc[-1]["ATR"] * mult
df['chandelier_short'] = df.rolling(roll_length)["close"].min() - df.iloc[-1]["ATR"] * mult
else:
df['chandelier_long'] = df.rolling(roll_length)["high"].max() - df.iloc[-1]["ATR"] * mult
df['chandelier_short'] = df.rolling(roll_length)["low"].min() + df.iloc[-1]["ATR"] * mult
df.loc[df['close'] > df['chandelier_long'].shift(1), 'chd_dir'] = 1
df.loc[df['close'] < df['chandelier_short'].shift(1), 'chd_dir'] = -1
# chd = df[['chandelier_long', 'chandelier_short', 'chd_dir']]
return df
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Chandelier Exit - ChartSchool - StockCharts.com
Developed by Charles Le Beau and featured in Alexander Elder's books, the Chandelier Exit sets a trailing stop-loss based on the Average True...
Read more >Chandelier Exit + ZLSMA, the best day trading tool ever?
The exit was a bit of a confusing case here, but I recommend you only exiting the trade only once the candle closes...
Read more >Chandelier Exits - Incredible Charts
Chandelier Exits are primarily used as a stop loss mechanism to time exits from a trending market. Exit long positions when price crosses...
Read more >Chandelier Exit — Indicators and Signals - TradingView
It removes stupid transitions between Chandelier Exit' states and highlights initial points for both lines. This indicator was originally developed by Charles ...
Read more >Chandelier Exit Indicator for MT4 - Download FREE
Chandelier Exit is a volatility based indicator created to enable a trader to stay in a trade until there is a definite trend...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @9gl,
Thanks for your interest in taking this on. 😎
First, make sure you are using the development branch. README
Second, follow Creating a Custom Indicator: The Big 4 to add an indicator and hook it up to the DataFrame Extension.
Notes:
df.ta.strategy()
internally.That should cover the majority. The indicator itself is not difficult. I can add tests after the PR, so don’t worry about those unless you want to try.
Hope this helps! Let me know otherwise.
Kind Regards, KJ
Hey @twopirllc @bibinvargheset , I’m interested in contributing to this issue, so before I start working on it, would you mind sparing your time explaining what the issue is about and pointing me to some resources to get started