Skip to content
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

Allow setting legend names when multiple series values are used in an Indicator #382

Open
zlpatel opened this issue Jun 15, 2021 · 2 comments · May be fixed by #385 or #980
Open

Allow setting legend names when multiple series values are used in an Indicator #382

zlpatel opened this issue Jun 15, 2021 · 2 comments · May be fixed by #385 or #980
Labels
enhancement New feature or request Hacktoberfest https://hacktoberfest.digitalocean.com

Comments

@zlpatel
Copy link
Contributor

zlpatel commented Jun 15, 2021

Expected Behavior

There should be a way to specify meaningful legend names when multiple series values are used in a single Indicator

Actual Behavior

Currently, you can only specify single name for Indicator. But there are cases where you need to plot multiple data series in a single Indicator and it's important to label them for easy identification.

Currently, There's an option to specify list of colors (one for each data series). I think if we allow passing list of legend names (as a separate parameter) that would be great.

Additional info

image

@zlpatel zlpatel changed the title Need a way to specify meaningful legend names when multiple series values are used in a single Indicator Allow setting legend names when multiple series values are used in a single Indicator Jun 15, 2021
@zlpatel zlpatel changed the title Allow setting legend names when multiple series values are used in a single Indicator Allow setting legend names when multiple series values are used in an Indicator Jun 15, 2021
zlpatel added a commit to zlpatel/backtesting.py that referenced this issue Jun 15, 2021
@zlpatel
Copy link
Contributor Author

zlpatel commented Jun 15, 2021

After my code fix it looks like this:
image

zlpatel added a commit to zlpatel/backtesting.py that referenced this issue Jun 16, 2021
zlpatel added a commit to zlpatel/backtesting.py that referenced this issue Jun 16, 2021
zlpatel added a commit to zlpatel/backtesting.py that referenced this issue Jun 16, 2021
zlpatel added a commit to zlpatel/backtesting.py that referenced this issue Jun 16, 2021
zlpatel added a commit to zlpatel/backtesting.py that referenced this issue Jun 16, 2021
zlpatel added a commit to zlpatel/backtesting.py that referenced this issue Jun 16, 2021
@zlpatel
Copy link
Contributor Author

zlpatel commented Jun 16, 2021

@kernc could you mark this as an enhancement?

@kernc kernc added the enhancement New feature or request label Jun 21, 2021
@kernc kernc added the Hacktoberfest https://hacktoberfest.digitalocean.com label Oct 7, 2021
ivaigult added a commit to ivaigult/backtesting.py that referenced this issue May 8, 2023
Previously we only allowed one name per vector
indicators:

    def _my_indicator(open, close):
    	return tuple(
	    _my_indicator_one(open, close),
	    _my_indicator_two(open, close),
	)

    self.I(
        _my_indicator,
	# One name is used to describe two values
        name="My Indicator",
	self.data.Open,
	self.data.Close
    )

Now, the user can supply two (or more) names to annotate
each value individually. The names will be shown in the
plot legend. The following is now valid:

    self.I(
        _my_indicator,
	# One name is used to describe two values
        name=["My Indicator One", "My Indicator Two"],
	self.data.Open,
	self.data.Close
    )
ivaigult added a commit to ivaigult/backtesting.py that referenced this issue May 8, 2023
Previously we only allowed one name per vector
indicator:

    def _my_indicator(open, close):
    	return tuple(
	    _my_indicator_one(open, close),
	    _my_indicator_two(open, close),
	)

    self.I(
        _my_indicator,
	# One name is used to describe two values
        name="My Indicator",
	self.data.Open,
	self.data.Close
    )

Now, the user can supply two (or more) names to annotate
each value individually. The names will be shown in the
plot legend. The following is now valid:

    self.I(
        _my_indicator,
	# One name is used to describe two values
        name=["My Indicator One", "My Indicator Two"],
	self.data.Open,
	self.data.Close
    )
@kernc kernc linked a pull request May 9, 2023 that will close this issue
ivaigult added a commit to ivaigult/backtesting.py that referenced this issue May 9, 2023
Previously we only allowed one name per vector
indicator:

    def _my_indicator(open, close):
    	return tuple(
	    _my_indicator_one(open, close),
	    _my_indicator_two(open, close),
	)

    self.I(
        _my_indicator,
	# One name is used to describe two values
        name="My Indicator",
	self.data.Open,
	self.data.Close
    )

Now, the user can supply two (or more) names to annotate
each value individually. The names will be shown in the
plot legend. The following is now valid:

    self.I(
        _my_indicator,
	# Two names can now be passed
        name=["My Indicator One", "My Indicator Two"],
	self.data.Open,
	self.data.Close
    )

Co-authored-by: kernc <kerncece@gmail.com>
ivaigult added a commit to ivaigult/backtesting.py that referenced this issue May 13, 2023
Previously we only allowed one name per vector
indicator:

    def _my_indicator(open, close):
    	return tuple(
	    _my_indicator_one(open, close),
	    _my_indicator_two(open, close),
	)

    self.I(
        _my_indicator,
	# One name is used to describe two values
        name="My Indicator",
	self.data.Open,
	self.data.Close
    )

Now, the user can supply two (or more) names to annotate
each value individually. The names will be shown in the
plot legend. The following is now valid:

    self.I(
        _my_indicator,
	# Two names can now be passed
        name=["My Indicator One", "My Indicator Two"],
	self.data.Open,
	self.data.Close
    )

Co-authored-by: kernc <kerncece@gmail.com>
ivaigult added a commit to ivaigult/backtesting.py that referenced this issue May 14, 2023
Previously we only allowed one name per vector
indicator:

    def _my_indicator(open, close):
    	return tuple(
	    _my_indicator_one(open, close),
	    _my_indicator_two(open, close),
	)

    self.I(
        _my_indicator,
	# One name is used to describe two values
        name="My Indicator",
	self.data.Open,
	self.data.Close
    )

Now, the user can supply two (or more) names to annotate
each value individually. The names will be shown in the
plot legend. The following is now valid:

    self.I(
        _my_indicator,
	# Two names can now be passed
        name=["My Indicator One", "My Indicator Two"],
	self.data.Open,
	self.data.Close
    )

Co-authored-by: kernc <kerncece@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest https://hacktoberfest.digitalocean.com
Projects
None yet
2 participants