Utilizing the Tradingview Charting Library: Implementing an OnClick event on the chart to access the X, Y, or Timestamp of the selected candle or draw Ray/a

Is it possible to create a feature in the SDK TV chart that allows users to draw a Ray and then communicate that information to the hosting page's Javascript? For example, being able to click on a point to retrieve candle count or timestamp data through Javascript. Having two points clickable for data input could enable programmatically drawing the Ray.

Regarding Anchored VWAPs, is there a way to draw specific pivots and send that data to Javascript? Perhaps an OnClick event for a pivot could suffice, with a label appearing on the High or Low of that pivot.

Additionally, is there potential to incorporate feeds from ByBit and Binance for their USDT pairs directly into the charts, or would manual data loading be necessary?

Answer №1

According to the provided documentation:

Creating a new TradingView widget using the specified options:
let tvWidget = new TradingView.widget(widgetOptions);

Subscribing to the 'mouse_up' event and displaying the clientX value in an alert box:
tvWidget.subscribe('mouse_up', (e: any) => {
      alert(e.clientX);
    });

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Trigger an alert using the Ajax response

Is there a way to display the value of imageX outside of the $.ajax() function? var imageX; $.ajax({ type: 'GET', url: 'php/my1.php', dataType: 'json', async: 'false', success: function(response) ...

Can data be transferred using ajax upon clicking a button and then utilizing the data in a form on the same page?

Is there a way to send data through ajax when a button is clicked and then use that value in a form on the same page? I have multiple buttons, each with a unique data attribute. I want the value of the clicked button to be sent via ajax and used within a ...

Display the JQuery element that contains a child element with a specified class

On my webpage, I have a dropdown menu (ul) and I want to keep it open when the user is on the page. Specifically, I only want to display the ul item if it contains an li element with the class ".current-menu-item". The code snippet below accomplishes this ...

Ways to help parents disregard events initiated by their children

I have a situation where clicking on a child element should not trigger the parent element, but using event.stopPropagation() is not an option due to other event listeners waiting for the click event. Specifically, when clicking on the dropdown of parent1 ...

Create a responsive iframe that expands to fullscreen when a button is clicked

Currently, I am using the following code to create an adaptive iframe with a fixed ratio for both width and height: <div id="game-container" style="overflow: hidden; position: relative; padding-top: 60%"> <iframe style="position: absolute; width ...

At long last, I successfully implemented collapsible styling for XML-generated data, yet I am struggling to get the data

After much experimentation, I have successfully applied JQuery Mobile collapsible styling to data retrieved from an XML file using this code/method. However, I am facing an issue with getting all JQuery styling to work properly - particularly the icon do ...

Is there a way to deactivate other dropdown options?

To simplify the selection process, I would like to disable the options for "Province", "City", and "Barangay". When the user clicks on the "Region" field, the corresponding "Province" options should be enabled. Then, when a specific province is selected, t ...

Is there a way to customize the onclick function of IonBackButton?

Is there a way to customize the onclick functionality of an IonBackButton? I managed to attach my own event listener, but struggling to prevent the default listener from triggering. My goal is to provide a warning message to the user in case they have un ...

Tips for extracting HTML content from JSON data as valid HTML code

I am attempting to extract HTML content from a JSON object response.indexText, which has been validated with JSONLint. { "indexText": "<div id=\"content-home\"><h1> Hello World! <\/h1> <p>Some text.<\/p> ...

Can the meta viewport be eliminated using a script?

I currently do not have access to the HTML file on the server side, but I can make changes by adding additional HTML to the website. My issue is with a non-responsive site listed below, which now requires me to zoom in after it loads due to the new viewpor ...

JQuery - Select element by clicking outside

I'm trying to figure out how to hide an element when clicking outside of it. Found a solution at: https://css-tricks.com/dangers-stopping-event-propagation/ $(document).on('click', function(event) { if (!$(event.target).closest('#m ...

Using AngularJS to send a post request with cherrypy

I am facing an issue with posting events into a CherryPy small application that responds to GET/POST requests. When attempting to do so using AngularJS, nothing gets posted. I'm unsure if the problem lies with AngularJS or CherryPy (CP). Cross-domain ...

How come I am receiving the E11000 error from Mongo when I have not designated any field as unique?

Encountering an issue while attempting to save the second document to MongoDB Atlas. The error message reads as follows: Error:MongoError: E11000 duplicate key error collection: test.orders index: orderId_1 dup key: { orderId: null } Despite having no un ...

React Error: Attempting to use objects as a React child is not permitted

An error occurred: Objects are not a valid React child element. labelList contains an array of objects with sample data provided below. I'm attempting to iterate over these objects in order to create a separate row for each object's data. I&apos ...

Simultaneously removing and inserting components with Meteor.js

I have a straightforward set of items that is displayed like this {{#each items}} {{> item}} {{/each}} My code defines that only the three most recent items are shown return Items.find({}, {sort: {timestamp: -1}, limit: 3}) Whenever a new item i ...

Encountering an error when attempting to reach a JSON endpoint using Javascript and X-Auth-Token

I'm attempting to retrieve data from a JSON endpoint using JavaScript and X-Auth-Token, but I am continuously encountering errors. The data is from a sports API, and despite diligently following all the instructions in the documentation and checking m ...

Having Difficulty Converting JavaScript Objects/JSON into PHP Arrays

This particular inquiry has no relation to the previously mentioned identical answer/question... In JavaScript, I am dealing with a substantial list of over 1,000 items displayed in this format... var plugins = [ { name: "Roundabout - Interac ...

Retrieve the succeeding object in the array following the selected object

I am seeking help in developing a function that takes an object with a boolean attribute and changes its value to false, then proceeds to the next item in an array and changes its value to true. If the provided object is the last item in the array, the fun ...

Next.js version 14 is having difficulties displaying the loading.tsx file

click here for image description Why is the loading not displaying when navigating to /profile? How can I fix this issue? export default function Loading() { // You can add any UI inside Loading, including a Skeleton. return ( <div> lo ...

Is there a way to set up an automated login process for a website on a Windows

I once observed an individual using a file (presumably a batch file) to effortlessly log in to multiple websites with just a click. It seemed like it was created using VB. After attempting to search for a similar script on Google, I came up empty-handed. ...