We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need to get the value and time of the series from the point of click, for further calculation purpose in the strategy
No response
The text was updated successfully, but these errors were encountered:
Hey, this has been posted previously somewhere around here and I used it since then.
def subscribe_click(chart, *, callback): js = ( 'function clickHandler(param) {' 'if (!param.point) {' 'return;' '}' f'const time = {chart.id}.chart.timeScale().coordinateToTime(param.point.x);' f'const price = {chart.id}.series.coordinateToPrice(param.point.y);' 'const data = JSON.stringify({time: time, price: price});' 'window.callbackFunction(`on_click_~_${data}`);' '}' f'{chart.id}.chart.subscribeClick(clickHandler);' ) def decorated_callback(data): data = json.loads(data) data = { 'timestamp': pd.to_datetime(data['time'], unit='s'), 'price': data['price'], } return callback(data, chart, chart.candle_data) chart.win.handlers['on_click'] = decorated_callback chart.win.run_script(js)
def on_chart_click(data, chart, candle_data): print(data['timestamp'])
subscribe_click(chart, callback=on_chart_click)
Sorry, something went wrong.
No branches or pull requests
Description
Need to get the value and time of the series from the point of click, for further calculation purpose in the strategy
Code example
No response
Method of implementation
No response
The text was updated successfully, but these errors were encountered: