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.

Marker on wrong candle

See original GitHub issue
Screenshot 2022-10-24 at 22 03 28

In the screenshot you can see I have a square marker (position logged in the console) 1665655200 '2022-10-13 10:00:00'

The chart candles are 4 hours. However, after pushing and setting the marker, it’s in the wrong position.

The marker has timestamp 2022-10-13 10:00:00 (converted to unix) so surely it should fall into the prior candlestick (08:00-12:00)? Instead it’s in the candlestick that starts from 12:00!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Vimisocommented, Nov 29, 2022

Screenshot 2022-11-29 at 1 25 46 PM

With a candle, the time is for the close (or end of the candle)

This does not seem to be true, looking at the last candle (ongoing) at tradingview.com, also in my implementation of lightweight-charts, It seems like candles display the opening time and not the closing time. (Current candle always displays a timestamp from the past, rather than the future)

For Example in the screenshot attached (1H Chart). If candles were showing the closing time, the time displayed at last candle on time axis should be 1:30 not 12:30 (See current time in the System toolbar at the top)

@SlicedSilver @Vimiso Am I missing something here?

My formula above fixes the issues because it takes a markerUnixTime which is already some opening time of some interval and rounds it to some interval you are displaying in your chart, plotting it at the correct open position.

Also, if you want to compare with TD, make sure your timezone is the same between your local and TD. In my case I set my TD timezone to UTC for testing, to match my local implementation.

1reaction
SlicedSilvercommented, Nov 29, 2022

Lightweight charts will show the date and time that you assign to time value of the data point, it’s different to how it works on TV because those charts use a specific resolution (say 1H). A lightweight chart doesn’t ‘fix’ your timestamps or require that the data points have regular time gaps.

Here is an example with bar with different time intervals between them. Notice that the time scale isn’t ‘linear’. https://jsfiddle.net/msilverwood/bhLoxp9g/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Candlestick chart add_trace(mode="markers") gives wrong ...
I'm currently building a financial dashboard with dash and plotly. I added the following candlestick chart to my dashboard ...
Read more >
Add a number or a symbol above/below a candle chart with ...
Hi, is there a way to add on top of a day candle a number ('1', '2', ... It seems to me (please...
Read more >
Wrong buy & sell markers on chart - NinjaTrader Support Forum
Problem: using a 4range chart shows (sometimes) the buy/sell arrow at the wrong candle and sometimes at a place where no bar is...
Read more >
6 Mistakes New Candle Makers Should Avoid
1. Putting the wrong amount of fragrance oil · 2. Using the same wick size for every scent · 3. Burning the candle...
Read more >
Candlestick charts - Google Docs Editors Help
Use a candlestick chart to show the low, high, opening, and closing values of a security for a specific period. For example, get...
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