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

dynamic/configurable SMA intervals #2503

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

OnkelDok
Copy link
Member

@OnkelDok OnkelDok commented Nov 5, 2021

Currently, fixed intervals are available for SMA and EMA.
Here and here freely configurable intervals were requested.

EDIT: Change of the coloring of the SMA/EMA lines was requested in the forum here and here

I took a look at how this could be changed. The first commit (c817fb7) includes everything that is necessary (from my point of view) to bring the fixed intervals into a dynamically expandable list. This would make everything look the same for the operators. Only in the background the data handling changes.

I am a bit unsure about the way the dynamic intervals are stored. With the commit this is done via a 2D map (Map<Integer, TypedMap>). Dimension 1 = interval size in days (e.g. 200 days). Dimension 2 = settings necessary for each interval (isActive + color).
So there is quite a lot of overhead in the xml file. But the advantage is that the single values can be changed easily (e.g. when showing/hiding an interval or changing the color).
A lighter storage would be possible in a 1D-Map by using the interval size as key and a self constructed string as value, which contains isActive and the color.
Maybe you, @buchen have an idea (if the 2D map is not convenient).

However, the new dynamic list cannot yet be extended with this commit. A corresponding interface is still missing.
My current idea would be to offer a "Manage..." button in the context menu, which then opens a dialog in which you can insert/delete intervals and change their color in the chart:
grafik

I'll see if I can implement the dialog soon.

Greetz
OnkelDok

EDIT: so far only the data/settings of the SMA charts have been adjusted. For EMA, however, this should then go in the same way. I just wanted to go through the whole thing with one type for now.

@OnkelDok
Copy link
Member Author

OnkelDok commented Nov 27, 2021

I have implemented the management of SMA intervals (or is another term for "intervals" more appropriate for this?) as a design:

2021-11-27.20-31-20.mov

Would this be a viable option for management in this form? Suggestions/feedback are welcome.

Open points are still:

  • Test the code thoroughly: Currently, this is more or less the first draft for the administration interface. For sure something has to be adjusted here and there (especially labels and text). I would generally go through it again and look for bugs. Also, the language keys need to be created and translated.
  • Fix code style: Here (portfolio-app/portfolioCheckstyle.xml) there is a checkstyle file in the project. I had included it once in Checkstyle. But I was surprised that a lot of checks are disabled. For example, the check for spaces after an "if" is inactive. Do I have the wrong file?
  • Adapt type storage of SMA intervals: As already mentioned in the first post, this would still need to be adapted if necessary. The current implementation gets by without any type definition for serialization/deserialization because it uses the TypedMap. @buchen: If you tell me what type of storage is desired/suitable and what needs to be done for it, I can still customize that.

@OnkelDok OnkelDok marked this pull request as ready for review February 21, 2022 18:51
@OnkelDok

This comment was marked as outdated.

@OnkelDok
Copy link
Member Author

OnkelDok commented Apr 30, 2022

I noticed that the forum also asked about changing the color scheme: https://forum.portfolio-performance.info/t/farbaenderung-im-performance-diagramm/6115

By the way, I set the PR back to Draft. Because: In connection with another function (Column with relative delta of SMAx to current price in securities overview), it may be necessary to proceed somewhat differently here.

@buchen I know that you have rather less time to examine larger PRs. My question in general would be only whether the following functions could generally come in or you rather say that will not come anyway (then I do not have to make the effort ;) ):

  1. SMA/EMAx line in price chart (so far you can "only" use predefined SMA/GD periods) (this PR here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant