Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add auto scaling of y-axis for PL chart #356
  • Loading branch information
zlpatel authored Jun 13, 2021
commit 44a0200e02aa44e437b42b5a74e3cf8a0d0b0ea4
8 changes: 8 additions & 0 deletions backtesting/autoscale_cb.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ window._bt_autoscale_timeout = setTimeout(function () {
min = Math.min.apply(null, source.data['ohlc_low'].slice(i, j));
_bt_scale_range(ohlc_range, min, max, true);

if (pl_range) {
max = Math.max.apply(null, source.data['return_pct'].slice(i, j));
min = Math.min.apply(null, source.data['return_pct'].slice(i, j));
if(min && max){
_bt_scale_range(pl_range, min, max, true);
}
}

if (volume_range) {
max = Math.max.apply(null, source.data['Volume'].slice(i, j));
_bt_scale_range(volume_range, 0, max * 1.03, false);
Expand Down