question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trendline does not draw correctly when out-of-view

See original GitHub issue

Lightweight Charts Version: “lightweight-charts”: “^1.2.1”

Steps/code to reproduce: Not sure if this is considered a bug as this is a workaround for drawing trend-lines by overlaying two charts together.

When either the start or end point pans out of view, the overlay addLineSeries behaves rather ugly

const trade_overlay = tradeReportChartOverlay(pnl_line_color)
trade_overlay.setData([
    {value: entry_price, time: epoch_entry_time},
    {value: exit_price, time: epoch_exit_time}
])

Actual behavior: Please see image below on the resulting behaviour

Expected behavior:

Ideally it should be able to draw the trend line accurately On a side note, is it possible to remove the overlay addLineSeries data in the event the either the start or end “time” is “out-of-view”

Screenshots

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
karunkrishnacommented, Jan 9, 2020

Could you please clarify why do you set line series an overlay? I belive it should be bound to the same price scale as candles.

import {createChart, CrosshairMode, LineStyle} from "lightweight-charts";
const chart = createChart(elements.candlestickChart, {...})

const barSeries = chart.addCandlestickSeries({...})
const tradeDetailLineSeries= chart.addLineSeries({ overlay: true })

the barSeries has the full OHLC data, where as the tradeDetailLineSeries is limited to two points (which is the start- and end-point of the trendline)

Also, it would be very helpful to have jsfiddle-like repro.

Sure, I’ll try to port over an example this afternoon

0reactions
karunkrishnacommented, Jan 12, 2020

Closing.
This was an bug on my side; It looked like the underlying ohlc was drawn with UTC, while the Trendline was draw with EST… so the trendline sort of fell-off when out of viewpoint

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chart trendline formula is inaccurate in Excel - Office
This article documents an issue with the trendline function of an Excel chart when you manually enter X values.
Read more >
How to Draw Trend Lines Correctly - YouTube
Your browser can't play this video. Learn more. Switch camera.
Read more >
How To Draw Trendlines Like A Pro (My Secret ... - YouTube
Discover how to draw trendlines correctly so you can better time your entries and identify high ... Your browser can't play this video....
Read more >
Explaining Trends and How to Draw Trendlines - YouTube
This video should not be construed as investment advice. Investments can fall and rise. Capital at risk. CFDs are complex instruments and ...
Read more >
How to draw trend lines – walkthrough - YouTube
This video is about drawing trend lines on TradingView and all of the features members have. ... Your browser can't play this video....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found