(function(){if(!window.TradingView){var e={version:function(){return"1.0"},gEl:function(a){return document.getElementById(a)},gId:function(){return"tradingview_"+(1048576*(1+Math.random())|0).toString(16).substring(1)},onready:function(a){window.addEventListener?window.addEventListener("DOMContentLoaded",a,!1):window.attachEvent("onload",a)},css:function(a){var b=document.getElementsByTagName("head")[0],d=document.createElement("style");d.type="text/css";d.styleSheet?d.styleSheet.cssText=a:(a=document.createTextNode(a), d.appendChild(a));b.appendChild(d)},bindEvent:function(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent&&a.attachEvent("on"+b,d)},unbindEvent:function(a,b,d){a.removeEventListener?a.removeEventListener(b,d,!1):a.detachEvent&&a.detachEvent("on"+b,d)},widget:function(a){this.id=e.gId();if(!a.datafeed)throw"Datafeed is not defined";this.options={width:a.width||800,height:a.height||500,symbol:a.symbol,interval:a.interval||"1",timezone:a.timezone||"",autosize:a.autosize,container:a.container_id|| "",toolbar_bg:a.toolbar_bg||"f4f7f9",studies:a.studies||[],theme:a.theme||"",widgetbar_width:+a.widgetbar_width||void 0,hideSymbolSearch:a.hideSymbolSearch,hideSideToolbar:a.hide_side_toolbar,datafeed:a.datafeed,path:a.library_path,enabledStudies:a.enabled_studies||[],disabledStudies:a.disabled_studies||[],enabledDrawings:a.enabled_drawings||[],disabledDrawings:a.disabled_drawings||[],savedData:a.savedData||void 0,locale:a.locale,overrides:a.overrides||{},disableLogo:a.disableLogo||!1,snapshotUrl:a.snapshot_url, uid:this.id,fullscreen:a.fullscreen};if(a.news&&a.news.length){this.options.news_vendors=[];for(var b=0;b'},onChartReady:function(a){this._ready?a.call(this):this._ready_handlers.push(a)},setSymbol:function(a,b){this.postMessage.post(this._messageTarget(),"changeSymbol", {symbol:a,interval:b})},createStudy:function(a,b){this.postMessage.post(this._messageTarget(),"createStudy",{name:a,lock:b})},createShape:function(a,b){this.postMessage.post(this._messageTarget(),"createShape",{point:a,options:b})},createVerticalLine:function(a,b){this.createShape(a,$.extend(b,{shape:"vertical_line"}))},createButton:function(){var a=e.gEl(this.id).contentWindow.headerWidget,a=a.createGroup({single:!0}).appendTo(a._$left);return $('
').appendTo(a)},removeIcon:function(a){}, onSymbolChange:function(a){this.postMessage.on("onSymbolChange",a)},onIntervalChange:function(a){this.postMessage.on("onIntervalChange",a)},onTick:function(a){this.postMessage.on("onTick",a)},remove:function(){var a=e.gEl(this.id);a.parentNode.removeChild(a)},onMarkClick:function(a){this.postMessage.on("onMarkClick",a)},onAutoSaveNeeded:function(a){this.postMessage.on("onAutoSaveNeeded",a)},save:function(a){this.postMessage.on("onChartSaved",a);this.postMessage.post(this._messageTarget(),"saveChart", {})},load:function(a){window.__TVSavedChart=a;this.remove();this.create()},setLanguage:function(a){this.remove();this.options.locale=a;this.create()}};e.postMessageWrapper=function(){var a={},b={},d={},e,f=0,g=0;window.addEventListener&&window.addEventListener("message",function(d){var c;try{c=JSON.parse(d.data)}catch(l){return}c.provider&&"TradingView"==c.provider&&("get"==c.type?b[c.name].call(c,c.data,function(a){e.postMessage(JSON.stringify({id:c.id,type:"on",name:c.name,client_id:c.client_id, data:a,provider:"TradingView"}),"*")}):"on"==c.type?a[c.client_id]&&a[c.client_id][c.id]&&(a[c.client_id][c.id].call(c,c.data),delete a[c.client_id][c.id]):"post"==c.type&&"function"===typeof b[c.name]&&b[c.name].call(c,c.data,function(){}))});return function(h,c){a[c]={};e=d[c]=h;return{on:function(a,c){b[a]=c},get:function(b,e,k){b={id:f++,type:"get",name:b,client_id:c,data:e,provider:"TradingView"};a[c][b.id]=k;d[c].postMessage(JSON.stringify(b),"*")},post:function(a,b,c){b={id:g++,type:"post", name:b,data:c,provider:"TradingView"};a&&"function"===typeof a.postMessage&&a.postMessage(JSON.stringify(b),"*")}}}}();window.TradingView&&jQuery?jQuery.extend(window.TradingView,e):window.TradingView=e}})();