Strategy performance chart color indicator error #858
Labels
bug
Something isn't working
priority: P1
An important issue that must be fixed before the next release, but does nto require immediate focus.
size: S
A small task that can be completed in less than a day
Issue
The strategy performance chart color indicator (green = profit, red = loss) displays the wrong color in specific edge cases (see investigation below).
Background
This was reported by @tsorro in discord. The issue is currently occurring on the Memecoin index strategy for the following timeframes:
3M
,Max
.Steps to reproduce
3M
▲ 1.3%
and the chart color (red)Investigation
The logic to determine the chart color used the rolled-up timeframe data for the roll-up grain (
1h
,4h
,1d
) that is used for a given selected timeframe (1W
,1M
,3M
,Max
). For a given summary "tick", the first closing value is subtracted from the last closing value; if positive, the color is set to green; if negative, red.The bug occurs for the following edge case:
The same issue occurs in reverse when:
Potential solutions
This could be fixed by subtracting the opening value from the first tick from the last closing value. However, the chart could then be green but with a downward slope (since the ticks are plotted based on closing value).
An alternative would be to include an extra tick at the beginning of the roll-up that represents a close value that matches the first roll-up tick's open value. For example, if the chart data starts mid-day on 2024-11-02, the first tick in a daily roll-up is (currently) that same date, with the final data point from that date serving as the close value. The modified roll-up would include an additional daily tick for 2024-11-01 with a close value equal to the earliest value from 2024-11-02. This seems like a reasonable way to summarize the data when rolling up to a day grain (with analogs for hourly or other gains), and has the benefit of having the chart slope match the color.
The text was updated successfully, but these errors were encountered: