tradingview | repository contains the TradingView Charting Library package
kandi X-RAY | tradingview Summary
kandi X-RAY | tradingview Summary
This repository contains the TradingView Charting Library package. If you use Git in your project, please feel free to use this repo as a submodule in yours. The master branch contains the current stable version. The unstable branch contains the most recent features and fixes, but it can be less stable (actually, it's the beta, which is already thoroughly tested).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of tradingview
tradingview Key Features
tradingview Examples and Code Snippets
Community Discussions
Trending Discussions on tradingview
QUESTION
Tried to scrape data from a webpage. After login to the site, in the developer tools able to search the xpath and find the match. But, paython code is not returning the data.
...ANSWER
Answered 2022-Mar-09 at 11:51You are missing a wait
here.
You should wait for the elements to be completely loaded before accessing them with find_elements
methods.
The best approach here is to use Expected Conditions explicit waits, as following:
QUESTION
[EDIT] I actually figured this out, and you can see my answer below. ]
Before you reference the other question with almost the same title, I have already looked at it and tried out their solution without luck. I'm not sure exactly what I'm doing wrong, but I'm getting a different error than what was in the other question.
What I'm trying to do is create an artificial trading pair based on two underlying trading pairs. This is for pairs trading.
Eg. 'ETHUSD/BTCUSD'
It's possible to see charts like this on TradingView and I'm trying to do the same calculation locally.
So, I have the OHLCV data for ETHUSD and for BTCUSD saved in two DataFrames. I'm trying to merge them and divide each OHLC value from the base pair (eg. 'ETHUSD' by the second pair eg 'BTCUSD'
Here is what I've written so far which gives me a TypeError:
...ANSWER
Answered 2022-Mar-01 at 12:22So, I actually figured this out on my own. I'll share my answer in case anybody else is trying to do the same thing.
Actually, the TypeError was a result of having an empty DataFrame, which was nothing to do with pandas and happened because I was incorrectly calling the exchange API.
For anyone interested, I'm using ccxt, and I changed the beginning from this:
QUESTION
To back-test a trading strategy, I use the replay feature in trading view and mark my trades by adding a "long position" or "short position" from the left panel. Like this:
I need to save the data (chart data including the positions, or any other drawing I have in that layout) as an Excel or a CSV file on my PC.
I know TradinView has export chart data features but does it include all the positions and the drawings or is it just chart data and the indicators?
If that doesn't work, is there any way to get that data? (from tradingview api for example)
...ANSWER
Answered 2022-Feb-20 at 10:59I'm not sure that is what you are looking for but recently I found this GitHub:
That repo is written in JS, but the author provides some examples and the first sentence is:
"Get real-time market prices and indicator values from Tradingview !"
I hope that you found this useful.
QUESTION
I have a serious problem merging Take profit and Stop loss in one script.
I'm using this script for TP https://kodify.net/tradingview/orders/percentage-profit/
and this one for SL https://kodify.net/tradingview/orders/percentage-stop/
I came up with the below script which doesn't look to SL. Hence, the order will remain open until TP % is reached. I need your help to fix it and activate SL same as TP.
...ANSWER
Answered 2021-Aug-06 at 17:41Here you go, with couple of additions
QUESTION
I have a web socket that receives data from a web socket server every 100 to 200ms, ( I have tried both with a shared web worker as well as all in the main.js file),
When new JSON data arrives my main.js runs filter_json_run_all(json_data) which updates Tabulator.js & Dygraph.js Tables & Graphs with some custom color coding based on if values are increasing or decreasing
1) web socket json data ( every 100ms or less) -> 2) run function filter_json_run_all(json_data) (takes 150 to 200ms) -> 3) repeat 1 & 2 forever
Quickly the timestamp of the incoming json data gets delayed versus the actual time (json_time 15:30:12 vs actual time: 15:31:30) since the filter_json_run_all is causing a backlog in operations.
So it causes users on different PC's to have websocket sync issues, based on when they opened or refreshed the website.
This is only caused by the long filter_json_run_all() function, otherwise if all I did was console.log(json_data) they would be perfectly in sync.
Please I would be very very grateful if anyone has any ideas how I can prevent this sort of blocking / backlog of incoming JSON websocket data caused by a slow running javascript function :)
I tried using a shared web worker which works but it doesn't get around the delay in main.js blocked by filter_json_run_all(), I dont thing I can put filter_json_run_all() since all the graph & table objects are defined in main & also I have callbacks for when I click on a table to update a value manually (Bi directional web socket)
If you have any ideas or tips at all I will be very grateful :)
worker.js:
...ANSWER
Answered 2022-Feb-23 at 00:03I'm reticent to take a stab at answering this for real without knowing what's going on in color_table
. My hunch, based on the behavior you're describing is that filter_json_run_all
is being forced to wait on a congested DOM manipulation/render pipeline as HTML is being updated to achieve the color-coding for your updated table elements.
I see you're already taking some measures to prevent some of these DOM manipulations from blocking this function's execution (via setTimeout
). If color_table
isn't already employing a similar strategy, that'd be the first thing I'd focus on refactoring to unclog things here.
It might also be worth throwing these DOM updates for processed events into a simple queue, so that if slow browser behavior creates a rendering backlog, the function actually responsible for invoking pending DOM manipulations can elect to skip outdated render operations to keep the UI acceptably snappy.
Edit: a basic queueing system might involve the following components:
- The queue, itself (this can be a simple array, it just needs to be accessible to both of the components below).
- A queue appender, which runs during
filter_json_run_all
, simply adding objects to the end of the queue representing each DOM manipulation job you plan to complete usingcolor_table
or one of your setTimeout` callbacks. These objects should contain the operation to performed (i.e: the function definition, uninvoked), and the parameters for that operation (i.e: the arguments you're passing into each function). - A queue runner, which runs on its own interval, and invokes pending DOM manipulation tasks from the front of the queue, removing them as it goes. Since this operation has access to all of the objects in the queue, it can also take steps to optimize/combine similar operations to minimize the amount of repainting it's asking the browser to do before subsequent code can be executed. For example, if you've got several
color_table
operations that coloring the same cell multiple times, you can simply perform this operation once with the data from the lastcolor_table
item in the queue involving that cell. Additionally, you can further optimize your interaction with the DOM by invoking the aggregated DOM manipulation operations, themselves, inside a requestAnimationFrame callback, which will ensure that scheduled reflows/repaints happen only when the browser is ready, and is preferable from a performance perspective to DOM manipulation queueing viasetTimeout
/setInterval
.
QUESTION
I am using lightweight-charts
for drawing financial charts for stock data.
A part of code for drawing chart is:
...ANSWER
Answered 2022-Feb-20 at 05:44I have looked into the documentation about
minValue
andmaxValue
but it didn't help as i cannot figure out the exact syntax.
Sounds like this is what you're seeking then? Here's an example from another documentation page. Looks like you just need to add priceRange
like you did with timeScale
, priceScale
, etc.
QUESTION
I am doing a very simple test using the Williams Fractal indicator that I copied directly from the standard one in Tradingview "as is".
I am trying to enter the trade when downFractal is true, exit it when upFractal is true.
The results of the strategy are completely inconsistent with what they should be as for the plotting and, for the love of me, I honestly cannot understand why. Maybe I am not using boolean variables right?
...ANSWER
Answered 2022-Feb-04 at 09:52plotshape(downFractal, "downFractal", style=shape.triangledown, location=location.belowbar, offset=-n, color=#F44336, size = size.small)
plotshape(upFractal, "upFractal", style=shape.triangleup, location=location.abovebar, offset=-n, color=#009688, size = size.small)
QUESTION
I am printing moving averages on a mplfinance plot, as expected there are gaps.
On most charting software, i.e. TradingView etc, they do not have gaps on the moving averages - and presume they are pulling the data from previous -n elements (even with a discontinuous jump they accept this).
I have two questions please:
How can I run a moving average without a gap (understanding it would be skewed within n elements of the discontinuity)... i.e. pull in the day prior and use this for moving average calculation but do not display that day (so that the moving average will already be running on the left hand side of the plot - for below that would be startng at Dec 21st)?
If i wanted to calculate this moving average outside of mplfinance internal function (or change to exponential moving average etc) how would I go about adding this as a separate plot on top of the candlesticks?
And my code is below:
...ANSWER
Answered 2022-Feb-01 at 12:45- As you have implied, those systems that show no gap at the beginning of the moving average do so by using data prior to the data displayed as part of the moving average calculation. You can accomplish the same thing by setting kwarg
xlim=(min,max)
in your call tompf.plot()
by settingmin
equal to one less than your largest moving average, andmax=len(data)
... so for example given your code above, do:
QUESTION
I have a strategy in tradingview that enters every time this condition is true, but I only need to enter the second occurrence of this condition
...ANSWER
Answered 2022-Jan-30 at 21:25You can use a counter for that. Increase it when your condition becomes true
, check if it is 2, enter position and reset your counter for next order.
Here is an example that enters and exits position whenever a MACD cross takes place the second time.
QUESTION
I've been trying to scrape the earnings data under the tab "this week" from trading view earnings using beautiful soup and requests library, but I can't seem to get the data using the basic methods that I know. Unfortunately, the default tab the above link opens to is the "today" tab, and I am not familiar with navigating tabs with the same link.
How can I do this?
Below is something I tried, but it returned an empty list for t:
...ANSWER
Answered 2022-Jan-30 at 10:21The data you see is loaded via JavaScript, so BeautifulSoup doesn't see it. You can simulate this Ajax request with requests
module and then feed those data to pandas DataFrame.
Example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tradingview
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page