question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Here 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:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
twopirllccommented, Jul 3, 2022

Hi @9gl,

Thanks for your interest in taking this on. 😎

First, make sure you are using the development branch. README

$ pip install -U git+https://github.com/twopirllc/pandas-ta.git@development

Second, follow Creating a Custom Indicator: The Big 4 to add an indicator and hook it up to the DataFrame Extension.

Notes:

  • chandelier_exit.py should not accept a DataFrame as arguments but rather high, low, and close instead. By default, it should use the high & low Series.
    • For an example of how to construct conditional close case, check out ad.py. (Simply replace open_ with close.)
  • It must not call df.ta.strategy() internally.
  • Since it is returning three columns ‘chandelier_long’, ‘chandelier_short’ and ‘chandelier_dir’, reference macd.py’s Name and Category Section for an example of preparing the returning DataFrame.

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

1reaction
glunkadcommented, Jul 3, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found