This is a simplest way to impliment the backend for TradingVIew charting library in PHP.
PHP and file access
-
Make sure co copy the project into your hosting
-
charts.php
and.htaccess
should be underloadSave
-
In case you have higher
.htaccess
you should exclude the subdirectoryloadSave
using below codeRewriteRule ^sub-dir/ - [L]
-
Point your charting library to the api like this
function initOnReady() { var widget = window.tvWidget = new TradingView.widget({ ... charts_storage_url: window.location.href, charts_storage_api_version: "loadSave", ... }); };
The Tradingview charting library none official documentation is located at https://github.com/trunknx/charting_library_wiki/wiki/Saving-and-Loading-Charts