braverock / braverock/quantstrat
[R-Forge #6316] add a switch option between value and percentage for CumPL and Drawdown in chart.Posn
- Dominant language
- R
- Stars
- 310
- Forks
- 121
- PR merge metrics
- No merged PRs in 30d
Description
Submitted by: Kenny Liao
Assigned to: Nobody
[R-Forge link](http://r-forge.r-project.org/tracker/index.php?func=detail&aid=6316&group_id=316&atid=1272)
Currently, `CumPL` and `Drawdown` in `chart.Posn` are measured in cash (or value), but it may seem also helpful for comparison between returns/drawdown and initEquity, if they can be measured in percentage.
I added an argument `Value` to chart.Posn, and make the default value to be TRUE. Also add the following line below line 58.
if (!Value) {CumPL = round(CumPL/initEq*100, 1) }
The modified version of chart.Posn can be found here https://bitbucket.org/HiLow/hackforgood/src/96161d4f62ada2dd5602a1b3aa2ca15b144b9117/chart.Posn_CumPLDrawdown_percentage.R?at=master&fileviewer=file-view-default
Followups:
Date: 2016-04-08 22:54
Sender: Kenny Liao
Thanks Brian, could you point me to an example using additions and withdrawals? I have not yet come cross this kind of examples before.Thanks.
Date: 2016-04-08 01:01
Sender: Brian Peterson
This won't work if there are any additions or withdrawals.There are functions in blotter already for extracting returns so that you can use e.g. PerformanceAnalytics to analyze the returns.
Contributor guide
Research direction
Start with chart.Posn and review the linked chart.Posn_CumPLDrawdown_percentage.R example, focusing on the proposed Value argument and the CumPL calculation. Investigate the reported additions and withdrawals limitation before defining the percentage behavior; done should preserve the current value display by default and provide a correct comparison mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization, fintech-quant
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100