joshuaulrich / joshuaulrich/quantmod

addVo() and pretty scale

Open
#276 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
906
Forks
233
PR merge metrics
No merged PRs in 30d

Description

### Description

Chartseries adds (by default) a second volume chart, equivalent to "addVo ()"

The volume chart scale is represented in a friendly way (x thousand, x one hundred thousand, etc.)

When we add the Volume average to this graph, it is plotted without friendly scaling (x unit) and is outside the plot area.

### Expected behavior

he expected behavior is to represent "SMA (Vo (VALE3.SA), n = 20)" on the same scale as the variable that created the second graph, in this case "Vo ()".

### Minimal, reproducible example

```r
# incorrect behavior of function Vo() in second graph
fim <- Sys.Date()
inicio <- Sys.Date() - 730

getSymbols("VALE3.SA", from= inicio, to = fim)
chartSeries(VALE3.SA, theme = "white", TA='addEMA(n=21); addVo(); addTA(SMA(Vo(VALE3.SA), n=20), on=2)', subset = 'last 6 months')

# correct behavior, add function in second graph, but not Vo() function
chartSeries(VALE3.SA, theme = "white", TA= 'addEMA(n=21,col="red"); addOBV(); addTA(EMA(OBV(Cl(VALE3.SA), Vo(VALE3.SA)), n=10), on =2)', subset = 'last 6 months')

```

### Session Info

```r
[Insert your sessionInfo() output]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the chartSeries, addVo(), Vo(), and addTA() entry points used in the reproducible example. Compare the scaling applied to addVo() with the SMA(Vo(...)) overlay and verify the result on the provided VALE3.SA chart. Done means the volume average is displayed on the same friendly scale as the volume panel and remains within the plot area.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.