zmnkh icon

chart_library demo

zmnkh | PRO | 11/02/17 11:37:55 PM UTC | 0 ⭐ | 597 👁️ | Never ⏰ | []
text |

3.18 KB

|

None

|

0 👍

/

0 👎

<!DOCTYPE HTML>
<html>
	<head>
 		<title>TradingView Charting Library demo</title>
 		<!-- Fix for iOS Safari zooming bug -->
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge">
 		<script type="text/javascript" src="//code.jquery.com/jquery-1.11.2.min.js"></script>
		<script type="text/javascript" src="charting_library.js"></script>
		<script type="text/javascript" src="datafeed/udf/datafeed.js"></script>
 		<script type="text/javascript">
             function getParameterByName(name) {
                name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
                var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
                        results = regex.exec(location.search);
                return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
            }
 			TradingView.onready(function()
			{
				var widget =  window.widget = new TradingView.widget({
					fullscreen: true,
					symbol: 'AA',
					interval: 'D',
					container_id: "tv_chart_container",
					//	BEWARE: no trailing slash is expected in feed URL
					datafeed: new Datafeeds.UDFCompatibleDatafeed("http://demo_feed.tradingview.com"),
					locale: getParameterByName('lang') || "en",
					//	Regression Trend-related functionality is not implemented yet, so it's hidden for a while
					drawings_access: { type: 'black', tools: [ { name: "Regression Trend" } ] },
					disabled_features: ["use_localstorage_for_settings"],
					enabled_features: ["study_templates"],
					charts_storage_url: 'http://saveload.tradingview.com',
                    charts_storage_api_version: "1.1",
					client_id: 'tradingview.com',
					user_id: 'public_user_id' 
                 });
                 // ********** REPRODUCTION CODE STARTS HERE **********
                var savedState = null;
                setTimeout(function() {
                    console.log("Saving state...");
                    widget.save(function(data) {
                        savedState = data
                        console.log("Got state:", savedState);
                         setTimeout(function() {
                            console.log("Setting symbol to NLY...")
                            widget.setSymbol('NLY', 5);
                             setTimeout(function() {
                                console.log("Loading saved state...")
                                widget.load(savedState);
                                 setTimeout(function() {
                                    console.log("Setting symbol to NLY...")
                                    widget.setSymbol('NLY', 5);
                                    console.log("Automated actions complete. Note that the chart remained on AA.")
                                }, 5000);
                            }, 5000);
                        }, 5000);
                    });
                }, 5000);
                // ********** REPRODUCTION CODE ENDS HERE **********
			});
 		</script>
 	</head>
 	<body style="margin:0px;">
		<div id="tv_chart_container"></div>
	</body>
 </html>

Comments