|
|
|
@@ -3,7 +3,7 @@ urlParams.numeric_formatting&&"string"==typeof urlParams.numeric_formatting.deci
|
|
|
|
c=$("<tr>").appendTo(h),$('<td class="custom-logo">').append(s).appendTo(c),d=$("<tr>").appendTo(h),t.enabled("link_to_tradingview")&&$('<td class="tv-link">').append(r).appendTo(d),o&&a.addClass("on-pane")}:function(e,i,o){if(t.enabled("link_to_tradingview")){i=i||chartWidget._jqMainDiv,$(i).find(".onchart-tv-logo").remove();var n=$('<div class="onchart-tv-logo wrapper"><div class="wrapper"><a class="inner" href="https://www.tradingview.com/" target="_blank"><img class="solid" src="images/charting_library/logo-widget-copyright.png" alt="TradingView Logo"><img class="faded" src="images/charting_library/logo-widget-copyright-faded.png" alt="TradingView Logo"><span class="text"><span id="logo-symbol"></span> charts by <span class="logo-highlighted">TradingView</span></span></a></div></div>').appendTo(i);t.enabled("minimalistic_logo")?n.on("mouseenter",function(){$(this).addClass("expanded")}).on("mouseleave",function(){$(this).removeClass("expanded")}):n.addClass("expanded"),o&&n.addClass("on-pane")}},P=t.enabled("widget_logo"),P&&(chartWidget.createLogo=v,t.enabled("show_logo_on_all_charts")&&(a.createLogo=v.bind(this)),t.enabled("move_logo_to_main_pane")||chartWidget.withModel(null,v)),urlParams.toolbarbg&&/^[0-9a-f]+$/i.test(urlParams.toolbarbg)&&$("<style>").text("body,.tv-side-toolbar,.chart-controls-bar,#footer-chart-panel{background-color:#"+urlParams.toolbarbg+" !important}").appendTo($("head")),TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),TradingView.isNaN(urlParams.ssreqdelay)||I.setSearchRequestDelay(Math.max(0,+urlParams.ssreqdelay)),t.enabled("left_toolbar")&&(window.sideToolbar=new T({resizerBridge:b.allocate({areaName:"left"}),chartWidgetCollection:a,drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,forceVisible:!0})),window.quoteSessionMultiplexerInstance={},window.quoteSessionMultiplexerInstance.simple=new m("simple"),window.quoteSessionMultiplexerInstance.full=new m,window.lineToolPropertiesToolbar=new C(a),chartWidget.onDisconnected().subscribe(null,function(t){t&&f.showCriticalErrorMessage()}),$(".tv-content").bind("contextmenu",function(t){var e=$(t.originalEvent.target);if(!e.is("input")&&!e.is("textarea"))return!1}),M.resolve(),chartWidget.withModel(null,function(){chartWidget.model().mainSeries().onSymbolResolved().subscribe(null,function(t){var e,i,o=chartWidget.model().mainSeries().symbolInfo()||t;o&&(e=chartWidget.model().mainSeries().properties().interval.value(),i={name:o.name,exchange:o.exchange,description:o.description,type:o.type,interval:e},d.emit("onSymbolChange",i))}),c.interval.subscribe(function(t){d.emit("onIntervalChange",t)}),ChartApiInstance.on("realtime_tick",function(t){d.emit("onTick",t)}),ChartApiInstance.on("onAutoSaveNeeded",function(){d.emit("onAutoSaveNeeded")}),t.enabled("charting_library_debug_mode")&&d.subscribeToAll(function(){var t=Array.prototype.slice.call(arguments)
|
|
|
|
c=$("<tr>").appendTo(h),$('<td class="custom-logo">').append(s).appendTo(c),d=$("<tr>").appendTo(h),t.enabled("link_to_tradingview")&&$('<td class="tv-link">').append(r).appendTo(d),o&&a.addClass("on-pane")}:function(e,i,o){if(t.enabled("link_to_tradingview")){i=i||chartWidget._jqMainDiv,$(i).find(".onchart-tv-logo").remove();var n=$('<div class="onchart-tv-logo wrapper"><div class="wrapper"><a class="inner" href="https://www.tradingview.com/" target="_blank"><img class="solid" src="images/charting_library/logo-widget-copyright.png" alt="TradingView Logo"><img class="faded" src="images/charting_library/logo-widget-copyright-faded.png" alt="TradingView Logo"><span class="text"><span id="logo-symbol"></span> charts by <span class="logo-highlighted">TradingView</span></span></a></div></div>').appendTo(i);t.enabled("minimalistic_logo")?n.on("mouseenter",function(){$(this).addClass("expanded")}).on("mouseleave",function(){$(this).removeClass("expanded")}):n.addClass("expanded"),o&&n.addClass("on-pane")}},P=t.enabled("widget_logo"),P&&(chartWidget.createLogo=v,t.enabled("show_logo_on_all_charts")&&(a.createLogo=v.bind(this)),t.enabled("move_logo_to_main_pane")||chartWidget.withModel(null,v)),urlParams.toolbarbg&&/^[0-9a-f]+$/i.test(urlParams.toolbarbg)&&$("<style>").text("body,.tv-side-toolbar,.chart-controls-bar,#footer-chart-panel{background-color:#"+urlParams.toolbarbg+" !important}").appendTo($("head")),TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),TradingView.isNaN(urlParams.ssreqdelay)||I.setSearchRequestDelay(Math.max(0,+urlParams.ssreqdelay)),t.enabled("left_toolbar")&&(window.sideToolbar=new T({resizerBridge:b.allocate({areaName:"left"}),chartWidgetCollection:a,drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,forceVisible:!0})),window.quoteSessionMultiplexerInstance={},window.quoteSessionMultiplexerInstance.simple=new m("simple"),window.quoteSessionMultiplexerInstance.full=new m,window.lineToolPropertiesToolbar=new C(a),chartWidget.onDisconnected().subscribe(null,function(t){t&&f.showCriticalErrorMessage()}),$(".tv-content").bind("contextmenu",function(t){var e=$(t.originalEvent.target);if(!e.is("input")&&!e.is("textarea"))return!1}),M.resolve(),chartWidget.withModel(null,function(){chartWidget.model().mainSeries().onSymbolResolved().subscribe(null,function(t){var e,i,o=chartWidget.model().mainSeries().symbolInfo()||t;o&&(e=chartWidget.model().mainSeries().properties().interval.value(),i={name:o.name,exchange:o.exchange,description:o.description,type:o.type,interval:e},d.emit("onSymbolChange",i))}),c.interval.subscribe(function(t){d.emit("onIntervalChange",t)}),ChartApiInstance.on("realtime_tick",function(t){d.emit("onTick",t)}),ChartApiInstance.on("onAutoSaveNeeded",function(){d.emit("onAutoSaveNeeded")}),t.enabled("charting_library_debug_mode")&&d.subscribeToAll(function(){var t=Array.prototype.slice.call(arguments)
|
|
|
|
;console.log('Event "{0}", arguments: {1}'.format(t[0],JSON.stringify(t.slice(1))))})}),d.subscribe("chart_load_requested",function(t){window.tradingViewApi.loadChart({json:JSON.parse(t.content),extendedData:t})})},window.destroyChart=function(){window.chartWidgetCollection&&(window.chartWidgetCollection.destroy(),window.chartWidgetCollection=null),window.quoteSessionMultiplexerInstance&&(window.quoteSessionMultiplexerInstance.simple&&window.quoteSessionMultiplexerInstance.simple.destroy(),window.quoteSessionMultiplexerInstance.full&&window.quoteSessionMultiplexerInstance.full.destroy(),window.quoteSessionMultiplexerInstance=null),ChartApiInstance&&(ChartApiInstance.destroy(),ChartApiInstance=null)},e(),o(),V=$.Deferred(),window.parent[urlParams.uid].loadLastChart&&t.enabled("saveload_storage_customization")?r.getCharts(function(t){if(0===t.length)return void n();var e=t.sort(function(t,e){return e.modified_iso-t.modified_iso})[0];r.getChartContent(e,function(t){var e=JSON.parse(t.content);e.extendedData=t,urlParams.chartContent=JSON.stringify({json:e}),n()},n)},n):n(),O=$.Deferred(),$.when(s,O,V).done(function(){if($(window).resize(),$(".loading-indicator").hide(),setTimeout(D,0),t.enabled("14851")){!function(t,e,i,o,n,s,r){t.GoogleAnalyticsObject=n,t[n]=t[n]||function(){(t[n].q=t[n].q||[]).push(arguments)},t[n].l=1*new Date,s=e.createElement(i),r=e.getElementsByTagName(i)[0],s.async=1,s.src=o,r.parentNode.insertBefore(s,r)}(window,document,"script","//www.google-analytics.com/analytics.js","ga");var e=document.URL.match(RegExp("(:?.*://)([^/]+)/.*"))[2];ga("create","UA-53174009-1","auto"),ga("set",{hostname:e,page:e,referrer:e}),ga("send","pageview")}}),function(){var t=!0;window.parent[urlParams.uid].datafeed.onReady(function(e){t&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),window.configurationData=e,O.resolve()}),t=!1}(),window.getFunctionFromArguments=function(t){return window.parent[urlParams.uid][t]},window.createShortcutAction=function(){var t={};return function(e,i){void 0===t[e]&&(t[e]=new a({shortcut:e})),t[e].callbacks().subscribe(null,i)}}(),window.addCustomCSSFile=function(t){var e=document.createElement("link");document.getElementsByTagName("head")[0].appendChild(e),e.setAttribute("type","text/css"),e.setAttribute("rel","stylesheet"),e.setAttribute("href",t)},urlParams.customCSS&&window.addCustomCSSFile(urlParams.customCSS),window._initializationFinished=function(){P.clearStack()},window.resizeWindow=function(){$(window).resize()},window.createButton=function(){var t=null;return function(e){var i,o,n,s;return e=e||{},i=e.align||"left",o=window.headerWidget,n=o.createGroup("",{single:!0}),s=$('<div class="button"></div>').appendTo(n),t&&clearTimeout(t),t=setTimeout(function(){window.resizeWindow(),clearTimeout(t)},5),setTimeout(function(){o.addButton(n,"left"===i)}),s}}()}).call(e,i(1))},function(t,e,i){var o=i(2),n={},s={},r={},a={init:function(){var t,e,i,l;Object.keys(o).forEach(function(i){t=o[i],e=t.subsets,
|
|
|
|
;console.log('Event "{0}", arguments: {1}'.format(t[0],JSON.stringify(t.slice(1))))})}),d.subscribe("chart_load_requested",function(t){window.tradingViewApi.loadChart({json:JSON.parse(t.content),extendedData:t})})},window.destroyChart=function(){window.chartWidgetCollection&&(window.chartWidgetCollection.destroy(),window.chartWidgetCollection=null),window.quoteSessionMultiplexerInstance&&(window.quoteSessionMultiplexerInstance.simple&&window.quoteSessionMultiplexerInstance.simple.destroy(),window.quoteSessionMultiplexerInstance.full&&window.quoteSessionMultiplexerInstance.full.destroy(),window.quoteSessionMultiplexerInstance=null),ChartApiInstance&&(ChartApiInstance.destroy(),ChartApiInstance=null)},e(),o(),V=$.Deferred(),window.parent[urlParams.uid].loadLastChart&&t.enabled("saveload_storage_customization")?r.getCharts(function(t){if(0===t.length)return void n();var e=t.sort(function(t,e){return e.modified_iso-t.modified_iso})[0];r.getChartContent(e,function(t){var e=JSON.parse(t.content);e.extendedData=t,urlParams.chartContent=JSON.stringify({json:e}),n()},n)},n):n(),O=$.Deferred(),$.when(s,O,V).done(function(){if($(window).resize(),$(".loading-indicator").hide(),setTimeout(D,0),t.enabled("14851")){!function(t,e,i,o,n,s,r){t.GoogleAnalyticsObject=n,t[n]=t[n]||function(){(t[n].q=t[n].q||[]).push(arguments)},t[n].l=1*new Date,s=e.createElement(i),r=e.getElementsByTagName(i)[0],s.async=1,s.src=o,r.parentNode.insertBefore(s,r)}(window,document,"script","//www.google-analytics.com/analytics.js","ga");var e=document.URL.match(RegExp("(:?.*://)([^/]+)/.*"))[2];ga("create","UA-53174009-1","auto"),ga("set",{hostname:e,page:e,referrer:e}),ga("send","pageview")}}),function(){var t=!0;window.parent[urlParams.uid].datafeed.onReady(function(e){t&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),window.configurationData=e,O.resolve()}),t=!1}(),window.getFunctionFromArguments=function(t){return window.parent[urlParams.uid][t]},window.createShortcutAction=function(){var t={};return function(e,i){void 0===t[e]&&(t[e]=new a({shortcut:e})),t[e].callbacks().subscribe(null,i)}}(),window.addCustomCSSFile=function(t){var e=document.createElement("link");document.getElementsByTagName("head")[0].appendChild(e),e.setAttribute("type","text/css"),e.setAttribute("rel","stylesheet"),e.setAttribute("href",t)},urlParams.customCSS&&window.addCustomCSSFile(urlParams.customCSS),window._initializationFinished=function(){P.clearStack()},window.resizeWindow=function(){$(window).resize()},window.createButton=function(){var t=null;return function(e){var i,o,n,s;return e=e||{},i=e.align||"left",o=window.headerWidget,n=o.createGroup("",{single:!0}),s=$('<div class="button"></div>').appendTo(n),t&&clearTimeout(t),t=setTimeout(function(){window.resizeWindow(),clearTimeout(t)},5),setTimeout(function(){o.addButton(n,"left"===i)}),s}}()}).call(e,i(1))},function(t,e,i){var o=i(2),n={},s={},r={},a={init:function(){var t,e,i,l;Object.keys(o).forEach(function(i){t=o[i],e=t.subsets,
|
|
|
|
Array.isArray(e)?e.forEach(function(t){n[t]=1}):e&&Object.keys(e).forEach(function(t){n[t]=1}),n[i]=1}),i=Object.keys(n),i.forEach(function(t){i.forEach(function(i){if(void 0!==(l=o[i])){if(!(e=l.subsets))return;s.hasOwnProperty(t)||(s[t]=[]),Array.isArray(e)&&~e.indexOf(t)?s[t].push(i):t in e&&s[t].push(i)}})}),"undefined"!=typeof __initialDisabledFeaturesets&&__initialDisabledFeaturesets&&__initialDisabledFeaturesets.forEach(function(t){a.disable(t)}),"undefined"!=typeof __initialEnabledFeaturesets&&__initialEnabledFeaturesets&&__initialEnabledFeaturesets.forEach(function(t){a.enable(t)}),"undefined"!=typeof window&&(window.Featuresets=a),this.meta={_uniqueSetsNames:n,_setsReverseDependencies:s,_setsStates:r}},enabled:function(t){var e=function(t){var i,o,n=s.hasOwnProperty(t)?s[t]:[];if(!1===r[t])return!1;for(i=r[t],o=0;o<n.length;++o)i|=e(n[o]);return i};return!!e(t)},enable:function(t){r[t]=!0},disable:function(t){r[t]=!1},setEnabled:function(t,e){r[t]=!!e},_uniqueSets:function(){return Object.keys(n)}};a.init(),t.exports=a},function(t,e){t.exports={14851:{},custom_items_in_context_menu:{},websocket_connection:{},countdown:{},symbol_search_parser_mixin:{},show_pro_features:{},daily_timeframe_suffix:{},symbollist_context_menu:{},pay_attention_to_ticker_not_symbol:{},graying_disabled_tools_enabled:{},update_study_formatter_on_symbol_resolve:{},constraint_dialogs_movement:{},same_data_requery:{},phone_verification:{},show_interval_dialog_on_key_press:{},header_interval_dialog_button:{subsets:["show_interval_dialog_on_key_press"]},header_fullscreen_button:{},header_symbol_search:{},symbol_search_hot_key:{},header_resolutions:{subsets:["header_interval_dialog_button"]},header_chart_type:{},header_settings:{},header_indicators:{},header_compare:{},header_undo_redo:{},header_screenshot:{},header_saveload:{},header_saveload_to_the_right:{},study_on_study:{},header_widget:{subsets:["header_widget_dom_node","header_symbol_search","header_resolutions","header_chart_type","header_settings","header_indicators","header_compare","header_undo_redo","header_fullscreen_button","compare_symbol"]},compare_symbol:{subsets:["header_compare"]},chart_property_page:{subsets:["chart_property_page_style","chart_property_page_scales","chart_property_page_background","chart_property_page_timezone_sessions","chart_property_page_evetns_alerts","chart_property_page_trading","chart_property_page_template_button"]},disable_userlink_popup:{},left_toolbar:{},control_bar:{},widget_logo:{},timeframes_toolbar:{},edit_buttons_in_legend:{subsets:["show_hide_button_in_legend","format_button_in_legend","study_buttons_in_legend","delete_button_in_legend"]},show_hide_button_in_legend:{},format_button_in_legend:{},study_buttons_in_legend:{},delete_button_in_legend:{},pane_context_menu:{},scales_context_menu:{},legend_context_menu:{},context_menus:{subsets:["pane_context_menu","scales_context_menu","legend_context_menu","objects_tree_context_menu"]},items_favoriting:{},save_chart_properties_to_local_storage:{},use_localstorage_for_settings:{
|
|
|
|
Array.isArray(e)?e.forEach(function(t){n[t]=1}):e&&Object.keys(e).forEach(function(t){n[t]=1}),n[i]=1}),i=Object.keys(n),i.forEach(function(t){i.forEach(function(i){if(void 0!==(l=o[i])){if(!(e=l.subsets))return;s.hasOwnProperty(t)||(s[t]=[]),Array.isArray(e)&&~e.indexOf(t)?s[t].push(i):t in e&&s[t].push(i)}})}),"undefined"!=typeof __initialDisabledFeaturesets&&__initialDisabledFeaturesets&&__initialDisabledFeaturesets.forEach(function(t){a.disable(t)}),"undefined"!=typeof __initialEnabledFeaturesets&&__initialEnabledFeaturesets&&__initialEnabledFeaturesets.forEach(function(t){a.enable(t)}),"undefined"!=typeof window&&(window.Featuresets=a),this.meta={_uniqueSetsNames:n,_setsReverseDependencies:s,_setsStates:r}},enabled:function(t){var e=function(t){var i,o,n=s.hasOwnProperty(t)?s[t]:[];if(!1===r[t])return!1;for(i=r[t],o=0;o<n.length;++o)i|=e(n[o]);return i};return!!e(t)},enable:function(t){r[t]=!0},disable:function(t){r[t]=!1},setEnabled:function(t,e){r[t]=!!e},_uniqueSets:function(){return Object.keys(n)}};a.init(),t.exports=a},function(t,e){t.exports={14851:{},custom_items_in_context_menu:{},websocket_connection:{},countdown:{},symbol_search_parser_mixin:{},show_pro_features:{},daily_timeframe_suffix:{},symbollist_context_menu:{},pay_attention_to_ticker_not_symbol:{},graying_disabled_tools_enabled:{},update_study_formatter_on_symbol_resolve:{},constraint_dialogs_movement:{},same_data_requery:{},phone_verification:{},show_interval_dialog_on_key_press:{},header_interval_dialog_button:{subsets:["show_interval_dialog_on_key_press"]},header_fullscreen_button:{},header_symbol_search:{},symbol_search_hot_key:{},header_resolutions:{subsets:["header_interval_dialog_button"]},header_chart_type:{},header_settings:{},header_indicators:{},header_compare:{},header_undo_redo:{},header_screenshot:{},header_saveload:{},header_saveload_to_the_right:{},study_on_study:{},header_widget:{subsets:["header_widget_dom_node","header_symbol_search","header_resolutions","header_chart_type","header_settings","header_indicators","header_compare","header_undo_redo","header_fullscreen_button","compare_symbol"]},compare_symbol:{subsets:["header_compare"]},chart_property_page:{subsets:["chart_property_page_style","chart_property_page_scales","chart_property_page_background","chart_property_page_timezone_sessions","chart_property_page_evetns_alerts","chart_property_page_trading","chart_property_page_template_button"]},disable_userlink_popup:{},left_toolbar:{},control_bar:{},widget_logo:{},timeframes_toolbar:{},edit_buttons_in_legend:{subsets:["show_hide_button_in_legend","format_button_in_legend","study_buttons_in_legend","delete_button_in_legend"]},show_hide_button_in_legend:{},format_button_in_legend:{},study_buttons_in_legend:{},delete_button_in_legend:{},pane_context_menu:{},scales_context_menu:{},legend_context_menu:{},context_menus:{subsets:["pane_context_menu","scales_context_menu","legend_context_menu","objects_tree_context_menu"]},items_favoriting:{},save_chart_properties_to_local_storage:{},use_localstorage_for_settings:{
|
|
|
|
subsets:["items_favoriting","save_chart_properties_to_local_storage"]},plain_studymarket:{},trading_watch_positions:{},disable_resolution_rebuild:{},border_around_the_chart:{},charting_library_debug_mode:{},log_data_request_time:{},saveload_requires_authentication:{},saveload_storage_customization:{},new_chart_creation_available:{},volume_force_overlay:{},create_volume_indicator_by_default:{},create_volume_indicator_by_default_once:{},saved_charts_count_restriction:{},lean_chart_load:{},stop_study_on_restart:{},star_some_intervals_by_default:{},predefined_items_only_may_be_starred:{},move_logo_to_main_pane:{},show_logo_on_all_charts:{},link_to_tradingview:{},right_bar_stays_on_scroll:{},chart_content_overrides_by_deafults:{},show_dialog_on_snapshot_ready:{},snapshot_trading_drawings:{},allow_supported_resolutions_set_only:{},study_market_minimized:{},widgetbar_tabs:{},collapsible_header:{},show_extension_popup:{},study_templates:{},side_toolbar_in_fullscreen_mode:{},remove_library_container_border:{},whotrades_auth_only:{},support_multicharts:{},display_market_status:{},show_chart_warn_message:{},datasource_copypaste:{},line_tool_templates:{},expand_symbolsearch_items:{},symbol_search_three_columns_exchanges:{},symbol_search_flags:{},symbol_search_limited_exchanges:{},symbol_search_quandl:{},footer_share_buttons:{},footer_bugreport_button:{},footer_publish_idea_button:{},text_notes:{},symbol_info:{},no_bars_status:{},clear_bars_on_series_error:{},hide_loading_screen_on_series_error:{},seconds_resolution:{},dont_show_boolean_study_arguments:{},hide_last_na_study_output:{},price_scale_always_last_bar_value:{},study_dialog_search_control:{},cqg_trading_confirm_risks:{},trading_notifications:{},chart_crosshair_menu:{},japanese_chart_styles:{},linetoolpropertieswidget_template_button:{},use_overrides_for_overlay:{},timezone_menu:{},main_series_scale_menu:{},show_login_dialog:{},remove_img_from_rss:{},chart_scroll:{},chart_zoom:{},onchart_messages:{},custom_resolutions_box:{},referral_program_for_widget_owners:{},referral_program_policy_aggressive:{subsets:["referral_program_policy_passive","referral_program_policy_normal"]},referral_program_policy_normal:{subsets:["referral_program_policy_passive","header_fake_features_buttons","custom_resolutions_box"]},tv_production:{
|
|
|
|
subsets:["items_favoriting","save_chart_properties_to_local_storage"]},plain_studymarket:{},trading_watch_positions:{},disable_resolution_rebuild:{},border_around_the_chart:{},charting_library_debug_mode:{},cl_feed_return_all_data:{},log_data_request_time:{},saveload_requires_authentication:{},saveload_storage_customization:{},new_chart_creation_available:{},volume_force_overlay:{},create_volume_indicator_by_default:{},create_volume_indicator_by_default_once:{},saved_charts_count_restriction:{},lean_chart_load:{},stop_study_on_restart:{},star_some_intervals_by_default:{},predefined_items_only_may_be_starred:{},move_logo_to_main_pane:{},show_logo_on_all_charts:{},link_to_tradingview:{},right_bar_stays_on_scroll:{},chart_content_overrides_by_deafults:{},show_dialog_on_snapshot_ready:{},snapshot_trading_drawings:{},allow_supported_resolutions_set_only:{},study_market_minimized:{},widgetbar_tabs:{},collapsible_header:{},show_extension_popup:{},study_templates:{},side_toolbar_in_fullscreen_mode:{},remove_library_container_border:{},whotrades_auth_only:{},support_multicharts:{},display_market_status:{},show_chart_warn_message:{},datasource_copypaste:{},line_tool_templates:{},expand_symbolsearch_items:{},symbol_search_three_columns_exchanges:{},symbol_search_flags:{},symbol_search_limited_exchanges:{},symbol_search_quandl:{},footer_share_buttons:{},footer_bugreport_button:{},footer_publish_idea_button:{},text_notes:{},symbol_info:{},no_bars_status:{},clear_bars_on_series_error:{},hide_loading_screen_on_series_error:{},seconds_resolution:{},dont_show_boolean_study_arguments:{},hide_last_na_study_output:{},price_scale_always_last_bar_value:{},study_dialog_search_control:{},cqg_trading_confirm_risks:{},trading_notifications:{},chart_crosshair_menu:{},japanese_chart_styles:{},linetoolpropertieswidget_template_button:{},use_overrides_for_overlay:{},timezone_menu:{},main_series_scale_menu:{},show_login_dialog:{},remove_img_from_rss:{},chart_scroll:{},chart_zoom:{},high_density_bars:{},onchart_messages:{},custom_resolutions_box:{},referral_program_for_widget_owners:{},referral_program_policy_aggressive:{subsets:["referral_program_policy_passive","referral_program_policy_normal"]},referral_program_policy_normal:{subsets:["referral_program_policy_passive","header_fake_features_buttons","custom_resolutions_box"]},tv_production:{
|
|
|
|
subsets:["show_pro_features","countdown","symbol_search_parser_mixin","symbollist_context_menu","websocket_connection","header_fullscreen_button","header_widget","left_toolbar","control_bar","timeframes_toolbar","symbol_search_hot_key","context_menus","edit_buttons_in_legend","use_localstorage_for_settings","saveload_requires_authentication","volume_force_overlay","new_chart_creation_available","saved_charts_count_restriction","create_volume_indicator_by_default","create_volume_indicator_by_default_once","charts_auto_save","right_bar_stays_on_scroll","save_old_chart_before_save_as","chart_property_page_trading","chart_content_overrides_by_deafults","alerts","show_dialog_on_snapshot_ready","show_extension_popup","header_saveload","header_saveload_to_the_right","header_layouttoggle","datasource_copypaste","alerts","show_saved_watchlists","watchlists_from_to_file","add_to_watchlist","chart_property_page","show_chart_property_page","support_multicharts","display_market_status","show_chart_warn_message","support_manage_drawings","widgetbar_tabs","study_templates","collapsible_header","line_tool_templates","caption_buttons_text_if_possible","footer_share_buttons","footer_publish_idea_button","text_notes","trading_watch_positions","symbol_info","linetoolpropertieswidget_template_button","cqg_trading_confirm_risks","trading_notifications","symbol_search_three_columns_exchanges","symbol_search_flags","symbol_search_limited_exchanges","symbol_search_quandl","phone_verification","chart_events","onchart_messages","custom_resolutions_box","compare_symbol","timezone_menu","main_series_scale_menu","chart_crosshair_menu","study_on_study","japanese_chart_styles","show_login_dialog","dome_widget","chart_scroll","chart_zoom"]},browser_extension:{subsets:["disable_userlink_popup","show_pro_features","show_saved_watchlists","display_market_status","show_chart_warn_message","widgetbar_tabs","show_login_dialog"]},widget:{
|
|
|
|
subsets:["show_pro_features","countdown","symbol_search_parser_mixin","symbollist_context_menu","websocket_connection","header_fullscreen_button","header_widget","left_toolbar","control_bar","timeframes_toolbar","symbol_search_hot_key","context_menus","edit_buttons_in_legend","use_localstorage_for_settings","saveload_requires_authentication","volume_force_overlay","new_chart_creation_available","saved_charts_count_restriction","create_volume_indicator_by_default","create_volume_indicator_by_default_once","charts_auto_save","right_bar_stays_on_scroll","save_old_chart_before_save_as","chart_property_page_trading","chart_content_overrides_by_deafults","alerts","show_dialog_on_snapshot_ready","show_extension_popup","header_saveload","header_saveload_to_the_right","header_layouttoggle","datasource_copypaste","alerts","show_saved_watchlists","watchlists_from_to_file","add_to_watchlist","chart_property_page","show_chart_property_page","support_multicharts","display_market_status","show_chart_warn_message","support_manage_drawings","widgetbar_tabs","study_templates","collapsible_header","line_tool_templates","caption_buttons_text_if_possible","footer_share_buttons","footer_publish_idea_button","text_notes","trading_watch_positions","symbol_info","linetoolpropertieswidget_template_button","cqg_trading_confirm_risks","trading_notifications","symbol_search_three_columns_exchanges","symbol_search_flags","symbol_search_limited_exchanges","symbol_search_quandl","phone_verification","chart_events","onchart_messages","custom_resolutions_box","compare_symbol","timezone_menu","main_series_scale_menu","chart_crosshair_menu","study_on_study","japanese_chart_styles","show_login_dialog","dome_widget","chart_scroll","chart_zoom"]},browser_extension:{subsets:["disable_userlink_popup","show_pro_features","show_saved_watchlists","display_market_status","show_chart_warn_message","widgetbar_tabs","show_login_dialog"]},widget:{
|
|
|
|
subsets:["show_pro_features","countdown","symbol_search_parser_mixin","symbollist_context_menu","websocket_connection","left_toolbar","control_bar","timeframes_toolbar","symbol_search_hot_key","context_menus","edit_buttons_in_legend","use_localstorage_for_settings","saveload_requires_authentication","volume_force_overlay","create_volume_indicator_by_default","create_volume_indicator_by_default_once","right_bar_stays_on_scroll","show_dialog_on_snapshot_ready","header_widget_dom_node","header_symbol_search","symbol_search_hot_key","header_resolutions","header_chart_type","header_compare","header_indicators","header_resolutions","header_widget_dom_node","left_toolbar","saveload_requires_authentication","show_dialog_on_snapshot_ready","star_some_intervals_by_default","symbol_search_parser_mixin","symbollist_context_menu","use_localstorage_for_settings","volume_force_overlay","websocket_connection","display_market_status","show_chart_warn_message","symbol_info","linetoolpropertieswidget_template_button","symbol_search_three_columns_exchanges","symbol_search_flags","symbol_search_limited_exchanges","widgetbar_tabs","force_quandl_search","compare_symbol","timezone_menu","main_series_scale_menu","show_login_dialog","plain_studymarket","japanese_chart_styles","chart_scroll","chart_zoom"]},bovespa_widget:{subsets:["widget","header_settings","chart_property_page_timezone_sessions","linetoolpropertieswidget_template_button"]},charting_library_base:{subsets:["14851","adapt_onchart_logo_background","allow_supported_resolutions_set_only","border_around_the_chart","collapsible_header","constraint_dialogs_movement","context_menus","control_bar","create_volume_indicator_by_default","custom_items_in_context_menu","datasource_copypaste","daily_timeframe_suffix","display_market_status","edit_buttons_in_legend","graying_disabled_tools_enabled","header_widget","header_saveload","header_saveload_to_the_right","lean_chart_load","left_toolbar","trading_watch_positions","link_to_tradingview","pay_attention_to_ticker_not_symbol","plain_studymarket","predefined_items_only_may_be_starred","refresh_saved_charts_list_on_dialog_show","right_bar_stays_on_scroll","saveload_storage_customization","show_dialog_on_snapshot_ready","stop_study_on_restart","study_market_minimized","timeframes_toolbar","symbol_search_hot_key","update_study_formatter_on_symbol_resolve","update_timeframes_set_on_symbol_resolve","use_localstorage_for_settings","volume_force_overlay","widget_logo","countdown","use_overrides_for_overlay","trading_notifications","compare_symbol","symbol_info","timezone_menu","main_series_scale_menu","study_dialog_search_control","chart_crosshair_menu","create_volume_indicator_by_default_once","chart_scroll","chart_zoom","show_chart_property_page","chart_property_page_style","chart_property_page_scales","chart_property_page_background","chart_property_page_timezone_sessions","chart_property_page_evetns_alerts"]},charting_library:{subsets:["charting_library_base","header_screenshot"]},static_charts_service:{
|
|
|
|
subsets:["show_pro_features","countdown","symbol_search_parser_mixin","symbollist_context_menu","websocket_connection","left_toolbar","control_bar","timeframes_toolbar","symbol_search_hot_key","context_menus","edit_buttons_in_legend","use_localstorage_for_settings","saveload_requires_authentication","volume_force_overlay","create_volume_indicator_by_default","create_volume_indicator_by_default_once","right_bar_stays_on_scroll","show_dialog_on_snapshot_ready","header_widget_dom_node","header_symbol_search","symbol_search_hot_key","header_resolutions","header_chart_type","header_compare","header_indicators","header_resolutions","header_widget_dom_node","left_toolbar","saveload_requires_authentication","show_dialog_on_snapshot_ready","star_some_intervals_by_default","symbol_search_parser_mixin","symbollist_context_menu","use_localstorage_for_settings","volume_force_overlay","websocket_connection","display_market_status","show_chart_warn_message","symbol_info","linetoolpropertieswidget_template_button","symbol_search_three_columns_exchanges","symbol_search_flags","symbol_search_limited_exchanges","widgetbar_tabs","force_quandl_search","compare_symbol","timezone_menu","main_series_scale_menu","show_login_dialog","plain_studymarket","japanese_chart_styles","chart_scroll","chart_zoom"]},bovespa_widget:{subsets:["widget","header_settings","chart_property_page_timezone_sessions","linetoolpropertieswidget_template_button"]},charting_library_base:{subsets:["14851","adapt_onchart_logo_background","allow_supported_resolutions_set_only","border_around_the_chart","collapsible_header","constraint_dialogs_movement","context_menus","control_bar","create_volume_indicator_by_default","custom_items_in_context_menu","datasource_copypaste","daily_timeframe_suffix","display_market_status","edit_buttons_in_legend","graying_disabled_tools_enabled","header_widget","header_saveload","header_saveload_to_the_right","lean_chart_load","left_toolbar","trading_watch_positions","link_to_tradingview","pay_attention_to_ticker_not_symbol","plain_studymarket","predefined_items_only_may_be_starred","refresh_saved_charts_list_on_dialog_show","right_bar_stays_on_scroll","saveload_storage_customization","show_dialog_on_snapshot_ready","stop_study_on_restart","study_market_minimized","timeframes_toolbar","symbol_search_hot_key","update_study_formatter_on_symbol_resolve","update_timeframes_set_on_symbol_resolve","use_localstorage_for_settings","volume_force_overlay","widget_logo","countdown","use_overrides_for_overlay","trading_notifications","compare_symbol","symbol_info","timezone_menu","main_series_scale_menu","study_dialog_search_control","chart_crosshair_menu","create_volume_indicator_by_default_once","chart_scroll","chart_zoom","show_chart_property_page","chart_property_page_style","chart_property_page_scales","chart_property_page_background","chart_property_page_timezone_sessions","chart_property_page_evetns_alerts"]},charting_library:{subsets:["charting_library_base","header_screenshot"]},static_charts_service:{
|
|
|
|
subsets:["charting_library","disable_resolution_rebuild","log_data_request_time","same_data_requery"]},trading_terminal:{subsets:["charting_library_base","support_multicharts","header_layouttoggle","japanese_chart_styles","chart_property_page_trading","add_to_watchlist"]},cqg_terminal:{subsets:["charting_library_base","chart_property_page_trading","expand_symbolsearch_items","caption_buttons_text_if_possible","clear_bars_on_series_error","no_bars_status","hide_loading_screen_on_series_error","support_multicharts","header_layouttoggle","same_data_requery","footer_bugreport_button","dome_widget","dome_widget_always_enabled","japanese_chart_styles","remove_img_from_rss","add_to_watchlist"]},amp_terminal:{subsets:["cqg_terminal"]}}},function(t,e){},function(t,e){"use strict";function i(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(),200===e.status?JSON.parse(e.responseText):null}if(window.actualLanguage){if(!window._tv_languages){var o="localization/translations/"+window.actualLanguage+".json";window._tv_languages={},window._tv_languages[window.actualLanguage]=i(o)||{}}}else window.actualLanguage="en"},function(t,e,i){"use strict";function o(t){return t?(window._tv_languages||{})[t]||null:null}function n(){document.body&&document.body.dispatchEvent(new a.CustomEvent("tradingview-i18next-initialized"))}var s,r,a,l,h,c,d,p;i(6),s=i(7),r=i(8),a=i(24),l={translate:s.translationFunction},window.__tradingviewI18nextInited||(h=window.actualLanguage||null,c=o(h),h&&c||(console.error("No translation data"),h="en",c=o("en")),h&&c?(d={compatibilityJSON:"v1",keySeparator:"@",lng:h,nsSeparator:"@",resources:(p={},p[h]={translation:c},p)},r.init(d,n),l.translate=r.t.bind(r),s.addTranslationFunctionToWindow(l.translate),s.addTranslationFunctionToJQuery(l.translate)):n(),window.__tradingviewI18nextInited=!0),t.exports=l},function(t,e,i){"use strict";var o=i(7);o.addTranslationFunctionToWindow(o.translationFunction),o.addTranslationFunctionToJQuery(o.translationFunction)},function(t,e){"use strict";function i(t){window.t=t}function o(t){s.$||(s.$={}),s.$.t=t}var n,s=window;e.addTranslationFunctionToWindow=i,e.addTranslationFunctionToJQuery=o,n=function(t,e){return t},e.translationFunction=n},,,,,,,,,,,,,,,,,function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.CustomEvent=function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.bubbles,n=void 0!==o&&o,s=i.cancelable,r=void 0!==s&&s,a=i.detail,l=void 0===a?null:a;try{return new window.CustomEvent(t,{bubbles:n,cancelable:r,detail:l})}catch(i){return e=document.createEvent("CustomEvent"),e.initCustomEvent(t,n,r,l),e}}},function(t,e,i){"use strict";var o,n;i(26),o=$.Deferred(),n=function(){o.resolve(),document.body.removeEventListener("tradingview-i18next-initialized",n)},window.__tradingviewI18nextInited?n():document.body.addEventListener("tradingview-i18next-initialized",n),t.exports=o},,,function(t,e,i){"use strict";function o(t){return t.keys().map(t)}window.TradingView=window.TradingView||{},window.requireAll=o,i(29),i(43),
|
|
|
|
subsets:["charting_library","disable_resolution_rebuild","log_data_request_time","same_data_requery"]},trading_terminal:{subsets:["charting_library_base","support_multicharts","header_layouttoggle","japanese_chart_styles","chart_property_page_trading","add_to_watchlist"]},cqg_terminal:{subsets:["charting_library_base","chart_property_page_trading","expand_symbolsearch_items","caption_buttons_text_if_possible","clear_bars_on_series_error","no_bars_status","hide_loading_screen_on_series_error","support_multicharts","header_layouttoggle","same_data_requery","footer_bugreport_button","dome_widget","dome_widget_always_enabled","japanese_chart_styles","remove_img_from_rss","add_to_watchlist"]},amp_terminal:{subsets:["cqg_terminal"]}}},function(t,e){},function(t,e){"use strict";function i(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(),200===e.status?JSON.parse(e.responseText):null}if(window.actualLanguage){if(!window._tv_languages){var o="localization/translations/"+window.actualLanguage+".json";window._tv_languages={},window._tv_languages[window.actualLanguage]=i(o)||{}}}else window.actualLanguage="en"},function(t,e,i){"use strict";function o(t){return t?(window._tv_languages||{})[t]||null:null}function n(){document.body&&document.body.dispatchEvent(new a.CustomEvent("tradingview-i18next-initialized"))}var s,r,a,l,h,c,d,p;i(6),s=i(7),r=i(8),a=i(24),l={translate:s.translationFunction},window.__tradingviewI18nextInited||(h=window.actualLanguage||null,c=o(h),h&&c||(console.error("No translation data"),h="en",c=o("en")),h&&c?(d={compatibilityJSON:"v1",keySeparator:"@",lng:h,nsSeparator:"@",resources:(p={},p[h]={translation:c},p)},r.init(d,n),l.translate=r.t.bind(r),s.addTranslationFunctionToWindow(l.translate),s.addTranslationFunctionToJQuery(l.translate)):n(),window.__tradingviewI18nextInited=!0),t.exports=l},function(t,e,i){"use strict";var o=i(7);o.addTranslationFunctionToWindow(o.translationFunction),o.addTranslationFunctionToJQuery(o.translationFunction)},function(t,e){"use strict";function i(t){window.t=t}function o(t){s.$||(s.$={}),s.$.t=t}var n,s=window;e.addTranslationFunctionToWindow=i,e.addTranslationFunctionToJQuery=o,n=function(t,e){return t},e.translationFunction=n},,,,,,,,,,,,,,,,,function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.CustomEvent=function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.bubbles,n=void 0!==o&&o,s=i.cancelable,r=void 0!==s&&s,a=i.detail,l=void 0===a?null:a;try{return new window.CustomEvent(t,{bubbles:n,cancelable:r,detail:l})}catch(i){return e=document.createEvent("CustomEvent"),e.initCustomEvent(t,n,r,l),e}}},function(t,e,i){"use strict";var o,n;i(26),o=$.Deferred(),n=function(){o.resolve(),document.body.removeEventListener("tradingview-i18next-initialized",n)},window.__tradingviewI18nextInited?n():document.body.addEventListener("tradingview-i18next-initialized",n),t.exports=o},,,function(t,e,i){"use strict";function o(t){return t.keys().map(t)}window.TradingView=window.TradingView||{},window.requireAll=o,i(29),i(43),
|
|
|
|
@@ -391,11 +391,11 @@ e[a].low=this.priceToLogical(e[a].low),e[a].close=this.priceToLogical(e[a].close
|
|
|
|
a.prototype.isScaled=function(){return"number"==typeof this.m_scaleStartPoint},a.prototype.startScale=function(t){this.isPercentage()||null===this.m_scaleStartPoint&&null===this.m_priceRangeSnapshot&&(this.isEmpty()||(this.m_scaleStartPoint=this.m_height-t,this.m_priceRangeSnapshot=this.priceRange().clone()))},a.prototype.marks=function(){return this._marksCache?this._marksCache:(this.m_markBuilder.rebuildTickMarks(),this._marksCache=this.m_markBuilder.marks(),this.onMarksChanged.fire(),this._marksCache)},a.prototype.scaleTo=function(t){var e,i;this.isPercentage()||(this._marksCache=null,null!==this.m_scaleStartPoint&&(this.setAutoScale(!1),e=this.m_priceRange.clone(),t=this.m_height-t,t<0&&(t=0),i=(this.m_scaleStartPoint+.2*(this.m_height-1))/(t+.2*(this.m_height-1)),i=Math.max(i,.1),this.m_priceRange=this.m_priceRangeSnapshot.clone(),this.m_priceRange.scaleAroundCenter(i),this.recalcLockedScale(e)))},a.prototype.recalcLockedScale=function(t){var e,i,n,s;if(this.mainSource()instanceof p&&this.mainSource().properties().lockScale.value()){if(e=this.mainSource().model().timeScale(),i=this.mainSource().data().boxSize,(void 0===i||isNaN(i))&&this.mainSource().fixBoxSize(),void 0===i||isNaN(i))return;this.properties().percentage.value()&&(n=this.mainSource().data().search(this.mainSource().getRealVisibleRange().m_firstBar).value[TradingView.CLOSE_PLOT],i=o.prototype.convertToPercent.call(null,n+i,n)-o.prototype.convertToPercent.call(null,n,n)),s=this.internalHeight()/this.priceRange().length()*i,s<.5||s>50?this.m_priceRange=t:(e.setBarSpacing(s),e._correctOffset()),this.mainSource().model().mainSeries().requestMoreData()}},a.prototype.endScale=function(){this.isPercentage()||null!==this.m_scaleStartPoint&&(this.m_scaleStartPoint=null,this.m_priceRangeSnapshot=null)},a.prototype.startScroll=function(t){this.isAutoScale()||null===this.m_scrollStartPoint&&null===this.m_priceRangeSnapshot&&(this.isEmpty()||(this.m_scrollStartPoint=t,this.m_priceRangeSnapshot=this.priceRange().clone()))},a.prototype.scrollTo=function(t){var e,i,o;this._marksCache=null,this.isAutoScale()||null!==this.m_scrollStartPoint&&(e=this.priceRange().length()/(this.height()-1),i=t-this.m_scrollStartPoint,o=i*e,this.m_priceRange=this.m_priceRangeSnapshot.clone(),this.m_priceRange.shift(o))},a.prototype.endScroll=function(){this.isAutoScale()||null!==this.m_scrollStartPoint&&(this.m_scrollStartPoint=null,this.m_priceRangeSnapshot=null)},a.prototype.state=function(){var t={};return t.m_priceRange=this.priceRange()?this.priceRange().serialize():null,t.m_isAutoScale=this.isAutoScale(),t.m_isPercentage=this._properties.percentage.value(),t.m_isLog=this._properties.log.value(),t.m_height=this.m_height,t.m_topMargin=this.m_topMargin,t.m_bottomMargin=this.m_bottomMargin,t},a.prototype.restoreState=function(t){var e=t.m_priceRange;if(void 0===e)throw new TypeError("invalid state");if(void 0===t.m_isAutoScale)throw new TypeError("invalid state");void 0!==t.m_isPercentage&&this._properties.percentage.setValue(t.m_isPercentage),
|
|
|
|
a.prototype.isScaled=function(){return"number"==typeof this.m_scaleStartPoint},a.prototype.startScale=function(t){this.isPercentage()||null===this.m_scaleStartPoint&&null===this.m_priceRangeSnapshot&&(this.isEmpty()||(this.m_scaleStartPoint=this.m_height-t,this.m_priceRangeSnapshot=this.priceRange().clone()))},a.prototype.marks=function(){return this._marksCache?this._marksCache:(this.m_markBuilder.rebuildTickMarks(),this._marksCache=this.m_markBuilder.marks(),this.onMarksChanged.fire(),this._marksCache)},a.prototype.scaleTo=function(t){var e,i;this.isPercentage()||(this._marksCache=null,null!==this.m_scaleStartPoint&&(this.setAutoScale(!1),e=this.m_priceRange.clone(),t=this.m_height-t,t<0&&(t=0),i=(this.m_scaleStartPoint+.2*(this.m_height-1))/(t+.2*(this.m_height-1)),i=Math.max(i,.1),this.m_priceRange=this.m_priceRangeSnapshot.clone(),this.m_priceRange.scaleAroundCenter(i),this.recalcLockedScale(e)))},a.prototype.recalcLockedScale=function(t){var e,i,n,s;if(this.mainSource()instanceof p&&this.mainSource().properties().lockScale.value()){if(e=this.mainSource().model().timeScale(),i=this.mainSource().data().boxSize,(void 0===i||isNaN(i))&&this.mainSource().fixBoxSize(),void 0===i||isNaN(i))return;this.properties().percentage.value()&&(n=this.mainSource().data().search(this.mainSource().getRealVisibleRange().m_firstBar).value[TradingView.CLOSE_PLOT],i=o.prototype.convertToPercent.call(null,n+i,n)-o.prototype.convertToPercent.call(null,n,n)),s=this.internalHeight()/this.priceRange().length()*i,s<.5||s>50?this.m_priceRange=t:(e.setBarSpacing(s),e._correctOffset()),this.mainSource().model().mainSeries().requestMoreData()}},a.prototype.endScale=function(){this.isPercentage()||null!==this.m_scaleStartPoint&&(this.m_scaleStartPoint=null,this.m_priceRangeSnapshot=null)},a.prototype.startScroll=function(t){this.isAutoScale()||null===this.m_scrollStartPoint&&null===this.m_priceRangeSnapshot&&(this.isEmpty()||(this.m_scrollStartPoint=t,this.m_priceRangeSnapshot=this.priceRange().clone()))},a.prototype.scrollTo=function(t){var e,i,o;this._marksCache=null,this.isAutoScale()||null!==this.m_scrollStartPoint&&(e=this.priceRange().length()/(this.height()-1),i=t-this.m_scrollStartPoint,o=i*e,this.m_priceRange=this.m_priceRangeSnapshot.clone(),this.m_priceRange.shift(o))},a.prototype.endScroll=function(){this.isAutoScale()||null!==this.m_scrollStartPoint&&(this.m_scrollStartPoint=null,this.m_priceRangeSnapshot=null)},a.prototype.state=function(){var t={};return t.m_priceRange=this.priceRange()?this.priceRange().serialize():null,t.m_isAutoScale=this.isAutoScale(),t.m_isPercentage=this._properties.percentage.value(),t.m_isLog=this._properties.log.value(),t.m_height=this.m_height,t.m_topMargin=this.m_topMargin,t.m_bottomMargin=this.m_bottomMargin,t},a.prototype.restoreState=function(t){var e=t.m_priceRange;if(void 0===e)throw new TypeError("invalid state");if(void 0===t.m_isAutoScale)throw new TypeError("invalid state");void 0!==t.m_isPercentage&&this._properties.percentage.setValue(t.m_isPercentage),
|
|
|
|
void 0!==t.m_isLog&&this._properties.log.setValue(t.m_isLog),this.m_priceRange=e?new o(e):null,void 0!==t.m_height&&(this.m_height=t.m_height),this.setAutoScale(t.m_isAutoScale),void 0!==t.m_topMargin&&(this.m_topMargin=t.m_topMargin),void 0!==t.m_bottomMargin&&(this.m_bottomMargin=t.m_bottomMargin),this._mainSource=void 0,this._scaleSeriesOnly=!1},a.prototype.mainSource=function(){var t,e;if(void 0!==this._mainSource)return this._mainSource;for(t=void 0,e=0;e<this.m_dataSources.length;e++){if(TradingView.isInherited(this.m_dataSources[e].constructor,p)){t=this.m_dataSources[e];break}!t&&TradingView.isInherited(this.m_dataSources[e].constructor,d)&&(t=this.m_dataSources[e])}return this._mainSource=t,this._mainSource||null},a.prototype.formatter=function(){return this._formatter||this.updateFormatter(),this._formatter},a.prototype.updateFormatter=function(){var t,e;this._marksCache=null,t=this.mainSource(),e=100,t&&(e=t.base()),this._formatter=null,this.properties().percentage.value()?this._formatter=new _:this._formatter=t?t.formatter():new u(100,1),this.m_markBuilder=new s(this,e,this._formatter),this.m_markBuilder.rebuildTickMarks()},a.prototype._recalculateSourcesForAutoscale=function(){var t,e;this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.scaleSeriesOnly.value()),t=this._scaleSeriesOnly&&this._hasSeries,e=function(e){return!!(e.properties().visible.value()||e instanceof p)&&(t?TradingView.isInherited(e.constructor,p):TradingView.isInherited(e.constructor,d))},this._sourcesForAutoscale=this.m_dataSources.filter(e)},a.prototype.sourcesForAutoscale=function(){return this._mainSource&&this._scaleSeriesOnly!==this._scalesProperties.scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||this._recalculateSourcesForAutoscale(),this._sourcesForAutoscale},a.prototype.recalculatePriceRange=function(t){this._invalidatedForRange={visibleBars:t,isValid:!1}},a.prototype.makeSureItIsValid=function(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this.recalculatePriceRangeImpl())},a.prototype.recalculatePriceRangeImpl=function(){var t,e,i,n,s,r,a,l,h,c,d=this._invalidatedForRange.visibleBars;if(d){for(t=null,e=this.sourcesForAutoscale(),i=0,n=0,s=0;s<e.length;s++)r=e[s],r.properties().visible.value()&&(a=d.firstBar(),l=d.lastBar(),h=r.priceRange(a,l),null===t&&h?t=h:h&&(t=t.merge(h)),r.margins&&(c=r.margins(),i=Math.max(c[0],i),n=Math.max(c[1],n)));(Math.abs(n-this._studyBottomMargin)>.01||Math.abs(i-this._studyTopMargin)>.01)&&(this._studyBottomMargin=n,this._studyTopMargin=i,this._marksCache=null,this._internalHeightCache=null),t?(t.minValue()===t.maxValue()&&(t=new o(t.minValue()-.5,t.maxValue()+.5)),this.setPriceRange(t)):this.m_priceRange||this.setPriceRange(new o(-.5,.5)),this._invalidatedForRange.isValid=!0}},a.prototype.sourcesToUpdateViews=function(){var t,e;if(!this._sourcesToUpdateViews)for(this._sourcesToUpdateViews=[],t=0;t<this.m_dataSources.length;t++)e=this.m_dataSources[t],
|
|
|
|
void 0!==t.m_isLog&&this._properties.log.setValue(t.m_isLog),this.m_priceRange=e?new o(e):null,void 0!==t.m_height&&(this.m_height=t.m_height),this.setAutoScale(t.m_isAutoScale),void 0!==t.m_topMargin&&(this.m_topMargin=t.m_topMargin),void 0!==t.m_bottomMargin&&(this.m_bottomMargin=t.m_bottomMargin),this._mainSource=void 0,this._scaleSeriesOnly=!1},a.prototype.mainSource=function(){var t,e;if(void 0!==this._mainSource)return this._mainSource;for(t=void 0,e=0;e<this.m_dataSources.length;e++){if(TradingView.isInherited(this.m_dataSources[e].constructor,p)){t=this.m_dataSources[e];break}!t&&TradingView.isInherited(this.m_dataSources[e].constructor,d)&&(t=this.m_dataSources[e])}return this._mainSource=t,this._mainSource||null},a.prototype.formatter=function(){return this._formatter||this.updateFormatter(),this._formatter},a.prototype.updateFormatter=function(){var t,e;this._marksCache=null,t=this.mainSource(),e=100,t&&(e=t.base()),this._formatter=null,this.properties().percentage.value()?this._formatter=new _:this._formatter=t?t.formatter():new u(100,1),this.m_markBuilder=new s(this,e,this._formatter),this.m_markBuilder.rebuildTickMarks()},a.prototype._recalculateSourcesForAutoscale=function(){var t,e;this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.scaleSeriesOnly.value()),t=this._scaleSeriesOnly&&this._hasSeries,e=function(e){return!!(e.properties().visible.value()||e instanceof p)&&(t?TradingView.isInherited(e.constructor,p):TradingView.isInherited(e.constructor,d))},this._sourcesForAutoscale=this.m_dataSources.filter(e)},a.prototype.sourcesForAutoscale=function(){return this._mainSource&&this._scaleSeriesOnly!==this._scalesProperties.scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||this._recalculateSourcesForAutoscale(),this._sourcesForAutoscale},a.prototype.recalculatePriceRange=function(t){this._invalidatedForRange={visibleBars:t,isValid:!1}},a.prototype.makeSureItIsValid=function(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this.recalculatePriceRangeImpl())},a.prototype.recalculatePriceRangeImpl=function(){var t,e,i,n,s,r,a,l,h,c,d=this._invalidatedForRange.visibleBars;if(d){for(t=null,e=this.sourcesForAutoscale(),i=0,n=0,s=0;s<e.length;s++)r=e[s],r.properties().visible.value()&&(a=d.firstBar(),l=d.lastBar(),h=r.priceRange(a,l),null===t&&h?t=h:h&&(t=t.merge(h)),r.margins&&(c=r.margins(),i=Math.max(c[0],i),n=Math.max(c[1],n)));(Math.abs(n-this._studyBottomMargin)>.01||Math.abs(i-this._studyTopMargin)>.01)&&(this._studyBottomMargin=n,this._studyTopMargin=i,this._marksCache=null,this._internalHeightCache=null),t?(t.minValue()===t.maxValue()&&(t=new o(t.minValue()-.5,t.maxValue()+.5)),this.setPriceRange(t)):this.m_priceRange||this.setPriceRange(new o(-.5,.5)),this._invalidatedForRange.isValid=!0}},a.prototype.sourcesToUpdateViews=function(){var t,e;if(!this._sourcesToUpdateViews)for(this._sourcesToUpdateViews=[],t=0;t<this.m_dataSources.length;t++)e=this.m_dataSources[t],
|
|
|
|
TradingView.isInherited(e.constructor,c)&&!e.isActualSymbol()||this._sourcesToUpdateViews.push(e);return this._sourcesToUpdateViews},a.prototype.updatePaneViews=function(){var t,e=this.sourcesToUpdateViews();for(t=0;t<e.length;t++)e[t].updateAllViews()},a.prototype.priceRangeInPrice=function(){var t,e,i,o,n,s;return this.isEmpty()?null:this.isPercent()?(t=this.mainSource().model().timeScale().visibleBars(),e=this.mainSource().data().search(t.firstBar(),TradingView.SEARCH_NEAREST_RIGHT).value[TradingView.CLOSE_PLOT],i=this.priceRange().convertFromPercents(e),{from:i.minValue(),to:i.maxValue()}):(o=this.height(),n=this.coordinateToPrice(o-1),s=this.coordinateToPrice(0),{from:n,to:s})},t.exports=a}).call(e,i(56),i(223))},function(t,e){"use strict";function i(t,e){this._formatter=t,this._maxSize=e||50,this._actualSize=0,this._cache={},this._usageTick=1,this._oldestTick=1,this._tick2Labels={}}i.prototype.format=function(t){var e,i;return this._cache[t]?this._cache[t].string:(this._actualSize===this._maxSize&&(e=this._tick2Labels[this._oldestTick],delete this._tick2Labels[this._oldestTick],delete this._cache[e],this._oldestTick++,this._actualSize--),i=this._formatter(t),this._cache[t]={string:i,tick:this._usageTick},this._tick2Labels[this._usageTick]=t,this._actualSize++,this._usageTick++,i)},t.exports=i},function(t,e,i){(function(e){"use strict";function o(t){function i(t,e){var i=t.font;return a.hasOwnProperty(i)||(a[i]={}),a[i].hasOwnProperty(e)||(a[i][e]=t.measureText(e).width),a[i][e]}function o(){var o=r.width(),a=r.height();return{draw:function(r){var h,c,d,p,u,_,f,m=t.symbolInfo();if(m&&!e.enabled("fundamental_widget")){for(r.fillStyle=n.generateColor(l.color.value(),l.transparency.value()),h=m.name,/QUANDL/.test(m.exchange)&&(c=h.split(/\//),c.length&&(h=c[c.length-1])),d=[{text:h?h+", "+s(t.interval()):"",font:"96px Verdana, Arial, sans-serif",lineHeight:114,baselineOffset:87},{text:m.description||"",font:"48px Verdana, Arial, sans-serif",lineHeight:57,baselineOffset:43.5}],p=0,u=0;u<d.length;u++)_=d[u],_.text&&(r.font=_.font,f=i(r,_.text),f>o?(_.zoom=o/f,f=o):_.zoom=1,_.offsetLeft=(o-f)/2,p+=_.lineHeight*_.zoom);for(p=Math.max((a-p)/2,0),u=0;u<d.length;u++)_=d[u],_.text&&(r.save(),r.font=_.font,r.translate(_.offsetLeft,p),r.scale(_.zoom,_.zoom),r.fillText(_.text,0,_.baselineOffset),r.restore(),p+=_.lineHeight*_.zoom)}}}}var r=null,a={},l=t.model().properties().symbolWatermarkProperties,h={renderer:o,update:function(){}};this.paneViews=function(t){return t.containsMainSeries()?(r=t,[h]):[]}}var n=i(199),s=i(230).translatedIntervalString;t.exports=o}).call(e,i(1))},function(t,e){"use strict";function i(){this.visible=!0,this.horzLinesVisible=!0,this.horzLinesColor="white",this.horzLinesStyle="",this.vertLinesVisible=!0,this.vertLinesColor="white",this.vertLinesStyle=""}function o(t,e){this.source=t,this.pane=e}function n(t){this.data=t}i.prototype.paneViews=function(t){return[new o(this,t)]},o.prototype.update=function(){},o.prototype.renderer=function(){var t={}
|
|
|
|
TradingView.isInherited(e.constructor,c)&&!e.isActualSymbol()||this._sourcesToUpdateViews.push(e);return this._sourcesToUpdateViews},a.prototype.updatePaneViews=function(){var t,e=this.sourcesToUpdateViews();for(t=0;t<e.length;t++)e[t].updateAllViews()},a.prototype.priceRangeInPrice=function(){var t,e,i,o,n,s;return this.isEmpty()?null:this.isPercent()?(t=this.mainSource().model().timeScale().visibleBars(),e=this.mainSource().data().search(t.firstBar(),TradingView.SEARCH_NEAREST_RIGHT).value[TradingView.CLOSE_PLOT],i=this.priceRange().convertFromPercents(e),{from:i.minValue(),to:i.maxValue()}):(o=this.height(),n=this.coordinateToPrice(o-1),s=this.coordinateToPrice(0),{from:n,to:s})},t.exports=a}).call(e,i(56),i(223))},function(t,e){"use strict";function i(t,e){this._formatter=t,this._maxSize=e||50,this._actualSize=0,this._cache={},this._usageTick=1,this._oldestTick=1,this._tick2Labels={}}i.prototype.format=function(t){var e,i;return this._cache[t]?this._cache[t].string:(this._actualSize===this._maxSize&&(e=this._tick2Labels[this._oldestTick],delete this._tick2Labels[this._oldestTick],delete this._cache[e],this._oldestTick++,this._actualSize--),i=this._formatter(t),this._cache[t]={string:i,tick:this._usageTick},this._tick2Labels[this._usageTick]=t,this._actualSize++,this._usageTick++,i)},t.exports=i},function(t,e,i){(function(e){"use strict";function o(t){function i(t,e){var i=t.font;return a.hasOwnProperty(i)||(a[i]={}),a[i].hasOwnProperty(e)||(a[i][e]=t.measureText(e).width),a[i][e]}function o(){var o=r.width(),a=r.height();return{draw:function(r){var h,c,d,p,u,_,f,m=t.symbolInfo();if(m&&!e.enabled("fundamental_widget")){for(r.fillStyle=n.generateColor(l.color.value(),l.transparency.value()),h=m.name,/QUANDL/.test(m.exchange)&&(c=h.split(/\//),c.length&&(h=c[c.length-1])),d=[{text:h?h+", "+s(t.interval()):"",font:"96px Verdana, Arial, sans-serif",lineHeight:114,baselineOffset:87},{text:m.description||"",font:"48px Verdana, Arial, sans-serif",lineHeight:57,baselineOffset:43.5}],p=0,u=0;u<d.length;u++)_=d[u],_.text&&(r.font=_.font,f=i(r,_.text),f>o?(_.zoom=o/f,f=o):_.zoom=1,_.offsetLeft=(o-f)/2,p+=_.lineHeight*_.zoom);for(p=Math.max((a-p)/2,0),u=0;u<d.length;u++)_=d[u],_.text&&(r.save(),r.font=_.font,r.translate(_.offsetLeft,p),r.scale(_.zoom,_.zoom),r.fillText(_.text,0,_.baselineOffset),r.restore(),p+=_.lineHeight*_.zoom)}}}}var r=null,a={},l=t.model().properties().symbolWatermarkProperties,h={renderer:o,update:function(){}};this.paneViews=function(t){return t.containsMainSeries()?(r=t,[h]):[]}}var n=i(199),s=i(230).translatedIntervalString;t.exports=o}).call(e,i(1))},function(t,e){"use strict";function i(){this.visible=!0,this.horzLinesVisible=!0,this.horzLinesColor="white",this.horzLinesStyle="",this.vertLinesVisible=!0,this.vertLinesColor="white",this.vertLinesStyle=""}function o(t,e){this.source=t,this.pane=e}function n(t){this.data=t}i.prototype.paneViews=function(t){return[new o(this,t)]},o.prototype.update=function(){},o.prototype.renderer=function(){var t={}
|
|
|
|
;return this.pane.defaultPriceScale().isEmpty()||this.pane.timeScale().isEmpty()?null:(t.horzLinesVisible=!0,t.vertLinesVisible=!0,t.horzLinesColor=this.pane._model.properties().paneProperties.horzGridProperties.color.value(),t.vertLinesColor=this.pane._model.properties().paneProperties.vertGridProperties.color.value(),t.horzLineStyle=this.pane._model.properties().paneProperties.horzGridProperties.style.value(),t.vertLineStyle=this.pane._model.properties().paneProperties.vertGridProperties.style.value(),t.priceMarks=this.pane.defaultPriceScale().marks(),t.timeMarks=this.pane.timeScale().marks(),t.w=this.pane.width(),t.h=this.pane.height(),new n(t))},n.prototype.draw=function(t){var e;if(t.lineWidth=1,this.data.vertLinesVisible){for(t.strokeStyle=this.data.vertLinesColor,CanvasEx.setLineStyle(t,this.data.vertLineStyle),t.beginPath(),e=0;e<this.data.timeMarks.length;e++)t.moveTo(this.data.timeMarks[e].coord+1,0),t.lineTo(this.data.timeMarks[e].coord+1,this.data.h);t.stroke()}if(this.data.horzLinesVisible){for(t.strokeStyle=this.data.horzLinesColor,CanvasEx.setLineStyle(t,this.data.horzLineStyle),t.beginPath(),e=0;e<this.data.priceMarks.length;e++)t.moveTo(0,this.data.priceMarks[e].coord),t.lineTo(this.data.w,this.data.priceMarks[e].coord);t.stroke()}},t.exports=i},function(t,e,i){"use strict";function o(t,e,i){this._magnetProperty=t,this._timeScale=e}var n=i(222);o.prototype.align=function(t,e,i){var o,s,r,a,l,h,c,d,p,u=50,_=i.defaultPriceScale(),f=_.priceToCoordinate(t),m=t;if(!this._magnetProperty.value())return m;for(o=_.dataSources(),s=null,r=0;r<o.length;r++)if(o[r]instanceof n){s=o[r];break}if(s&&(a=s.bars(),a.contains(e)&&(l=a.valueAt(e),h=[l[TradingView.OPEN_PLOT],l[TradingView.HIGH_PLOT],l[TradingView.LOW_PLOT],l[TradingView.CLOSE_PLOT]],_=s.priceScale(),!_.isEmpty()))){if(c=[],_.isPercent())for(d=s.firstValue(),r=0;r<h.length;r++)h[r]=_.priceRange().convertToPercent(h[r],d);for(r=0;r<h.length;r++)c.push({y:_.priceToCoordinate(h[r]),price:h[r]});c.sort(function(t,e){return Math.abs(t.y-f)-Math.abs(e.y-f)}),p=c[0],Math.abs(p.y-f)<u&&(m=p.price)}return m},t.exports=o},function(t,e,i){(function(e,o){"use strict";function n(){return[$.t("Jan"),$.t("Feb"),$.t("Mar"),$.t("Apr"),$.t("May"),$.t("Jun"),$.t("Jul"),$.t("Aug"),$.t("Sep"),$.t("Oct"),$.t("Nov"),$.t("Dec")]}function s(t){this._model=t,this._properties=t.properties().timeScale,this._scalesProperties=t.properties().scalesProperties,this.m_width=0,this._defaultRightOffset=this._properties.rightOffset.value(),this.m_rightOffset=this._properties.rightOffset.value(),this.m_points=new u,this.m_barSpacing=this._properties.barSpacing.value(),this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.m_tickmarks=new h,this._locked=!1,this._formattedBySpan={},this._onScroll=new e}var r=i(53),a=i(239),l=i(382),h=i(387),c=i(213),d=i(204).saveDefaultProperties,p=i(210).numberToStringWithLeadingZero,u=i(388),_=i(389),f=i(54).getLogger("Chart.TimeScale"),m=null,g=50,v=.5;s.prototype.tickMarks=function(){return this.m_tickmarks},
|
|
|
|
;return this.pane.defaultPriceScale().isEmpty()||this.pane.timeScale().isEmpty()?null:(t.horzLinesVisible=!0,t.vertLinesVisible=!0,t.horzLinesColor=this.pane._model.properties().paneProperties.horzGridProperties.color.value(),t.vertLinesColor=this.pane._model.properties().paneProperties.vertGridProperties.color.value(),t.horzLineStyle=this.pane._model.properties().paneProperties.horzGridProperties.style.value(),t.vertLineStyle=this.pane._model.properties().paneProperties.vertGridProperties.style.value(),t.priceMarks=this.pane.defaultPriceScale().marks(),t.timeMarks=this.pane.timeScale().marks(),t.w=this.pane.width(),t.h=this.pane.height(),new n(t))},n.prototype.draw=function(t){var e;if(t.lineWidth=1,this.data.vertLinesVisible){for(t.strokeStyle=this.data.vertLinesColor,CanvasEx.setLineStyle(t,this.data.vertLineStyle),t.beginPath(),e=0;e<this.data.timeMarks.length;e++)t.moveTo(this.data.timeMarks[e].coord+1,0),t.lineTo(this.data.timeMarks[e].coord+1,this.data.h);t.stroke()}if(this.data.horzLinesVisible){for(t.strokeStyle=this.data.horzLinesColor,CanvasEx.setLineStyle(t,this.data.horzLineStyle),t.beginPath(),e=0;e<this.data.priceMarks.length;e++)t.moveTo(0,this.data.priceMarks[e].coord),t.lineTo(this.data.w,this.data.priceMarks[e].coord);t.stroke()}},t.exports=i},function(t,e,i){"use strict";function o(t,e,i){this._magnetProperty=t,this._timeScale=e}var n=i(222);o.prototype.align=function(t,e,i){var o,s,r,a,l,h,c,d,p,u=50,_=i.defaultPriceScale(),f=_.priceToCoordinate(t),m=t;if(!this._magnetProperty.value())return m;for(o=_.dataSources(),s=null,r=0;r<o.length;r++)if(o[r]instanceof n){s=o[r];break}if(s&&(a=s.bars(),a.contains(e)&&(l=a.valueAt(e),h=[l[TradingView.OPEN_PLOT],l[TradingView.HIGH_PLOT],l[TradingView.LOW_PLOT],l[TradingView.CLOSE_PLOT]],_=s.priceScale(),!_.isEmpty()))){if(c=[],_.isPercent())for(d=s.firstValue(),r=0;r<h.length;r++)h[r]=_.priceRange().convertToPercent(h[r],d);for(r=0;r<h.length;r++)c.push({y:_.priceToCoordinate(h[r]),price:h[r]});c.sort(function(t,e){return Math.abs(t.y-f)-Math.abs(e.y-f)}),p=c[0],Math.abs(p.y-f)<u&&(m=p.price)}return m},t.exports=o},function(t,e,i){(function(e,o){"use strict";function n(){return[$.t("Jan"),$.t("Feb"),$.t("Mar"),$.t("Apr"),$.t("May"),$.t("Jun"),$.t("Jul"),$.t("Aug"),$.t("Sep"),$.t("Oct"),$.t("Nov"),$.t("Dec")]}function s(t){this._model=t,this._properties=t.properties().timeScale,this._scalesProperties=t.properties().scalesProperties,this.m_width=0,this._defaultRightOffset=this._properties.rightOffset.value(),this.m_rightOffset=this._properties.rightOffset.value(),this.m_points=new u,this.m_barSpacing=this._properties.barSpacing.value(),this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.m_tickmarks=new h,this._locked=!1,this._formattedBySpan={},this._onScroll=new e}var r=i(53),a=i(239),l=i(382),h=i(387),c=i(213),d=i(204).saveDefaultProperties,p=i(210).numberToStringWithLeadingZero,u=i(388),_=i(389),f=i(54).getLogger("Chart.TimeScale"),m=i(1),g=null,v=50,y=m.enabled("high_density_bars")?.025:.5
|
|
|
|
s.prototype.reset=function(){this._visibleBarsCache=null,this.m_points=new u,this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.m_tickmarks.reset()},s.prototype.restoreDefault=function(){this._visibleBarsCache=null,this.m_barSpacing=_.DEFAULT_BAR_SPACING,this.m_rightOffset=this._properties.rightOffset.value(),this.saveDefault("barSpacing"),this._correctOffset(),this.recalcLockedScale()},s.prototype.rightOffset=function(){return this.m_rightOffset},s.prototype.scrollToRealtime=function(t){var e,i,o,n,s=this._properties.rightOffset.value();if(t)return e=this,i=this.m_rightOffset,o=this.m_width/this.m_barSpacing-10,o>0&&s>o&&(s=o),n=this._model,void $({offset:i}).animate({offset:s},{duration:1e3,easing:"easeInOutQuint",step:function(t){e._visibleBarsCache=null,e.m_rightOffset=t,n.recalculateAllPanes(),n.invalidate(new c(c.LIGHT_UPDATE)),n.recalcVisibleRangeStudy(n.dataSources())}});this._visibleBarsCache=null,this.m_rightOffset=s,this._correctOffset()},s.prototype.points=function(){return this.m_points},s.prototype.width=function(){return this.m_width},s.prototype.barSpacing=function(){return this.m_barSpacing},s.prototype.setWidth=function(t){this._visibleBarsCache=null,!isFinite(t)||t<=0||(this._locked&&this.m_width&&(this.m_barSpacing*=t/this.m_width),this.m_width=t,this._correctOffset())},s.prototype.visibleBars=function(){var t,e,i,o;if(this._visibleBarsCache)return this._visibleBarsCache;if(!this.isEmpty())return t=Math.ceil(this.m_width/this.m_barSpacing)-1,e=Math.round(this.m_rightOffset+this.m_points.lastTimePointIndex()),i=e-t,o=new a(i,e),this._visibleBarsCache=o,o},s.prototype.isEmpty=function(){return 0===this.m_width||0===this.m_points.size()},s.prototype.indexToCoordinate=function(t,e){var i,o;return this.isEmpty()?0:TradingView.isInteger(t)?(i=this.m_points.lastTimePointIndex()+this.m_rightOffset-t,o=this.m_width-(i+.5)*this.m_barSpacing,e?o:Math.round(o)):0},s.prototype.barIndexesToCoordinates=function(t){var e,i,o,n;for(e=0;e<t.length;e++)i=t[e].time,o=this.m_points.lastTimePointIndex()+this.m_rightOffset-i,n=this.m_width-(o+.5)*this.m_barSpacing,t[e].time=Math.round(n),t[e].exactTime=n},s.prototype.indexesToCoordinates=function(t){var e,i,o,n=this.m_points.lastTimePointIndex()+this.m_rightOffset,s=this.m_width-n*this.m_barSpacing-.5*this.m_barSpacing;for(e=0;e<t.length;e++)i=t[e].x,o=s+i*this.m_barSpacing,t[e].x=Math.round(o)},s.prototype.coordinateToIndex=function(t){var e=(this.m_width+1-t)/this.m_barSpacing,i=this.m_points.lastTimePointIndex(),o=i+this.m_rightOffset-e,n=Math.round(1e6*o)/1e6;return Math.ceil(n)},s.prototype.timeToCoordinate=function(t){function e(t){return t<=0||t>=l.m_width}var i,o,n,s=this.m_points.closestIndexLeft(t),r=this.m_points.valueAt(s),a=this.indexToCoordinate(s,!0),l=this;return e(a)?null:(i=this.barSpacing(),o=function(){var t=this.m_points.lastTimePointIndex();return this.m_points.valueAt(t)-this.m_points.valueAt(t-1)}.bind(this)(),n=Math.round(a+(t-r)/o*i)+1,e(n)?null:n)},s.prototype.alignCoordinate=function(t){
|
|
|
|
;s.prototype.tickMarks=function(){return this.m_tickmarks},s.prototype.reset=function(){this._visibleBarsCache=null,this.m_points=new u,this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.m_tickmarks.reset()},s.prototype.restoreDefault=function(){this._visibleBarsCache=null,this.m_barSpacing=_.DEFAULT_BAR_SPACING,this.m_rightOffset=this._properties.rightOffset.value(),this.saveDefault("barSpacing"),this._correctOffset(),this.recalcLockedScale()},s.prototype.rightOffset=function(){return this.m_rightOffset},s.prototype.scrollToRealtime=function(t){var e,i,o,n,s=this._properties.rightOffset.value();if(t)return e=this,i=this.m_rightOffset,o=this.m_width/this.m_barSpacing-10,o>0&&s>o&&(s=o),n=this._model,void $({offset:i}).animate({offset:s},{duration:1e3,easing:"easeInOutQuint",step:function(t){e._visibleBarsCache=null,e.m_rightOffset=t,n.recalculateAllPanes(),n.invalidate(new c(c.LIGHT_UPDATE)),n.recalcVisibleRangeStudy(n.dataSources())}});this._visibleBarsCache=null,this.m_rightOffset=s,this._correctOffset()},s.prototype.points=function(){return this.m_points},s.prototype.width=function(){return this.m_width},s.prototype.barSpacing=function(){return this.m_barSpacing},s.prototype.setWidth=function(t){this._visibleBarsCache=null,!isFinite(t)||t<=0||(this._locked&&this.m_width&&(this.m_barSpacing*=t/this.m_width),this.m_width=t,this._correctOffset())},s.prototype.visibleBars=function(){var t,e,i,o;if(this._visibleBarsCache)return this._visibleBarsCache;if(!this.isEmpty())return t=Math.ceil(this.m_width/this.m_barSpacing)-1,e=Math.round(this.m_rightOffset+this.m_points.lastTimePointIndex()),i=e-t,o=new a(i,e),this._visibleBarsCache=o,o},s.prototype.isEmpty=function(){return 0===this.m_width||0===this.m_points.size()},s.prototype.indexToCoordinate=function(t,e){var i,o;return this.isEmpty()?0:TradingView.isInteger(t)?(i=this.m_points.lastTimePointIndex()+this.m_rightOffset-t,o=this.m_width-(i+.5)*this.m_barSpacing,e?o:Math.round(o)):0},s.prototype.barIndexesToCoordinates=function(t){var e,i,o,n;for(e=0;e<t.length;e++)i=t[e].time,o=this.m_points.lastTimePointIndex()+this.m_rightOffset-i,n=this.m_width-(o+.5)*this.m_barSpacing,t[e].time=Math.round(n),t[e].exactTime=n},s.prototype.indexesToCoordinates=function(t){var e,i,o,n=this.m_points.lastTimePointIndex()+this.m_rightOffset,s=this.m_width-n*this.m_barSpacing-.5*this.m_barSpacing;for(e=0;e<t.length;e++)i=t[e].x,o=s+i*this.m_barSpacing,t[e].x=Math.round(o)},s.prototype.coordinateToIndex=function(t){var e=(this.m_width+1-t)/this.m_barSpacing,i=this.m_points.lastTimePointIndex(),o=i+this.m_rightOffset-e,n=Math.round(1e6*o)/1e6;return Math.ceil(n)},s.prototype.timeToCoordinate=function(t){function e(t){return t<=0||t>=l.m_width}var i,o,n,s=this.m_points.closestIndexLeft(t),r=this.m_points.valueAt(s),a=this.indexToCoordinate(s,!0),l=this;return e(a)?null:(i=this.barSpacing(),o=function(){var t=this.m_points.lastTimePointIndex();return this.m_points.valueAt(t)-this.m_points.valueAt(t-1)}.bind(this)(),n=Math.round(a+(t-r)/o*i)+1,e(n)?null:n)},
|
|
|
|
if(this.isEmpty())return t;var e=this.coordinateToIndex(t);return this.indexToCoordinate(e)},s.prototype.timePointToIndex=function(t){return this.m_points.indexOf(t,!0)},s.prototype.indexToTimePoint=function(t){var e=this.m_points.valueAt(t);return e?new Date(1e3*e):null},s.prototype.indexToUserTime=function(t){return this.m_tickmarks.indexToTime(t)},s.prototype.marks=function(){var t,e,i,o,n,s,r,a,l,h,c,d;if(this.isEmpty())return null;for(t=this.m_barSpacing,e=this._scalesProperties.fontSize.value()||0,i=5*(e+4),o=Math.round(i/t),n=this.visibleBars(),s=Math.max(n.firstBar(),n.firstBar()-o),r=Math.max(n.lastBar(),n.lastBar()-o),a=this.m_tickmarks.build(t,i),l=[],h=0;h<a.length;++h)c=a[h],s<=c.index&&c.index<=r&&null!==(d=this.m_tickmarks.indexToTime(c.index))&&l.push({coord:this.indexToCoordinate(c.index),label:this.formatLabel(d,c.span),span:c.span,major:c.label>=_.DAY_SPAN?1:0});return l},s.prototype.state=function(t){var e={};return e.m_barSpacing=this.barSpacing(),e.m_rightOffset=this.m_rightOffset,t&&(this.m_points.size()>0&&(e.m_lastVisibleBar=this.m_points.valueAt(this.m_points.lastTimePointIndex())),e.points=this.m_points.state(),e.tickmarks=this.m_tickmarks.state(),e.width=this.m_width),e},s.prototype.restoreState=function(t,e,i){var o,n,s;return this._visibleBarsCache=null,void 0===t.m_barSpacing?void f.logDebug("TimeScale.restoreState: invalid state"):void 0===t.m_rightOffset?void f.logDebug("TimeScale.restoreState: invalid state"):(this.m_barSpacing=t.m_barSpacing,this.m_rightOffset=t.m_rightOffset,this.m_restoredLastTimePoint=t.m_lastVisibleBar,i&&this.m_restoredLastTimePoint&&(o=this.m_points.indexOf(this.m_restoredLastTimePoint),n=this.m_points.lastTimePointIndex(),s=n-o,this.m_rightOffset=-s+t.m_rightOffset),e&&(this.m_points.restoreState(t.points),this.m_tickmarks.restoreState(t.tickmarks),t.width&&(this._locked=!0,this.m_width>0&&(this.m_barSpacing*=this.m_width/t.width))),void this._correctOffset())},s.prototype.setOffset=function(t){if(this._visibleBarsCache=null,void 0===t)return void f.logDebug("TimeScale.setOffset: invalid state");this.m_rightOffset=t,this._correctOffset()},s.prototype.setBarSpacing=function(t){if(this._visibleBarsCache=null,void 0===t)return void f.logDebug("TimeScale.setBarSpacing: invalid state");this.m_barSpacing=t},s.prototype._correctOffset=function(){if(!this.isEmpty()){var t=this.m_width/this.m_barSpacing-10;t>0&&this.m_rightOffset>t&&(this.m_rightOffset=t,this._visibleBarsCache=null),t=this.m_points.size()-10,this.m_rightOffset<-t&&(this.m_rightOffset=-t,this._visibleBarsCache=null)}},s.prototype.maxOffset=function(){return this.m_width/this.m_barSpacing-10},s.prototype.startScale=function(t){this.m_scrollStartPoint&&this.endScroll(),null===this.m_scaleStartPoint&&null===this.m_stateSnapshot&&(this.isEmpty()||(this.m_scaleStartPoint=t,this.m_stateSnapshot=this.state()))},s.prototype.scaleTo=function(t){var e,i;this._visibleBarsCache=null,delete this.m_restoredLastTimePoint,null!==this.m_stateSnapshot&&(e=r.clamp(this.m_width-t,0,this.m_width),
|
|
|
|
s.prototype.alignCoordinate=function(t){if(this.isEmpty())return t;var e=this.coordinateToIndex(t);return this.indexToCoordinate(e)},s.prototype.timePointToIndex=function(t){return this.m_points.indexOf(t,!0)},s.prototype.indexToTimePoint=function(t){var e=this.m_points.valueAt(t);return e?new Date(1e3*e):null},s.prototype.indexToUserTime=function(t){return this.m_tickmarks.indexToTime(t)},s.prototype.marks=function(){var t,e,i,o,n,s,r,a,l,h,c,d;if(this.isEmpty())return null;for(t=this.m_barSpacing,e=this._scalesProperties.fontSize.value()||0,i=5*(e+4),o=Math.round(i/t),n=this.visibleBars(),s=Math.max(n.firstBar(),n.firstBar()-o),r=Math.max(n.lastBar(),n.lastBar()-o),a=this.m_tickmarks.build(t,i),l=[],h=0;h<a.length;++h)c=a[h],s<=c.index&&c.index<=r&&null!==(d=this.m_tickmarks.indexToTime(c.index))&&l.push({coord:this.indexToCoordinate(c.index),label:this.formatLabel(d,c.span),span:c.span,major:c.label>=_.DAY_SPAN?1:0});return l},s.prototype.state=function(t){var e={};return e.m_barSpacing=this.barSpacing(),e.m_rightOffset=this.m_rightOffset,t&&(this.m_points.size()>0&&(e.m_lastVisibleBar=this.m_points.valueAt(this.m_points.lastTimePointIndex())),e.points=this.m_points.state(),e.tickmarks=this.m_tickmarks.state(),e.width=this.m_width),e},s.prototype.restoreState=function(t,e,i){var o,n,s;return this._visibleBarsCache=null,void 0===t.m_barSpacing?void f.logDebug("TimeScale.restoreState: invalid state"):void 0===t.m_rightOffset?void f.logDebug("TimeScale.restoreState: invalid state"):(this.m_barSpacing=t.m_barSpacing,this.m_rightOffset=t.m_rightOffset,this.m_restoredLastTimePoint=t.m_lastVisibleBar,i&&this.m_restoredLastTimePoint&&(o=this.m_points.indexOf(this.m_restoredLastTimePoint),n=this.m_points.lastTimePointIndex(),s=n-o,this.m_rightOffset=-s+t.m_rightOffset),e&&(this.m_points.restoreState(t.points),this.m_tickmarks.restoreState(t.tickmarks),t.width&&(this._locked=!0,this.m_width>0&&(this.m_barSpacing*=this.m_width/t.width))),void this._correctOffset())},s.prototype.setOffset=function(t){if(this._visibleBarsCache=null,void 0===t)return void f.logDebug("TimeScale.setOffset: invalid state");this.m_rightOffset=t,this._correctOffset()},s.prototype.setBarSpacing=function(t){if(this._visibleBarsCache=null,void 0===t)return void f.logDebug("TimeScale.setBarSpacing: invalid state");this.m_barSpacing=t},s.prototype._correctOffset=function(){if(!this.isEmpty()){var t=this.m_width/this.m_barSpacing-10;t>0&&this.m_rightOffset>t&&(this.m_rightOffset=t,this._visibleBarsCache=null),t=this.m_points.size()-10,this.m_rightOffset<-t&&(this.m_rightOffset=-t,this._visibleBarsCache=null)}},s.prototype.maxOffset=function(){return this.m_width/this.m_barSpacing-10},s.prototype.startScale=function(t){this.m_scrollStartPoint&&this.endScroll(),null===this.m_scaleStartPoint&&null===this.m_stateSnapshot&&(this.isEmpty()||(this.m_scaleStartPoint=t,this.m_stateSnapshot=this.state()))},s.prototype.scaleTo=function(t){var e,i;this._visibleBarsCache=null,delete this.m_restoredLastTimePoint,
|
|
|
|
i=r.clamp(this.m_width-this.m_scaleStartPoint,0,this.m_width),0!==e&&0!==i&&(this.m_barSpacing=this.m_stateSnapshot.m_barSpacing*e/i,this.m_barSpacing<v?this.m_barSpacing=v:this.m_barSpacing>g&&(this.m_barSpacing=g),this._correctOffset(),this.recalcLockedScale()))},s.prototype.endScale=function(){null!==this.m_scaleStartPoint&&(this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.saveDefault("barSpacing"))},s.prototype.saveDefault=function(t){d(!0),this._properties[t].setValue(this["m_"+t]),d(!1)},s.prototype.startScroll=function(t){null===this.m_scrollStartPoint&&null===this.m_stateSnapshot&&(this.isEmpty()||(this.m_scrollStartPoint=t,this.m_stateSnapshot=this.state()))},s.prototype.scrollTo=function(t){if(this._visibleBarsCache=null,delete this.m_restoredLastTimePoint,null!==this.m_scrollStartPoint){var e=(this.m_scrollStartPoint-t)/this.barSpacing();this.m_rightOffset=this.m_stateSnapshot.m_rightOffset+e,this._correctOffset(),this._model.mainSeries().priceScale().properties().percentage.value()&&this.recalcLockedScale(),this._onScroll.fire()}},s.prototype.scrollToOffsetAnimated=function(t,e){var i,o,n,s;if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(void 0===e&&(e=400),!isFinite(e)||e<=0)throw new RangeError("animationDuration (optional) must be finite positive number");i=this,o=this.m_rightOffset,n=+new Date,s=this._model,function r(){i._visibleBarsCache=null;var a=(new Date-n)/e;if(a>=1)return i.m_rightOffset=t,i._visibleBarsCache=null,s.recalculateAllPanes(),void s.invalidate(new c(c.LIGHT_UPDATE));i.m_rightOffset=o+(t-o)*a,s.recalculateAllPanes(),setTimeout(r,20)}()},s.prototype.endScroll=function(){null!==this.m_scrollStartPoint&&(this.m_scrollStartPoint=null,this.m_stateSnapshot=null)},s.prototype._currentSavedPosition=function(){var t,e,i;this.isEmpty()||(t=this.m_points.indexOf(this.m_restoredLastTimePoint,!0),TradingView.isInteger(t)&&(e=this.m_points.lastTimePointIndex(),i=e-t,this.m_rightOffset-=i),delete this.m_restoredLastTimePoint)},s.prototype.update=function(t,e,i,o){this._visibleBarsCache=null,this.m_tickmarks.merge(o),this.m_points.merge(t,e,i),this.m_restoredLastTimePoint&&this._currentSavedPosition()},s.prototype.addTail=function(t,e,i){var o,n,s;for(this.m_tickmarks.removeTail(e),o=t.params,n=this.m_tickmarks.maxIndex+(i?0:1),s=0;s<o.marks.length;s++)o.marks[s].index=n+s;this.m_tickmarks.addTail(o.marks),this.m_points.addTail(o.changes,i),this.m_rightOffset-=o.changes.length},s.prototype.formatLabel=function(t,e){if(this._formattedBySpan[e])return this._formattedBySpan[e].format(t.valueOf());var i=this;return this._formattedBySpan[e]=new l(function(t){return i.formatLabelImpl(new Date(t),e)}),this._formattedBySpan[e].format(t)},s.prototype.formatLabelImpl=function(t,e){if(!(t&&t instanceof Date))return"incorrect time";var i=this._model.mainSeries().isDWM()
|
|
|
|
null!==this.m_stateSnapshot&&(e=r.clamp(this.m_width-t,0,this.m_width),i=r.clamp(this.m_width-this.m_scaleStartPoint,0,this.m_width),0!==e&&0!==i&&(this.m_barSpacing=this.m_stateSnapshot.m_barSpacing*e/i,this.m_barSpacing<y?this.m_barSpacing=y:this.m_barSpacing>v&&(this.m_barSpacing=v),this._correctOffset(),this.recalcLockedScale()))},s.prototype.endScale=function(){null!==this.m_scaleStartPoint&&(this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.saveDefault("barSpacing"))},s.prototype.saveDefault=function(t){d(!0),this._properties[t].setValue(this["m_"+t]),d(!1)},s.prototype.startScroll=function(t){null===this.m_scrollStartPoint&&null===this.m_stateSnapshot&&(this.isEmpty()||(this.m_scrollStartPoint=t,this.m_stateSnapshot=this.state()))},s.prototype.scrollTo=function(t){if(this._visibleBarsCache=null,delete this.m_restoredLastTimePoint,null!==this.m_scrollStartPoint){var e=(this.m_scrollStartPoint-t)/this.barSpacing();this.m_rightOffset=this.m_stateSnapshot.m_rightOffset+e,this._correctOffset(),this._model.mainSeries().priceScale().properties().percentage.value()&&this.recalcLockedScale(),this._onScroll.fire()}},s.prototype.scrollToOffsetAnimated=function(t,e){var i,o,n,s;if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(void 0===e&&(e=400),!isFinite(e)||e<=0)throw new RangeError("animationDuration (optional) must be finite positive number");i=this,o=this.m_rightOffset,n=+new Date,s=this._model,function r(){i._visibleBarsCache=null;var a=(new Date-n)/e;if(a>=1)return i.m_rightOffset=t,i._visibleBarsCache=null,s.recalculateAllPanes(),void s.invalidate(new c(c.LIGHT_UPDATE));i.m_rightOffset=o+(t-o)*a,s.recalculateAllPanes(),setTimeout(r,20)}()},s.prototype.endScroll=function(){null!==this.m_scrollStartPoint&&(this.m_scrollStartPoint=null,this.m_stateSnapshot=null)},s.prototype._currentSavedPosition=function(){var t,e,i;this.isEmpty()||(t=this.m_points.indexOf(this.m_restoredLastTimePoint,!0),TradingView.isInteger(t)&&(e=this.m_points.lastTimePointIndex(),i=e-t,this.m_rightOffset-=i),delete this.m_restoredLastTimePoint)},s.prototype.update=function(t,e,i,o){this._visibleBarsCache=null,this.m_tickmarks.merge(o),this.m_points.merge(t,e,i),this.m_restoredLastTimePoint&&this._currentSavedPosition()},s.prototype.addTail=function(t,e,i){var o,n,s;for(this.m_tickmarks.removeTail(e),o=t.params,n=this.m_tickmarks.maxIndex+(i?0:1),s=0;s<o.marks.length;s++)o.marks[s].index=n+s;this.m_tickmarks.addTail(o.marks),this.m_points.addTail(o.changes,i),this.m_rightOffset-=o.changes.length},s.prototype.formatLabel=function(t,e){if(this._formattedBySpan[e])return this._formattedBySpan[e].format(t.valueOf());var i=this;return this._formattedBySpan[e]=new l(function(t){return i.formatLabelImpl(new Date(t),e)}),this._formattedBySpan[e].format(t)},s.prototype.formatLabelImpl=function(t,e){if(!(t&&t instanceof Date))return"incorrect time";var i=this._model.mainSeries().isDWM()
|
|
|
|
;return e<_.MINUTE_SPAN&&!i?p(t.getUTCHours(),2)+":"+p(t.getUTCMinutes(),2)+":"+p(t.getUTCSeconds(),2):e<_.DAY_SPAN&&!i?p(t.getUTCHours(),2)+":"+p(t.getUTCMinutes(),2):e<_.WEEK_SPAN?t.getUTCDate():e<_.MONTH_SPAN?t.getUTCDate():e<_.YEAR_SPAN?(m||(m=n()),m[t.getUTCMonth()]):t.getUTCFullYear()},s.prototype.normalizeBarIndex=function(t){var e=0,i=0;return t<this.m_points.firstTimePointIndex()?(e=this.m_points.valueAt(this.m_points.firstTimePointIndex()),i=t-this.m_points.firstTimePointIndex()):t>this.m_points.lastTimePointIndex()?(e=this.m_points.valueAt(this.m_points.lastTimePointIndex()),i=t-this.m_points.lastTimePointIndex()):(e=this.m_points.valueAt(t),i=0),{time_t:e,offset:i}},s.prototype.denormalizeTimePoint=function(t){var e=this.m_points.indexOf(t.time_t);if(void 0!==e)return e+t.offset},s.prototype.zoomToBarsRange=function(t,e){if(!(e<=t)){var i=this.m_points.lastTimePointIndex();i&&(this.m_rightOffset=e-i),this.m_barSpacing=this.width()/(e-t+1),this._visibleBarsCache=null}},s.prototype.recalcLockedScale=function(){var t,e,i,n,s,r,a,l;this._model.m_mainSeries.properties().lockScale.value()&&!this.isEmpty()&&(t=this._model.m_mainSeries.priceScale(),e=this._model.m_mainSeries,i=e.data().boxSize,i||(e.fixBoxSize(),i=e.data().boxSize),i&&(t.properties().percentage.value()&&(n=e.data().search(e.getRealVisibleRange().m_firstBar).value[TradingView.CLOSE_PLOT],i=o.prototype.convertToPercent.call(null,n+i,n)-o.prototype.convertToPercent.call(null,n,n)),s=t.internalHeight()/(this.barSpacing()/i),(r=e.priceScale().priceRange())&&s===r.length()||(!r||r.isEmpty()?(a=this.visibleBars(),r=e.priceRange(a.firstBar(),a.lastBar())):(l=(s-r.length())/2,r.set(r.minValue()-l,r.maxValue()+l)),e.priceScale().setPriceRange(r))))},s.prototype.correctBarSpacing=function(){this.isEmpty()||this.points().size()<this.width()/this.barSpacing()&&(this.setOffset(_.DEFAULT_RIGHT_OFFSET),this.setBarSpacing(Math.min(this.width()/(this.points().size()+this.rightOffset()),g)))},s.prototype.canZoomIn=function(){return this.m_barSpacing<g},s.prototype.canZoomOut=function(){return this.m_barSpacing>v},s.prototype.onScroll=function(){return this._onScroll},t.exports=s}).call(e,i(56),i(223))},function(t,e,i){(function(e){"use strict";function i(){this._marksByIndex={},this._marksBySpan=[],this.changed=new e}i.prototype.reset=function(){this._marksByIndex={},this._marksBySpan=[],delete this.minIndex,delete this.maxIndex,delete this._cache,this.changed.fire()},i.prototype.minIndex=void 0,i.prototype.maxIndex=void 0,i.prototype.merge=function(t){var e,i,o,n,s,r=this._marksBySpan,a={};for(e=0;e<t.length;e++){if(i=t[e],o=i.index,n=i.span,s=this._marksByIndex[i.index]){if(s.index===i.index&&s.span===i.span){s.time=i.time;continue}this._removeTickmark(s)}this._marksByIndex[o]=i,this.minIndex<=o||(this.minIndex=o),this.maxIndex>=o||(this.maxIndex=o),r[n]||(r[n]=[]),r[n].push(i),a[n]=!0}for(n=r.length;n--;)r[n]&&(r[n].length||delete r[n],a[n]&&r[n].sort(this._sortByIndexAsc));delete this._cache,this.changed.fire()},i.prototype._removeTickmark=function(t){
|
|
|
|
;return e<_.MINUTE_SPAN&&!i?p(t.getUTCHours(),2)+":"+p(t.getUTCMinutes(),2)+":"+p(t.getUTCSeconds(),2):e<_.DAY_SPAN&&!i?p(t.getUTCHours(),2)+":"+p(t.getUTCMinutes(),2):e<_.WEEK_SPAN?t.getUTCDate():e<_.MONTH_SPAN?t.getUTCDate():e<_.YEAR_SPAN?(g||(g=n()),g[t.getUTCMonth()]):t.getUTCFullYear()},s.prototype.normalizeBarIndex=function(t){var e=0,i=0;return t<this.m_points.firstTimePointIndex()?(e=this.m_points.valueAt(this.m_points.firstTimePointIndex()),i=t-this.m_points.firstTimePointIndex()):t>this.m_points.lastTimePointIndex()?(e=this.m_points.valueAt(this.m_points.lastTimePointIndex()),i=t-this.m_points.lastTimePointIndex()):(e=this.m_points.valueAt(t),i=0),{time_t:e,offset:i}},s.prototype.denormalizeTimePoint=function(t){var e=this.m_points.indexOf(t.time_t);if(void 0!==e)return e+t.offset},s.prototype.zoomToBarsRange=function(t,e){if(!(e<=t)){var i=this.m_points.lastTimePointIndex();i&&(this.m_rightOffset=e-i),this.m_barSpacing=this.width()/(e-t+1),this._visibleBarsCache=null}},s.prototype.recalcLockedScale=function(){var t,e,i,n,s,r,a,l;this._model.m_mainSeries.properties().lockScale.value()&&!this.isEmpty()&&(t=this._model.m_mainSeries.priceScale(),e=this._model.m_mainSeries,i=e.data().boxSize,i||(e.fixBoxSize(),i=e.data().boxSize),i&&(t.properties().percentage.value()&&(n=e.data().search(e.getRealVisibleRange().m_firstBar).value[TradingView.CLOSE_PLOT],i=o.prototype.convertToPercent.call(null,n+i,n)-o.prototype.convertToPercent.call(null,n,n)),s=t.internalHeight()/(this.barSpacing()/i),(r=e.priceScale().priceRange())&&s===r.length()||(!r||r.isEmpty()?(a=this.visibleBars(),r=e.priceRange(a.firstBar(),a.lastBar())):(l=(s-r.length())/2,r.set(r.minValue()-l,r.maxValue()+l)),e.priceScale().setPriceRange(r))))},s.prototype.correctBarSpacing=function(){this.isEmpty()||this.points().size()<this.width()/this.barSpacing()&&(this.setOffset(_.DEFAULT_RIGHT_OFFSET),this.setBarSpacing(Math.min(this.width()/(this.points().size()+this.rightOffset()),v)))},s.prototype.canZoomIn=function(){return this.m_barSpacing<v},s.prototype.canZoomOut=function(){return this.m_barSpacing>y},s.prototype.onScroll=function(){return this._onScroll},t.exports=s}).call(e,i(56),i(223))},function(t,e,i){(function(e){"use strict";function i(){this._marksByIndex={},this._marksBySpan=[],this.changed=new e}i.prototype.reset=function(){this._marksByIndex={},this._marksBySpan=[],delete this.minIndex,delete this.maxIndex,delete this._cache,this.changed.fire()},i.prototype.minIndex=void 0,i.prototype.maxIndex=void 0,i.prototype.merge=function(t){var e,i,o,n,s,r=this._marksBySpan,a={};for(e=0;e<t.length;e++){if(i=t[e],o=i.index,n=i.span,s=this._marksByIndex[i.index]){if(s.index===i.index&&s.span===i.span){s.time=i.time;continue}this._removeTickmark(s)}this._marksByIndex[o]=i,this.minIndex<=o||(this.minIndex=o),this.maxIndex>=o||(this.maxIndex=o),r[n]||(r[n]=[]),r[n].push(i),a[n]=!0}for(n=r.length;n--;)r[n]&&(r[n].length||delete r[n],a[n]&&r[n].sort(this._sortByIndexAsc));delete this._cache,this.changed.fire()},i.prototype._removeTickmark=function(t){
|
|
|
|
var e,i,o=t.index;this._marksByIndex[o]===t&&(delete this._marksByIndex[o],o<=this.minIndex&&this.minIndex++,o>=this.maxIndex&&this.maxIndex--,this.maxIndex<this.minIndex&&(delete this.minIndex,delete this.maxIndex),e=this._marksBySpan[t.span],-1!==(i=e.indexOf(t))&&e.splice(i,1))},i.prototype._sortByIndexAsc=function(t,e){return t.index-e.index},i.prototype.removeTail=function(t){var e,i={};this.maxIndex=0;for(e in this._marksByIndex)this._marksByIndex[e].time<t&&(i[e]=this._marksByIndex[e],this.maxIndex=Math.max(this.maxIndex,e));this._marksByIndex=i},i.prototype.addTail=function(t){for(var e=0;e<t.length;e++)t[e].index=this.maxIndex+e+1;this.merge(t)},i.prototype.indexToTime=function(t){var e=this._marksByIndex[t];return e?new Date(1e3*e.time):null},i.prototype.density=function(){var t,e=this.maxIndex-this.minIndex;if(0!==e)return t=this._marksByIndex[this.maxIndex].time-this._marksByIndex[this.minIndex].time,1e3*t/e},i.prototype.estimateLeft=function(t){var e,i=this.density();if(i)return e=1e3*this._marksByIndex[this.minIndex].time-t,e/i},i.prototype.nearestIndex=function(t){for(var e,i=this.minIndex,o=this.maxIndex;o-i>2;){if(1e3*this._marksByIndex[i].time===t)return i;if(1e3*this._marksByIndex[o].time===t)return o;e=Math.round((i+o)/2),1e3*this._marksByIndex[e].time>t?o=e:i=e}return i},i.prototype.build=function(t,e){var i,o,n,s,r,a,l,h,c,d,p,u,_,f,m=Math.ceil(e/t);if(this._maxbar===m&&this._cache)return this._cache;for(this._maxbar=m,i=[],o=this._marksBySpan.length;o--;)if(this._marksBySpan[o]){for(n=i,i=[],s=n.length,r=0,a=this._marksBySpan[o],l=a.length,h=1/0,c=-1/0,d=0;d<l;d++){for(p=a[d],u=p.index;r<s;){if(_=n[r],!((f=_.index)<u)){h=f;break}r++,i.push(_),c=f,h=1/0}h-u>=m&&u-c>=m&&(i.push(p),c=u)}for(;r<s;r++)i.push(n[r])}return this._cache=i,this._cache},i.prototype.state=function(){var t,e=[];for(t=this._marksBySpan.length;t--;)this._marksBySpan[t]&&(e=e.concat(this._marksBySpan[t]));return e=e.map(function(t){return[t.span,t.time,t.index]}),{marks:e,version:2}},i.prototype.restoreState=function(t){if(this._marksByIndex={},this._marksBySpan=[],delete this.maxIndex,delete this.minIndex,t&&t.marks&&t.marks.length)if(2===t.version){var e=t.marks.map(function(t){return{span:t[0],time:t[1],index:t[2]}});this.merge(e)}else this.merge(t.marks)},t.exports=i}).call(e,i(56))},function(t,e){"use strict";function i(){this._zoffset=0,this._items=[],this._lastTimePointIndex=null}i.prototype.clear=function(){this._zoffset=0,this._items=[],this._lastTimePointIndex=null},i.prototype.items=function(){return this._items},i.prototype.size=function(){return this._items.length},i.prototype.firstTimePointIndex=function(){return this.offsetToIndex(0)},i.prototype.lastTimePointIndex=function(){return null!==this._lastTimePointIndex&&void 0!==this._lastTimePointIndex?this._lastTimePointIndex:(this._lastTimePointIndex=this.offsetToIndex(this.size()-1),this._lastTimePointIndex)},i.prototype.merge=function(t,e,i){var o,n,s,r,a,l,h;if(0===this._items.length)return this._items=i,this._zoffset=e,[{change:"rebuild",index:0}]
|
|
|
|
var e,i,o=t.index;this._marksByIndex[o]===t&&(delete this._marksByIndex[o],o<=this.minIndex&&this.minIndex++,o>=this.maxIndex&&this.maxIndex--,this.maxIndex<this.minIndex&&(delete this.minIndex,delete this.maxIndex),e=this._marksBySpan[t.span],-1!==(i=e.indexOf(t))&&e.splice(i,1))},i.prototype._sortByIndexAsc=function(t,e){return t.index-e.index},i.prototype.removeTail=function(t){var e,i={};this.maxIndex=0;for(e in this._marksByIndex)this._marksByIndex[e].time<t&&(i[e]=this._marksByIndex[e],this.maxIndex=Math.max(this.maxIndex,e));this._marksByIndex=i},i.prototype.addTail=function(t){for(var e=0;e<t.length;e++)t[e].index=this.maxIndex+e+1;this.merge(t)},i.prototype.indexToTime=function(t){var e=this._marksByIndex[t];return e?new Date(1e3*e.time):null},i.prototype.density=function(){var t,e=this.maxIndex-this.minIndex;if(0!==e)return t=this._marksByIndex[this.maxIndex].time-this._marksByIndex[this.minIndex].time,1e3*t/e},i.prototype.estimateLeft=function(t){var e,i=this.density();if(i)return e=1e3*this._marksByIndex[this.minIndex].time-t,e/i},i.prototype.nearestIndex=function(t){for(var e,i=this.minIndex,o=this.maxIndex;o-i>2;){if(1e3*this._marksByIndex[i].time===t)return i;if(1e3*this._marksByIndex[o].time===t)return o;e=Math.round((i+o)/2),1e3*this._marksByIndex[e].time>t?o=e:i=e}return i},i.prototype.build=function(t,e){var i,o,n,s,r,a,l,h,c,d,p,u,_,f,m=Math.ceil(e/t);if(this._maxbar===m&&this._cache)return this._cache;for(this._maxbar=m,i=[],o=this._marksBySpan.length;o--;)if(this._marksBySpan[o]){for(n=i,i=[],s=n.length,r=0,a=this._marksBySpan[o],l=a.length,h=1/0,c=-1/0,d=0;d<l;d++){for(p=a[d],u=p.index;r<s;){if(_=n[r],!((f=_.index)<u)){h=f;break}r++,i.push(_),c=f,h=1/0}h-u>=m&&u-c>=m&&(i.push(p),c=u)}for(;r<s;r++)i.push(n[r])}return this._cache=i,this._cache},i.prototype.state=function(){var t,e=[];for(t=this._marksBySpan.length;t--;)this._marksBySpan[t]&&(e=e.concat(this._marksBySpan[t]));return e=e.map(function(t){return[t.span,t.time,t.index]}),{marks:e,version:2}},i.prototype.restoreState=function(t){if(this._marksByIndex={},this._marksBySpan=[],delete this.maxIndex,delete this.minIndex,t&&t.marks&&t.marks.length)if(2===t.version){var e=t.marks.map(function(t){return{span:t[0],time:t[1],index:t[2]}});this.merge(e)}else this.merge(t.marks)},t.exports=i}).call(e,i(56))},function(t,e){"use strict";function i(){this._zoffset=0,this._items=[],this._lastTimePointIndex=null}i.prototype.clear=function(){this._zoffset=0,this._items=[],this._lastTimePointIndex=null},i.prototype.items=function(){return this._items},i.prototype.size=function(){return this._items.length},i.prototype.firstTimePointIndex=function(){return this.offsetToIndex(0)},i.prototype.lastTimePointIndex=function(){return null!==this._lastTimePointIndex&&void 0!==this._lastTimePointIndex?this._lastTimePointIndex:(this._lastTimePointIndex=this.offsetToIndex(this.size()-1),this._lastTimePointIndex)},i.prototype.merge=function(t,e,i){var o,n,s,r,a,l,h;if(0===this._items.length)return this._items=i,this._zoffset=e,[{change:"rebuild",index:0}]
|
|
|
|
;if((o=t+this._zoffset)<0){for(n=Math.abs(o),this._items=Array(n).concat(this._items),this._zoffset=e,s=0;s<i.length;++s)this._items[t+s+e]=i[s];return[{change:"rebuild",index:0}]}for(r=[],s=o;s<this._items.length&&s-o<i.length;++s)this._items[s]=i[s-o],r.push({change:"update",index:s-this._zoffset,value:i[s-o]});if((a=o+i.length)>this._items.length)for(n=a-this._items.length,l=s;l<s+n;++l)h=this._items.length,this._items.push(i[l-o]),r.push({change:"append",index:h-this._zoffset,value:i[l-o]});return this._zoffset=e,this._lastTimePointIndex=null,r},i.prototype.addTail=function(t,e){for(var i=e?1:0;i<t.length;i++)this._items.push(t[i]),this._lastTimePointIndex++},i.prototype.valueAt=function(t){var e=this.indexToOffset(t);if(void 0!==e)return this._items[e]},i.prototype.indexOf=function(t,e){if(e&&t>this._items[this._items.length-1])return this.offsetToIndex(this._items.length-1);for(var i=0;i<this._items.length&&!(t<this._items[i]);++i)if(!(t>this._items[i]))return this.offsetToIndex(i);return e?this.offsetToIndex(i):void 0},i.prototype.offsetToIndex=function(t){if(0<=t&&t<this.size())return t-this._zoffset},i.prototype.indexToOffset=function(t){var e=t+this._zoffset;if(0<=e&&e<this.size())return e},i.prototype.state=function(){var t={};return t.zoffset=this._zoffset,t.items=this._items,t},i.prototype.restoreState=function(t){t&&(this._zoffset=t.zoffset,this._items=t.items,this._lastTimePointIndex=null)},i.prototype.roughTime=function(t,e){var i,o,n,s,r,a,l,h,c,d=this.valueAt(t);if(void 0===d){if(i=this._items,!i.length||i.length<2)return;if(o=this.firstTimePointIndex(),n=this.lastTimePointIndex(),s=this.valueAt(o),r=this.valueAt(n),a=(r-s)/(n-o),t<o)return l=o-t,h=l*a,d=s-h;if(c=500,t>n)return(l=t-n)<c&&e?e(r,l):(h=l*a,d=r+h)}return d},i.prototype.roughIndex=function(t,e){var i,o,n,s,r,a,l,h,c,d=this._items;if(d.length&&!(d.length<2))return i=this.firstTimePointIndex(),o=this.lastTimePointIndex(),n=this.valueAt(i),s=this.valueAt(o),t>=n&&t<=s?this.closestIndexLeft(t):(r=(s-n)/(o-i),t<n?(a=n-t,l=Math.round(a/r),i-l):(h=500,t>s?(a=t-s,l=Math.trunc(a/r),l<h&&e&&(c=e(s,t),c.success&&(l=c.result)),o+l):void 0))},i.prototype.closestIndexLeft=function(t){var e,i,o,n,s,r,a=this._items;if(a.length&&t===t){if(e=a.length-1,i=a[e],t>=i)return e-this._zoffset;if(o=0,n=a[o],!(t<n)){if(t===n)return o-this._zoffset;for(;e>o+1;)if(s=o+e>>1,(r=a[s])>t)e=s;else{if(!(r<t))return r===t?s-this._zoffset:void 0;o=s}return o-this._zoffset}}},t.exports=i},function(t,e){"use strict";e.MINUTE_SPAN=20,e.HOUR_SPAN=30,e.DAY_SPAN=40,e.WEEK_SPAN=50,e.MONTH_SPAN=60,e.YEAR_SPAN=70,e.DEFAULT_BAR_SPACING=6,e.DEFAULT_RIGHT_OFFSET=5},function(t,e,i){"use strict";function o(t){a.call(this,t);var e=this;l.hideMarksOnBars().subscribe(this,function(){e._properties.visible.setValue(!l.hideMarksOnBars().value())}),this._paneView=new n(this)}function n(t,e){this.source=t,this._rendererFactory=e,this.stylesCache={},this.templatesCache={},this._lollipops={},this._createLollipops()}
|
|
|
|
;if((o=t+this._zoffset)<0){for(n=Math.abs(o),this._items=Array(n).concat(this._items),this._zoffset=e,s=0;s<i.length;++s)this._items[t+s+e]=i[s];return[{change:"rebuild",index:0}]}for(r=[],s=o;s<this._items.length&&s-o<i.length;++s)this._items[s]=i[s-o],r.push({change:"update",index:s-this._zoffset,value:i[s-o]});if((a=o+i.length)>this._items.length)for(n=a-this._items.length,l=s;l<s+n;++l)h=this._items.length,this._items.push(i[l-o]),r.push({change:"append",index:h-this._zoffset,value:i[l-o]});return this._zoffset=e,this._lastTimePointIndex=null,r},i.prototype.addTail=function(t,e){for(var i=e?1:0;i<t.length;i++)this._items.push(t[i]),this._lastTimePointIndex++},i.prototype.valueAt=function(t){var e=this.indexToOffset(t);if(void 0!==e)return this._items[e]},i.prototype.indexOf=function(t,e){if(e&&t>this._items[this._items.length-1])return this.offsetToIndex(this._items.length-1);for(var i=0;i<this._items.length&&!(t<this._items[i]);++i)if(!(t>this._items[i]))return this.offsetToIndex(i);return e?this.offsetToIndex(i):void 0},i.prototype.offsetToIndex=function(t){if(0<=t&&t<this.size())return t-this._zoffset},i.prototype.indexToOffset=function(t){var e=t+this._zoffset;if(0<=e&&e<this.size())return e},i.prototype.state=function(){var t={};return t.zoffset=this._zoffset,t.items=this._items,t},i.prototype.restoreState=function(t){t&&(this._zoffset=t.zoffset,this._items=t.items,this._lastTimePointIndex=null)},i.prototype.roughTime=function(t,e){var i,o,n,s,r,a,l,h,c,d=this.valueAt(t);if(void 0===d){if(i=this._items,!i.length||i.length<2)return;if(o=this.firstTimePointIndex(),n=this.lastTimePointIndex(),s=this.valueAt(o),r=this.valueAt(n),a=(r-s)/(n-o),t<o)return l=o-t,h=l*a,d=s-h;if(c=500,t>n)return(l=t-n)<c&&e?e(r,l):(h=l*a,d=r+h)}return d},i.prototype.roughIndex=function(t,e){var i,o,n,s,r,a,l,h,c,d=this._items;if(d.length&&!(d.length<2))return i=this.firstTimePointIndex(),o=this.lastTimePointIndex(),n=this.valueAt(i),s=this.valueAt(o),t>=n&&t<=s?this.closestIndexLeft(t):(r=(s-n)/(o-i),t<n?(a=n-t,l=Math.round(a/r),i-l):(h=500,t>s?(a=t-s,l=Math.trunc(a/r),l<h&&e&&(c=e(s,t),c.success&&(l=c.result)),o+l):void 0))},i.prototype.closestIndexLeft=function(t){var e,i,o,n,s,r,a=this._items;if(a.length&&t===t){if(e=a.length-1,i=a[e],t>=i)return e-this._zoffset;if(o=0,n=a[o],!(t<n)){if(t===n)return o-this._zoffset;for(;e>o+1;)if(s=o+e>>1,(r=a[s])>t)e=s;else{if(!(r<t))return r===t?s-this._zoffset:void 0;o=s}return o-this._zoffset}}},t.exports=i},function(t,e){"use strict";e.MINUTE_SPAN=20,e.HOUR_SPAN=30,e.DAY_SPAN=40,e.WEEK_SPAN=50,e.MONTH_SPAN=60,e.YEAR_SPAN=70,e.DEFAULT_BAR_SPACING=6,e.DEFAULT_RIGHT_OFFSET=5},function(t,e,i){"use strict";function o(t){a.call(this,t);var e=this;l.hideMarksOnBars().subscribe(this,function(){e._properties.visible.setValue(!l.hideMarksOnBars().value())}),this._paneView=new n(this)}function n(t,e){this.source=t,this._rendererFactory=e,this.stylesCache={},this.templatesCache={},this._lollipops={},this._createLollipops()}
|
|
|
|
var s=i(53),r=i(391).ESDPaneView,a=i(393).BarsMarksContainer,l=i(206),h=i(66),c=i(392).Tooltip;inherit(o,a),o.prototype._initialize=function(t){this._properties.visible.setValue(!0)},o.prototype.userEditEnabled=function(){return!1},o.prototype._constructor="UserDefinedTimescaleMarks",o.prototype._plateViewData=function(t){return{text:t.text}},o.prototype.onClicked=function(){var t=this._model.lastHittestData().id;h.emit("onTimescaleMarkClick",t)},o.prototype.clearMarks=function(){a.prototype.clearMarks.call(this),this.onNeedRepaint.fire()},o.prototype._getData=function(t){var e,i,o,n=this._model.mainSeries().symbolInfo();n&&(e=this.roundRange(this._rangeDifference(t)),i=this,o=this._model.mainSeries().properties().interval.value(),ChartApiInstance.getTimescaleMarks(n,e.start,e.end,function(e){e.forEach(function(t){i._marks[t.id]=t},i),i._loadedRange=i._rangeUnion(t,i._loadedRange),i.onNeedRepaint.fire()},o))},o.prototype.updatePlateData=function(t,e){return e.barWidth=this.barWidth(),e.text=t.text,e.tooltipMargin=-1*Math.max(t.minSize/2,.4*this.barWidth()),e},o.prototype.hasContextMenu=function(){return!1},o.prototype.paneViews=function(t){return this._properties.visible.value()?[this._paneView]:[]},o.prototype.onClickOutside=function(t){this._paneView.onClickOutside(t)},inherit(n,r),n.prototype._createLollipops=function(){var t=this.source._model.timeScale(),e=r.prototype._getY.call(this.source),i=this.source._model.lastHittestData(),o=this;$.each(this.source._marks,function(n,r){var a=r.id;o._lollipops[a]={id:a,basePoint:new s.Point(t.indexToCoordinate(t.timePointToIndex(r.tickmark))+1,e),hovered:i&&i.id===a||a===o.getLastClickedLollipopId(),barY:null,label:r.label,color:r.color,items:r.tooltip,tooltip:o._lollipops.hasOwnProperty(a)?o._lollipops[a].tooltip:new c,visible:!0}})},n.prototype.update=function(){this._createLollipops()},n.prototype.renderer=function(){return this.update(),r.prototype.renderer.call(this)},n.prototype._generateTemplateStyle=function(t,e,i){var o,n,s=t+e+i;return s in this.stylesCache||(o={strokeStyle:e,lineWidth:1,fillStyle:"white",barLine:{lineStyle:CanvasEx.LINESTYLE_DASHED},lollipop:{width:32,height:96,circleHeight:16,radius:12,lineWidth:1.5,fillStyle:"white",strokeStyle:"#E2745B",text:{label:i,strokeStyle:e,font:"normal 12px Verdana, Arial, sans-serif"}}},n={strokeStyle:e,lollipop:{fillStyle:e,fillCircle:!0,text:{strokeStyle:"white"}}},this.stylesCache[s]="default"===t?o:$.extend(!0,{},o,n)),this.stylesCache[s]},n.prototype.getTemplate=function(t,e){var i=t+e.color+e.label;return i in this.templatesCache||(this.templatesCache[i]=this.createTemplate(this._generateTemplateStyle(t,e.color,e.label))),this.templatesCache[i]},n.prototype.getStyle=function(t,e){return this._generateTemplateStyle(t,e.color,e.label)},n.prototype.createText=function(t,e){"string"==typeof t.items?e.addTextLine(t.items):Array.isArray(t.items)&&t.items.forEach(function(t){e.addTextLine(t)})},n.prototype.hasTooltip=function(t){return!!t.tooltip&&t.tooltip.length},t.exports=o},function(t,e,i){"use strict"
|
|
|
|
var s=i(53),r=i(391).ESDPaneView,a=i(393).BarsMarksContainer,l=i(206),h=i(66),c=i(392).Tooltip;inherit(o,a),o.prototype._initialize=function(t){this._properties.visible.setValue(!0)},o.prototype.userEditEnabled=function(){return!1},o.prototype._constructor="UserDefinedTimescaleMarks",o.prototype._plateViewData=function(t){return{text:t.text}},o.prototype.onClicked=function(){var t=this._model.lastHittestData().id;h.emit("onTimescaleMarkClick",t)},o.prototype.clearMarks=function(){a.prototype.clearMarks.call(this),this.onNeedRepaint.fire()},o.prototype._getData=function(t){var e,i,o,n=this._model.mainSeries().symbolInfo();n&&(e=this.roundRange(this._rangeDifference(t)),i=this,o=this._model.mainSeries().properties().interval.value(),ChartApiInstance.getTimescaleMarks(n,e.start,e.end,function(e){e.forEach(function(t){i._marks[t.id]=t},i),i._loadedRange=i._rangeUnion(t,i._loadedRange),i.onNeedRepaint.fire()},o))},o.prototype.updatePlateData=function(t,e){return e.barWidth=this.barWidth(),e.text=t.text,e.tooltipMargin=-1*Math.max(t.minSize/2,.4*this.barWidth()),e},o.prototype.hasContextMenu=function(){return!1},o.prototype.paneViews=function(t){return this._properties.visible.value()?[this._paneView]:[]},o.prototype.onClickOutside=function(t){this._paneView.onClickOutside(t)},inherit(n,r),n.prototype._createLollipops=function(){var t=this.source._model.timeScale(),e=r.prototype._getY.call(this.source),i=this.source._model.lastHittestData(),o=this;$.each(this.source._marks,function(n,r){var a=r.id;o._lollipops[a]={id:a,basePoint:new s.Point(t.indexToCoordinate(t.timePointToIndex(r.tickmark))+1,e),hovered:i&&i.id===a||a===o.getLastClickedLollipopId(),barY:null,label:r.label,color:r.color,items:r.tooltip,tooltip:o._lollipops.hasOwnProperty(a)?o._lollipops[a].tooltip:new c,visible:!0}})},n.prototype.update=function(){this._createLollipops()},n.prototype.renderer=function(){return this.update(),r.prototype.renderer.call(this)},n.prototype._generateTemplateStyle=function(t,e,i){var o,n,s=t+e+i;return s in this.stylesCache||(o={strokeStyle:e,lineWidth:1,fillStyle:"white",barLine:{lineStyle:CanvasEx.LINESTYLE_DASHED},lollipop:{width:32,height:96,circleHeight:16,radius:12,lineWidth:1.5,fillStyle:"white",strokeStyle:"#E2745B",text:{label:i,strokeStyle:e,font:"normal 12px Verdana, Arial, sans-serif"}}},n={strokeStyle:e,lollipop:{fillStyle:e,fillCircle:!0,text:{strokeStyle:"white"}}},this.stylesCache[s]="default"===t?o:$.extend(!0,{},o,n)),this.stylesCache[s]},n.prototype.getTemplate=function(t,e){var i=t+e.color+e.label;return i in this.templatesCache||(this.templatesCache[i]=this.createTemplate(this._generateTemplateStyle(t,e.color,e.label))),this.templatesCache[i]},n.prototype.getStyle=function(t,e){return this._generateTemplateStyle(t,e.color,e.label)},n.prototype.createText=function(t,e){"string"==typeof t.items?e.addTextLine(t.items):Array.isArray(t.items)&&t.items.forEach(function(t){e.addTextLine(t)})},n.prototype.hasTooltip=function(t){return!!t.tooltip&&t.tooltip.length},t.exports=o},function(t,e,i){"use strict"
|
|
|
|
@@ -782,9 +782,9 @@ var t=this._input(0),e=this._context.new_var(o.Std.high(this._context)),i=o.Std.
|
|
|
|
return this._timezone},r.prototype.setTimezone=function(t){this._timezone="exchange"===t?"exchange":e.get_timezone(t),this._timezoneId=t},r.prototype.timezone=function(){return this._timezoneId},r.prototype.setResolution=function(t){this._isDWM=n.isDWM(t),this._resolution=t},r.prototype.onRequestMetadata=function(t,e){this._server.receiveLocalResponse({method:"studies_metadata",params:[this._session,t,e]})},r.prototype.onSymbolResolved=function(t,e){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,t,e]})},r.prototype.onSymbolError=function(t,e){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,t,e]})},r.prototype.onStudyError=function(t,e){this._server.receiveLocalResponse({method:"study_error",params:[this._session,t,e]})},r.prototype.onSeriesLoading=function(t,e){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,t,e]})},r.prototype.onSeriesCompleted=function(t,e,i){this._server.receiveLocalResponse({method:"series_completed",params:[this._session,t,i,e]}),this.seriesCompleted.fire(t)},r.prototype.onSeriesError=function(t,e){this._server.receiveLocalResponse({method:"series_error",params:[this._session,t,e]})},r.prototype.onSeriesClearData=function(t,e){var i={};i[t]={series:[],turnaround:e},this._server.receiveLocalResponse({method:"timescale_update",params:[this._session,i,{index:0,zoffset:0,changes:[],marks:[]}]})},r.prototype.onStudyCompleted=function(t,e){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,t,e]})},r.prototype.onStudyLoading=function(t,e){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,t,e]})},r.prototype._calcMarksTime=function(t,i,n,s,r){var a,l,h,c,d,p=e.get_timezone(i),u=this;if(this._isDWM)for(d=new o.Session,d.init(p,n),c=0;c<t.length;c++)h=t[c],a=s(h),l=e.utc_to_cal(p,1e3*a),l=d.spec.correctTradingDay(l,p),e.set_hms(l,0,0,0,0),t[c]=r(h,parseInt(l.valueOf()/1e3));else for(c=0;c<t.length;c++)t[c]=r(t[c],u.timeInTimezone(s(t[c]),p))},r.prototype.onTickmarksUpdated=function(t,e,i,o){var s,r,a,l,h,c,d;if(n.isEqual(o,this._resolution)){for(s=e.slice(0),this._calcMarksTime(s,i.timezone,i.session,function(t){return t},function(t,e){return e}),r=[],a=[],h=0;h<s.length;++h)c=s[h],r.push([this._spanByTime(c,l),c,t+h]),a.push(c),l=c;d={method:"tickmark_update",params:[this._session,{index:t,zoffset:0,changes:a,marks:r}]},this._server.receiveLocalResponse(d)}},r.prototype.onTimescaleUpdate=function(t,e,i,o,n,s){var r,a,l,h,c,d,p,u,_=s&&s.slice(0);for(this._lastBarTimes[t]=_?_&&_[_.length-1]:i&&i[i.length-1].value[0],this._calcMarksTime(i,o.timezone,o.session,function(t){return t.value[0]},function(t,e){return t.exTime=e,t}),_&&this._calcMarksTime(_,o.timezone,o.session,function(t){return t},function(t,e){return{markTime:e,time:t}}),r={},r[t]={series:i,turnaround:e},a=[],l=[],c=i.map(function(t){return{markTime:t.exTime,time:t.value[0]}}),_&&(c=c.concat(_)),d=0;d<c.length;++d)p=c[d].markTime,a.push([this._spanByTime(p,h),p,n+d]),l.push(c[d].time),h=p
|
|
|
|
return this._timezone},r.prototype.setTimezone=function(t){this._timezone="exchange"===t?"exchange":e.get_timezone(t),this._timezoneId=t},r.prototype.timezone=function(){return this._timezoneId},r.prototype.setResolution=function(t){this._isDWM=n.isDWM(t),this._resolution=t},r.prototype.onRequestMetadata=function(t,e){this._server.receiveLocalResponse({method:"studies_metadata",params:[this._session,t,e]})},r.prototype.onSymbolResolved=function(t,e){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,t,e]})},r.prototype.onSymbolError=function(t,e){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,t,e]})},r.prototype.onStudyError=function(t,e){this._server.receiveLocalResponse({method:"study_error",params:[this._session,t,e]})},r.prototype.onSeriesLoading=function(t,e){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,t,e]})},r.prototype.onSeriesCompleted=function(t,e,i){this._server.receiveLocalResponse({method:"series_completed",params:[this._session,t,i,e]}),this.seriesCompleted.fire(t)},r.prototype.onSeriesError=function(t,e){this._server.receiveLocalResponse({method:"series_error",params:[this._session,t,e]})},r.prototype.onSeriesClearData=function(t,e){var i={};i[t]={series:[],turnaround:e},this._server.receiveLocalResponse({method:"timescale_update",params:[this._session,i,{index:0,zoffset:0,changes:[],marks:[]}]})},r.prototype.onStudyCompleted=function(t,e){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,t,e]})},r.prototype.onStudyLoading=function(t,e){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,t,e]})},r.prototype._calcMarksTime=function(t,i,n,s,r){var a,l,h,c,d,p=e.get_timezone(i),u=this;if(this._isDWM)for(d=new o.Session,d.init(p,n),c=0;c<t.length;c++)h=t[c],a=s(h),l=e.utc_to_cal(p,1e3*a),l=d.spec.correctTradingDay(l,p),e.set_hms(l,0,0,0,0),t[c]=r(h,parseInt(l.valueOf()/1e3));else for(c=0;c<t.length;c++)t[c]=r(t[c],u.timeInTimezone(s(t[c]),p))},r.prototype.onTickmarksUpdated=function(t,e,i,o){var s,r,a,l,h,c,d;if(n.isEqual(o,this._resolution)){for(s=e.slice(0),this._calcMarksTime(s,i.timezone,i.session,function(t){return t},function(t,e){return e}),r=[],a=[],h=0;h<s.length;++h)c=s[h],r.push([this._spanByTime(c,l),c,t+h]),a.push(c),l=c;d={method:"tickmark_update",params:[this._session,{index:t,zoffset:0,changes:a,marks:r}]},this._server.receiveLocalResponse(d)}},r.prototype.onTimescaleUpdate=function(t,e,i,o,n,s){var r,a,l,h,c,d,p,u,_=s&&s.slice(0);for(this._lastBarTimes[t]=_?_&&_[_.length-1]:i&&i[i.length-1].value[0],this._calcMarksTime(i,o.timezone,o.session,function(t){return t.value[0]},function(t,e){return t.exTime=e,t}),_&&this._calcMarksTime(_,o.timezone,o.session,function(t){return t},function(t,e){return{markTime:e,time:t}}),r={},r[t]={series:i,turnaround:e},a=[],l=[],c=i.map(function(t){return{markTime:t.exTime,time:t.value[0]}}),_&&(c=c.concat(_)),d=0;d<c.length;++d)p=c[d].markTime,a.push([this._spanByTime(p,h),p,n+d]),l.push(c[d].time),h=p
|
|
|
|
;u={method:"timescale_update",params:[this._session,r,{index:n,zoffset:0,changes:l,marks:a}]},this._server.receiveLocalResponse(u)},r.prototype.onSeriesTimeframeUpdate=function(t,e,i,o,n){var s={method:"series_timeframe",params:[this._session,t,e,i,o,n]};this._server.receiveLocalResponse(s)},r.prototype.onPointsetDataUpdate=function(t,e,i,o){this._onDataUpdate(t,e,i,void 0,o,1)},r.prototype.onDataUpdate=function(t,e,i,o,n){this._onDataUpdate(t,e,i,o,n,0)},r.prototype._onDataUpdate=function(t,e,i,o,n,s){var r,a={},l=o?JSON.stringify({offsets:o}):"";a[t]={s:i,ns:{d:l,indexes:[]},turnaround:e},r={method:"data_update",params:[this._session,a]},this._server.receiveLocalResponse(r)},r.prototype.onQuotesData=function(t){this._server.receiveLocalResponse({method:"quote_symbol_data",params:t})},r.prototype.onDepthData=function(t){this._server.receiveLocalResponse({method:"dd",params:t})},r.prototype.onDepthUpdate=function(t){this._server.receiveLocalResponse({method:"dpu",params:t})},r.prototype.onProjectionUpdate=function(t,e,i,o){var n,s=i.data,r=s[s.length-1],a={data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:r?r[4]:i.price,bars:s.map(function(t,e){return{time:e,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],factor:t[6],additionalPrice:t[6]}})}},l={};l[t]={s:o||[],ns:{d:JSON.stringify(a),indexes:s.map(function(t,e){return i.barsetSize+(t[0]||0)})},turnaround:e},n={method:"data_update",params:[this._session,l]},this._server.receiveLocalResponse(n)},r.prototype.timeInTimezone=function(t,i){return"exchange"===this._userTimezone()?parseInt(e.utc_to_cal(i,1e3*t).valueOf()/1e3):parseInt(e.utc_to_cal(this._userTimezone(),1e3*t).valueOf()/1e3)},r.prototype._spanByTime=function(t,e){function i(t){return 60*t*60*1e3}function o(t){return 60*t*1e3}function n(t){return 1e3*t}var s,r,a,l=[{divisor:1,span:20},{divisor:n(1),span:19},{divisor:o(5),span:21},{divisor:o(30),span:22},{divisor:i(1),span:30},{divisor:i(3),span:31},{divisor:i(6),span:32},{divisor:i(12),span:33}];if(!e)return 20;if(s=new Date(1e3*e),r=new Date(1e3*t),r.getYear()!==s.getYear())return 70;if(r.getUTCMonth()!==s.getUTCMonth())return 60;if(r.getUTCDate()!==s.getUTCDate())return 50;for(a=l.length-1;a>=0;--a)if(Math.floor(s/l[a].divisor)!==Math.floor(r/l[a].divisor))return l[a].span},TradingView.ChartapiMessagerInstances=[],t.exports=r}).call(e,i(256))},function(t,e,i){"use strict";function o(t,e){return t.ticker+"_"+e}function n(t){return new Date(t).toISOString()}var s,r,a=i(207),l=i(786),h=i(785),c=i(1);i(59),s=function(){function t(t,e,i,o){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._gaps=[],this._needPurgeCache=!1,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._datafeed=t,this._symbolInfo=e,this._resolution=i,this._dwmAligner=o}return t.prototype.addSubscription=function(t,e,i){var o=this,n=this._getNextSubscriptionId(),s=Math.floor(t.from/1e3),r=Math.floor(t.to/1e3)
|
|
|
|
;u={method:"timescale_update",params:[this._session,r,{index:n,zoffset:0,changes:l,marks:a}]},this._server.receiveLocalResponse(u)},r.prototype.onSeriesTimeframeUpdate=function(t,e,i,o,n){var s={method:"series_timeframe",params:[this._session,t,e,i,o,n]};this._server.receiveLocalResponse(s)},r.prototype.onPointsetDataUpdate=function(t,e,i,o){this._onDataUpdate(t,e,i,void 0,o,1)},r.prototype.onDataUpdate=function(t,e,i,o,n){this._onDataUpdate(t,e,i,o,n,0)},r.prototype._onDataUpdate=function(t,e,i,o,n,s){var r,a={},l=o?JSON.stringify({offsets:o}):"";a[t]={s:i,ns:{d:l,indexes:[]},turnaround:e},r={method:"data_update",params:[this._session,a]},this._server.receiveLocalResponse(r)},r.prototype.onQuotesData=function(t){this._server.receiveLocalResponse({method:"quote_symbol_data",params:t})},r.prototype.onDepthData=function(t){this._server.receiveLocalResponse({method:"dd",params:t})},r.prototype.onDepthUpdate=function(t){this._server.receiveLocalResponse({method:"dpu",params:t})},r.prototype.onProjectionUpdate=function(t,e,i,o){var n,s=i.data,r=s[s.length-1],a={data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:r?r[4]:i.price,bars:s.map(function(t,e){return{time:e,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],factor:t[6],additionalPrice:t[6]}})}},l={};l[t]={s:o||[],ns:{d:JSON.stringify(a),indexes:s.map(function(t,e){return i.barsetSize+(t[0]||0)})},turnaround:e},n={method:"data_update",params:[this._session,l]},this._server.receiveLocalResponse(n)},r.prototype.timeInTimezone=function(t,i){return"exchange"===this._userTimezone()?parseInt(e.utc_to_cal(i,1e3*t).valueOf()/1e3):parseInt(e.utc_to_cal(this._userTimezone(),1e3*t).valueOf()/1e3)},r.prototype._spanByTime=function(t,e){function i(t){return 60*t*60*1e3}function o(t){return 60*t*1e3}function n(t){return 1e3*t}var s,r,a,l=[{divisor:1,span:20},{divisor:n(1),span:19},{divisor:o(5),span:21},{divisor:o(30),span:22},{divisor:i(1),span:30},{divisor:i(3),span:31},{divisor:i(6),span:32},{divisor:i(12),span:33}];if(!e)return 20;if(s=new Date(1e3*e),r=new Date(1e3*t),r.getYear()!==s.getYear())return 70;if(r.getUTCMonth()!==s.getUTCMonth())return 60;if(r.getUTCDate()!==s.getUTCDate())return 50;for(a=l.length-1;a>=0;--a)if(Math.floor(s/l[a].divisor)!==Math.floor(r/l[a].divisor))return l[a].span},TradingView.ChartapiMessagerInstances=[],t.exports=r}).call(e,i(256))},function(t,e,i){"use strict";function o(t,e){return t.ticker+"_"+e}function n(t){return new Date(t).toISOString()}var s,r,a=i(207),l=i(786),h=i(785),c=i(1);i(59),s=function(){function t(t,e,i,o){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._gaps=[],this._needPurgeCache=!1,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._datafeed=t,this._symbolInfo=e,this._resolution=i,this._dwmAligner=o}return t.prototype.addSubscription=function(t,e,i){var o=this,n=this._getNextSubscriptionId(),s=Math.floor(t.from/1e3),r=Math.floor(t.to/1e3)
|
|
|
|
;return this._pendingSubscribers.push({key:n,range:{from:s,to:r},onHistoryCallback:e,onErrorCallback:i}),this._clearResetCacheTimeout(),setTimeout(function(){return o._processNextPendingSubscriber()},0),n},t.prototype.removeSubscription=function(t){var e,i=this,o=this._pendingSubscribers.find(function(e){return e.key===t});return o?void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(o),1):(e=this._subscribers.find(function(e){return e.key===t}))?(this._subscribers.splice(this._subscribers.indexOf(e),1),void(this._subscribers.length||(this._symbolInfo.expired||this._symbolInfo.expiration_date?this._unsubscribeRealtime():this._resetCacheTimeout=setTimeout(function(){i.purgeCache(),i._unsubscribeRealtime()})))):void console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,t))},t.prototype.purgeCache=function(){this._logMessage("Reset cache"),this._needPurgeCache=!0,this._clearResetCacheTimeout()},t.prototype._logMessage=function(t,e){(c.enabled("charting_library_debug_mode")||e)&&console.log("FEED [{0}|{1}]: {2}".format(this._symbolInfo.name,this._resolution,t))},t.prototype._clearResetCacheTimeout=function(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)},t.prototype._purgeCache=function(){this._cache={bars:[]},this._gaps=[],this._errorMessage=null,this._needPurgeCache=!1,this._leftDate=null,this._endOfData=!1},t.prototype._processNextPendingSubscriber=function(){var t,e,i,o,s,r;if(this._pendingSubscribers.length&&!this._requesting){if(this._needPurgeCache&&this._purgeCache(),t=this._pendingSubscribers.pop(),this._logMessage("Processing bars request {0} from {1} to {2} ".format(t.key,n(1e3*t.range.from),n(1e3*t.range.to))),this._errorMessage)return this._logMessage("Return error:"+this._errorMessage),t.onErrorCallback(this._errorMessage),void this._processNextPendingSubscriber();if((!this._leftDate||t.range.from<this._leftDate)&&(e=new a.Interval(this._resolution),i=(e.inMilliseconds()||0)/1e3,o=!this._leftDate,s=!o&&!!this._cache.bars.length&&this._cache.bars[0].time/1e3-t.range.from<i,(o||!s)&&!this._endOfData))return this._pendingSubscribers.push(t),void this._ensureRequestedTo(t.range.from);r=this._moveSubscriberToRealtime(t),this._returnHistoryDataToSubscriber(t,r),this._subscribeRealtimeIfNeeded(),this._processNextPendingSubscriber()}},t.prototype._moveSubscriberToRealtime=function(t){var e={key:t.key,onHistoryCallback:t.onHistoryCallback,barset:null};return this._subscribers.push(e),e},t.prototype._subscribeRealtimeIfNeeded=function(){!this._subscribers.length||this._realtimeOn||this._symbolInfo.expired||this._symbolInfo.expiration_date||this._subscribeRealtime()},t.prototype._subscribeRealtime=function(){var t,e,i=this;this._symbolInfo.expired||this._realtimeOn||(t=function(t){i._dwmAligner&&(t.time=i._dwmAligner.tradingDayToSessionStart(t.time)),i._putToCacheNewBar(t),i._subscribers.forEach(function(e){var i=e.barset;if(null===i)throw Error("subscirber.barset is null");i.add(t),
|
|
|
|
;return this._pendingSubscribers.push({key:n,range:{from:s,to:r},onHistoryCallback:e,onErrorCallback:i}),this._clearResetCacheTimeout(),setTimeout(function(){return o._processNextPendingSubscriber()},0),n},t.prototype.removeSubscription=function(t){var e,i=this,o=this._pendingSubscribers.find(function(e){return e.key===t});return o?void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(o),1):(e=this._subscribers.find(function(e){return e.key===t}))?(this._subscribers.splice(this._subscribers.indexOf(e),1),void(this._subscribers.length||(this._symbolInfo.expired||this._symbolInfo.expiration_date?this._unsubscribeRealtime():this._resetCacheTimeout=setTimeout(function(){i.purgeCache(),i._unsubscribeRealtime()})))):void console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,t))},t.prototype.purgeCache=function(){this._logMessage("Reset cache"),this._needPurgeCache=!0,this._clearResetCacheTimeout()},t.prototype._logMessage=function(t,e){(c.enabled("charting_library_debug_mode")||e)&&console.log("FEED [{0}|{1}]: {2}".format(this._symbolInfo.name,this._resolution,t))},t.prototype._clearResetCacheTimeout=function(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)},t.prototype._purgeCache=function(){this._cache={bars:[]},this._gaps=[],this._errorMessage=null,this._needPurgeCache=!1,this._leftDate=null,this._endOfData=!1},t.prototype._processNextPendingSubscriber=function(){var t,e,i,o,s,r;if(this._pendingSubscribers.length&&!this._requesting){if(this._needPurgeCache&&this._purgeCache(),t=this._pendingSubscribers.pop(),this._logMessage("Processing bars request {0} from {1} to {2} ".format(t.key,n(1e3*t.range.from),n(1e3*t.range.to))),this._errorMessage)return this._logMessage("Return error:"+this._errorMessage),t.onErrorCallback(this._errorMessage),void this._processNextPendingSubscriber();if((!this._leftDate||t.range.from<this._leftDate)&&(e=new a.Interval(this._resolution),i=(e.inMilliseconds()||0)/1e3,o=!this._leftDate,s=!o&&!!this._cache.bars.length&&this._cache.bars[0].time/1e3-t.range.from<i,(o||!s)&&!this._endOfData))return this._pendingSubscribers.push(t),void this._ensureRequestedTo(t.range.from);r=this._moveSubscriberToRealtime(t),this._returnHistoryDataToSubscriber(t,r),this._subscribeRealtimeIfNeeded(),this._processNextPendingSubscriber()}},t.prototype._moveSubscriberToRealtime=function(t){var e={key:t.key,onHistoryCallback:t.onHistoryCallback,barset:null};return this._subscribers.push(e),e},t.prototype._subscribeRealtimeIfNeeded=function(){!this._subscribers.length||this._realtimeOn||this._symbolInfo.expired||this._symbolInfo.expiration_date||this._subscribeRealtime()},t.prototype._subscribeRealtime=function(){var t,e,i=this;this._symbolInfo.expired||this._realtimeOn||(t=function(t){i._dwmAligner&&(t.time=i._dwmAligner.tradingDayToSessionStart(t.time)),i._putToCacheNewBar(t),i._subscribers.forEach(function(e){var i=e.barset;if(null===i)throw Error("subscirber.barset is null");i.add(t),
|
|
|
|
e.onHistoryCallback(i)})},e=function(){i._unsubscribeRealtime();var t=i._leftDate;i._purgeCache(),t&&i._ensureRequestedTo(t)},this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,t,o(this._symbolInfo,this._resolution),e),this._logMessage("Subscribed to realtime"))},t.prototype._unsubscribeRealtime=function(){!this._symbolInfo.expired&&this._realtimeOn&&(this._datafeed.unsubscribeBars(o(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)},t.prototype._returnHistoryDataToSubscriber=function(t,e){var i,o,s=t.range,r=this._createBarset(s.from);r.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(t.key,r.count(),n(r.bars[0].time),n(r.bars[r.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(t.key)),e.barset=r,i=this._inGapNextTime(s.from),i?(this._logMessage("Request {0} is in gap, nextTime = {1}".format(t.key,n(1e3*i))),r.nextTime=i):0===r.count()&&(o=this._cache.bars.length&&this._cache.bars[this._cache.bars.length-1].time/1e3)&&s.from>o&&(this._logMessage("Request {0} is in gap, nextTime = {1}".format(t.key,n(1e3*o))),r.nextTime=o||void 0),this._endOfData&&t.range.from<=this._leftDate&&(r.endOfData=!0),t.onHistoryCallback(r)},t.prototype._createBarset=function(t){var e=l.lowerbound(this._cache.bars,1e3*t,function(t,e){return t.time<e});return new h.BarSet(this._symbolInfo,this._cache.bars.slice(e))},t.prototype._ensureRequestedTo=function(e){var i,o,s,r=this;if(this._leftDate&&this._leftDate<e)return void this._processNextPendingSubscriber();i=!this._leftDate,this._requesting=!0,o=e,s=this._leftDate?this._leftDate-1:this._symbolInfo.expiration_date||Math.floor(t._now()/1e3),this._leftDate=e,this._logMessage("Requesting data: [{0} ... {1}] ".format(n(1e3*o),n(1e3*s))),this._datafeed.getBars(this._symbolInfo,this._resolution,o,s,function(t,e){r._requesting=!1,r._processBars(t,e)},function(t){r._requesting=!1,r._errorMessage=t||null,r._processNextPendingSubscriber()},i)},t.prototype._processBars=function(t,e){this._checkBars(t),this._alignBarsTime(t),t.length>0?this._processFullBarset(t,e):this._processEmptyBarset(e),this._processNextPendingSubscriber()},t.prototype._processEmptyBarset=function(e){this._logMessage("Receiving bars: barset is empty"),e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format(n(1e3*e.nextTime))),this._addGap(e.nextTime),this._leftDate=Math.min(this._leftDate||t._now()/1e3,e.nextTime+1)):e&&e.noData?(this._logMessage("EOD received"),this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._cache.bars[0].time/1e3)):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned")},t.prototype._processFullBarset=function(t,e){var i=t[0].time,o=t[t.length-1].time;this._logMessage("Receiving bars: total {0} bars in [{1} ... {2}] ".format(t.length,n(i),n(o))),i<1e3*this._leftDate&&this._logMessage("Returned more data than needed"),
|
|
|
|
e.onHistoryCallback(i)})},e=function(){i._unsubscribeRealtime();var t=i._leftDate;i._purgeCache(),t&&i._ensureRequestedTo(t)},this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,t,o(this._symbolInfo,this._resolution),e),this._logMessage("Subscribed to realtime"))},t.prototype._unsubscribeRealtime=function(){!this._symbolInfo.expired&&this._realtimeOn&&(this._datafeed.unsubscribeBars(o(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)},t.prototype._returnHistoryDataToSubscriber=function(t,e){var i,o,s=t.range,r=c.enabled("cl_feed_return_all_data")?this._createBarset(this._leftDate||s.from):this._createBarset(s.from);r.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(t.key,r.count(),n(r.bars[0].time),n(r.bars[r.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(t.key)),e.barset=r,i=this._inGapNextTime(s.from),i?(this._logMessage("Request {0} is in gap, nextTime = {1}".format(t.key,n(1e3*i))),r.nextTime=i):0===r.count()&&(o=this._cache.bars.length&&this._cache.bars[this._cache.bars.length-1].time/1e3)&&s.from>o&&(this._logMessage("Request {0} is in gap, nextTime = {1}".format(t.key,n(1e3*o))),r.nextTime=o||void 0),this._endOfData&&t.range.from<=this._leftDate&&(r.endOfData=!0),t.onHistoryCallback(r)},t.prototype._createBarset=function(t){var e=l.lowerbound(this._cache.bars,1e3*t,function(t,e){return t.time<e});return new h.BarSet(this._symbolInfo,this._cache.bars.slice(e))},t.prototype._ensureRequestedTo=function(e){var i,o,s,r=this;if(this._leftDate&&this._leftDate<e)return void this._processNextPendingSubscriber();i=!this._leftDate,this._requesting=!0,o=e,s=this._leftDate?this._leftDate-1:this._symbolInfo.expiration_date||Math.floor(t._now()/1e3),this._leftDate=e,this._logMessage("Requesting data: [{0} ... {1}] ".format(n(1e3*o),n(1e3*s))),this._datafeed.getBars(this._symbolInfo,this._resolution,o,s,function(t,e){r._requesting=!1,r._processBars(t,e)},function(t){r._requesting=!1,r._errorMessage=t||null,r._processNextPendingSubscriber()},i)},t.prototype._processBars=function(t,e){this._checkBars(t),this._alignBarsTime(t),t.length>0?this._processFullBarset(t,e):this._processEmptyBarset(e),this._processNextPendingSubscriber()},t.prototype._processEmptyBarset=function(e){this._logMessage("Receiving bars: barset is empty"),e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format(n(1e3*e.nextTime))),this._addGap(e.nextTime),this._leftDate=Math.min(this._leftDate||t._now()/1e3,e.nextTime+1)):e&&e.noData?(this._logMessage("EOD received"),this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._cache.bars[0].time/1e3)):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned")},t.prototype._processFullBarset=function(t,e){var i=t[0].time,o=t[t.length-1].time;this._logMessage("Receiving bars: total {0} bars in [{1} ... {2}] ".format(t.length,n(i),n(o))),
|
|
|
|
this._putToCache(t)?this._cache.bars.length&&this._leftDate>this._cache.bars[0].time/1e3&&(this._leftDate=this._cache.bars[0].time/1e3):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),e&&e.nextTime?console.warn("nextTime should be set when there is no data in the requested period only"):e&&e.noData&&console.warn("noData should be set when there is no data in the requested period and earlier only")},t.prototype._addGap=function(e){var i;this._gaps.find(function(t){return t.from===e})||(i=(this._cache.bars.length?this._cache.bars[0].time:t._now())/1e3,this._gaps.push({from:e,to:i}))},t.prototype._inGapNextTime=function(t){var e=this._gaps.find(function(e){return e.from<t&&e.to>t});return e?e.from:null},t.prototype._getNextSubscriptionId=function(){return this._nextSubscriptionId++},t.prototype._checkBars=function(t){if(c.enabled("charting_library_debug_mode"))for(var e=1;e<t.length;e++)t[e].time<=t[e-1].time&&console.error("Corrupted bars, time {0} at {1} > {2} at {3}".format(t[e].time,e,t[e-1].time,e-1))},t.prototype._putToCache=function(t){if(0===t.length)return!0;if(this._cache.bars.length===t.length&&this._cache.bars[0].time===t[0].time&&this._cache.bars[this._cache.bars.length-1].time===t[t.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&t[t.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&t[t.length-1].time>=this._cache.bars[0].time){var e=this._cache.bars[this._cache.bars.length-1].time===t[t.length-1].time;if(this._cache.bars=[],!e)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return Array.prototype.unshift.apply(this._cache.bars,t),this._checkBars(this._cache.bars),!0},t.prototype._putToCacheNewBar=function(t){var e=this._cache.bars.length,i=t.time,o=0===e?NaN:this._cache.bars[e-1].time;0===e||o<i?this._cache.bars.push(t):o===i?this._cache.bars[e-1]=t:console.error("putToCacheNewBar: time violation, prev: "+n(o)+", cur: "+n(i))},t.prototype._alignBarsTime=function(t){if(this._dwmAligner)for(var e=0;e<t.length;e++)t[e].time=this._dwmAligner.tradingDayToSessionStart(t[e].time)},t._now=function(){return Date.now()+6e4},t}(),r=function(){function t(t,e){this._threads={},this._datafeed=t,this._dwmAlignerCreator=e}return t.prototype.createThread=function(t,e){return new s(this._datafeed,t,e,this._dwmAlignerCreator(e,t))},t.prototype.purgeCache=function(){this._forEachThread(function(t,e){return e.purgeCache()})},t.prototype.subscribe=function(t,e,i,n,s){var r,a=o(t,e);return this._threads[a]||(this._threads[a]=this.createThread(t,e)),r=this._threads[a].addSubscription(i,n,s),a+'"'+r},t.prototype.unsubscribe=function(t){var e,i,o=t.split('"');if(2!==o.length)return void console.warn("Wrong guid format");e=o[0],i=parseInt(o[1]),this._threads[e].removeSubscription(i)},
|
|
|
|
null!==this._leftDate&&i<1e3*this._leftDate&&!c.enabled("cl_feed_return_all_data")&&this._logMessage("Returned more data than needed"),this._putToCache(t)?this._cache.bars.length&&this._leftDate>this._cache.bars[0].time/1e3&&(this._leftDate=this._cache.bars[0].time/1e3):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),e&&e.nextTime?console.warn("nextTime should be set when there is no data in the requested period only"):e&&e.noData&&console.warn("noData should be set when there is no data in the requested period and earlier only")},t.prototype._addGap=function(e){var i;this._gaps.find(function(t){return t.from===e})||(i=(this._cache.bars.length?this._cache.bars[0].time:t._now())/1e3,this._gaps.push({from:e,to:i}))},t.prototype._inGapNextTime=function(t){var e=this._gaps.find(function(e){return e.from<t&&e.to>t});return e?e.from:null},t.prototype._getNextSubscriptionId=function(){return this._nextSubscriptionId++},t.prototype._checkBars=function(t){if(c.enabled("charting_library_debug_mode"))for(var e=1;e<t.length;e++)t[e].time<=t[e-1].time&&console.error("Corrupted bars, time {0} at {1} > {2} at {3}".format(t[e].time,e,t[e-1].time,e-1))},t.prototype._putToCache=function(t){if(0===t.length)return!0;if(this._cache.bars.length===t.length&&this._cache.bars[0].time===t[0].time&&this._cache.bars[this._cache.bars.length-1].time===t[t.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&t[t.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&t[t.length-1].time>=this._cache.bars[0].time){var e=this._cache.bars[this._cache.bars.length-1].time===t[t.length-1].time;if(this._cache.bars=[],!e)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return Array.prototype.unshift.apply(this._cache.bars,t),this._checkBars(this._cache.bars),!0},t.prototype._putToCacheNewBar=function(t){var e=this._cache.bars.length,i=t.time,o=0===e?NaN:this._cache.bars[e-1].time;0===e||o<i?this._cache.bars.push(t):o===i?this._cache.bars[e-1]=t:console.error("putToCacheNewBar: time violation, prev: "+n(o)+", cur: "+n(i))},t.prototype._alignBarsTime=function(t){if(this._dwmAligner)for(var e=0;e<t.length;e++)t[e].time=this._dwmAligner.tradingDayToSessionStart(t[e].time)},t._now=function(){return Date.now()+6e4},t}(),r=function(){function t(t,e){this._threads={},this._datafeed=t,this._dwmAlignerCreator=e}return t.prototype.createThread=function(t,e){return new s(this._datafeed,t,e,this._dwmAlignerCreator(e,t))},t.prototype.purgeCache=function(){this._forEachThread(function(t,e){return e.purgeCache()})},t.prototype.subscribe=function(t,e,i,n,s){var r,a=o(t,e);return this._threads[a]||(this._threads[a]=this.createThread(t,e)),r=this._threads[a].addSubscription(i,n,s),a+'"'+r},t.prototype.unsubscribe=function(t){var e,i,o=t.split('"')
|
|
|
|
t.prototype._forEachThread=function(t){var e=this;Object.keys(this._threads).forEach(function(i){return t(i,e._threads[i])})},t}(),e.DatafeedRequestsCachedProcessor=r},function(t,e,i){(function(e){"use strict";var o=i(298).PlotType,n=i(258),s=function(){function t(t){e.enabled("charting_library_debug_mode")&&console.warn("Overrides:"+t)}function s(t,e,i,o){t.defaults.inputs[e]=o,t.inputs[i].defval=o}function r(t,e){t.defaults.precision=e}function a(e,i,o,n){var s,r,a=o[1];if("color"===a){if(s=c(e,i),r=o.length>2?parseInt(o[2]):NaN,null==s&&!isNaN(r)&&r>0)return void t("Plot `{1}` of `{0}` does not have color #{2}".format(e.description,o[0],r));0==r||isNaN(r)?(e.defaults.styles[i].color=n,null!=s&&(s.colors[0].color=n)):s.colors[r].color=n}else{if(!e.defaults.styles[i].hasOwnProperty(a))return void t("Plot `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],a));"plottype"===a&&(n=y[n]),e.defaults.styles[i][a]=n}}function l(e,i,o,n){var s=o[1];if(!e.defaults.bands[i].hasOwnProperty(s))return void t("Band `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],s));"plottype"===s&&(n=y[n]),e.defaults.bands[i][s]=n}function h(e,i,o,n){var s=o[1];if(!e.defaults.filledAreasStyle[i].hasOwnProperty(s))return void t("Area `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],s));e.defaults.filledAreasStyle[i][s]=n}function c(t,e){for(var i in t.plots)if("colorer"===t.plots[i].type&&t.plots[i].target===e)return t.defaults.palettes[t.plots[i].palette];return null}function d(t){var e,i,o=JSServer.studyLibrary;for(e=0;e<o.length;++e)if(i=o[e].metainfo,i.description.toLowerCase()===t.toLowerCase()||i.shortDescription.toLowerCase()===t.toLowerCase())return i;return null}function p(t,e){for(var i=0;i<t.inputs.length;++i)if(t.inputs[i].name.toLowerCase()===e.toLowerCase())return{id:t.inputs[i].id,index:i};return null}function u(t,e){for(var i in t.styles)if(t.styles[i].title.toLowerCase()===e.toLowerCase())return i;return null}function _(t,e){for(var i in t.filledAreas)if(t.filledAreas[i].title.toLowerCase()===e.toLowerCase())return t.filledAreas[i].id;return null}function f(t,e){if(!t.bands)return null;for(var i in t.bands)if(t.bands[i].name.toLowerCase()===e.toLowerCase())return i;return null}var m,g,v={"volume.transparency":"!transparency","upper limit":"UpperLimit","lower limit":"LowerLimit"},y={};if(Object.keys(o).forEach(function(t){y[t.toLowerCase()]=o[t]}),m={},m.setMetainfoProperty=function(e,i,o){var n,c,d,m,g,y,b,w,S,T,C;if(i=v[i]||i,n=i.split("."),c=n[0],0===c.indexOf("!"))return void(e[c.slice(1)]=o);d=c.split(":"),c=d[0],c=v[c]||c,m=null,g=null,y=null,b=null,w="options"===c,S="precision"===c&&e.defaults&&e.defaults.precision,T=2===d.length?d[1]:null,"plot"!==T&&T||(m=u(e,c)),"band"!==T&&T||(g=f(e,c)),"area"!==T&&T||(y=_(e,c)),"input"!==T&&T||(b=p(e,c)),C=!!m+!!g+!!b+!!w+!!y+!!S,
|
|
|
|
;if(2!==o.length)return void console.warn("Wrong guid format");e=o[0],i=parseInt(o[1]),this._threads[e].removeSubscription(i)},t.prototype._forEachThread=function(t){var e=this;Object.keys(this._threads).forEach(function(i){return t(i,e._threads[i])})},t}(),e.DatafeedRequestsCachedProcessor=r},function(t,e,i){(function(e){"use strict";var o=i(298).PlotType,n=i(258),s=function(){function t(t){e.enabled("charting_library_debug_mode")&&console.warn("Overrides:"+t)}function s(t,e,i,o){t.defaults.inputs[e]=o,t.inputs[i].defval=o}function r(t,e){t.defaults.precision=e}function a(e,i,o,n){var s,r,a=o[1];if("color"===a){if(s=c(e,i),r=o.length>2?parseInt(o[2]):NaN,null==s&&!isNaN(r)&&r>0)return void t("Plot `{1}` of `{0}` does not have color #{2}".format(e.description,o[0],r));0==r||isNaN(r)?(e.defaults.styles[i].color=n,null!=s&&(s.colors[0].color=n)):s.colors[r].color=n}else{if(!e.defaults.styles[i].hasOwnProperty(a))return void t("Plot `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],a));"plottype"===a&&(n=y[n]),e.defaults.styles[i][a]=n}}function l(e,i,o,n){var s=o[1];if(!e.defaults.bands[i].hasOwnProperty(s))return void t("Band `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],s));"plottype"===s&&(n=y[n]),e.defaults.bands[i][s]=n}function h(e,i,o,n){var s=o[1];if(!e.defaults.filledAreasStyle[i].hasOwnProperty(s))return void t("Area `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],s));e.defaults.filledAreasStyle[i][s]=n}function c(t,e){for(var i in t.plots)if("colorer"===t.plots[i].type&&t.plots[i].target===e)return t.defaults.palettes[t.plots[i].palette];return null}function d(t){var e,i,o=JSServer.studyLibrary;for(e=0;e<o.length;++e)if(i=o[e].metainfo,i.description.toLowerCase()===t.toLowerCase()||i.shortDescription.toLowerCase()===t.toLowerCase())return i;return null}function p(t,e){for(var i=0;i<t.inputs.length;++i)if(t.inputs[i].name.toLowerCase()===e.toLowerCase())return{id:t.inputs[i].id,index:i};return null}function u(t,e){for(var i in t.styles)if(t.styles[i].title.toLowerCase()===e.toLowerCase())return i;return null}function _(t,e){for(var i in t.filledAreas)if(t.filledAreas[i].title.toLowerCase()===e.toLowerCase())return t.filledAreas[i].id;return null}function f(t,e){if(!t.bands)return null;for(var i in t.bands)if(t.bands[i].name.toLowerCase()===e.toLowerCase())return i;return null}var m,g,v={"volume.transparency":"!transparency","upper limit":"UpperLimit","lower limit":"LowerLimit"},y={};if(Object.keys(o).forEach(function(t){y[t.toLowerCase()]=o[t]}),m={},m.setMetainfoProperty=function(e,i,o){var n,c,d,m,g,y,b,w,S,T,C;if(i=v[i]||i,n=i.split("."),c=n[0],0===c.indexOf("!"))return void(e[c.slice(1)]=o);d=c.split(":"),c=d[0],c=v[c]||c,m=null,g=null,y=null,b=null,w="options"===c,S="precision"===c&&e.defaults&&e.defaults.precision,T=2===d.length?d[1]:null,"plot"!==T&&T||(m=u(e,c)),"band"!==T&&T||(g=f(e,c)),"area"!==T&&T||(y=_(e,c)),"input"!==T&&T||(b=p(e,c)),C=!!m+!!g+!!b+!!w+!!y+!!S,
|
|
|
|
0===C?t("Study `{0}` has no plot or input `{1}`".format(e.description,c)):C>1?t("Study `{0}` ambiguous identifier `{1}`".format(e.description,c)):m?a(e,m,n,o):b?s(e,b.id,b.index,o):g?l(e,g,n,o):y?h(e,y,n,o):S?r(e,o):e[n[1]]=o},m.setProperty=function(e,i){var o=e.split(".")[0],n=d(o);if(!n)return void t("Study `{0}` not found".format(o));m.setMetainfoProperty(n,e.substring(o.length+1),i)},m.applyDefaultsToFactoryDefaults=function(t){var e={};t.forEach(function(t){var i=t.split(".")[0],o=d(i);o&&(e[o.id]=o)}),Object.keys(e).forEach(function(t){var i=e[t];n.createDefaultsForStudy(i)})},i(793),"undefined"!=typeof __initialMetainfoOverrides&&__initialMetainfoOverrides)for(g in __initialMetainfoOverrides)m.setProperty(g,__initialMetainfoOverrides[g]);return m}();t.exports=s}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e,i,o){this._chartWidgetCollection=t,this._chartSaverInstance=e,this._chartApiInstance=i,this._saveLoad=o}var n,s=i(435),r=i(798),a=i(448),l=i(66),h=i(463),c=i(71),d=i(171).closeAllDialogs,p=i(206),u=i(745),_=i(403),f=i(54);o.prototype.subscribe=function(t,e){l.subscribe(t,e)},o.prototype.onContextMenu=function(t){l.subscribe("onContextMenu",function(e){e.callback(t(e.unixtime,e.price))})},o.prototype.onGrayedObjectClicked=function(t){l.subscribe("onGrayedObjectClicked",t)},o.prototype.activeChart=function(){return new r(this._chartWidgetCollection.activeChartWidget.value())},o.prototype.changeSymbol=function(t,e,i){s.interval.setValue(e),s.symbol.setValue(t),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)},o.prototype.setLayout=function(t){this._chartWidgetCollection.layout.setValue(t)},o.prototype.layout=function(){return this._chartWidgetCollection.layout.value()},o.prototype.chartsCount=function(){return a[this.layout()].count},o.prototype.chart=function(t){if(void 0===t&&(t=0),t<0||t>this.chartsCount())throw Error("Incorrect index: "+t);return new r(this._chartWidgetCollection.getAll()[t])},o.prototype.getSymbolInterval=function(t){var e={symbol:s.symbol.value(),interval:s.interval.value()};return t&&t(e),e},o.prototype.getVisibleRange=function(t){var e=this.activeChart().getVisibleRange();return t&&t(e),e},o.prototype.saveChart=function(t){var e=this;this._chartSaverInstance.whenReadyToSave(function(){var i=e._chartSaverInstance.saveToJSON();return t&&t(JSON.parse(i.content))})},o.prototype.loadChart=function(t){this._chartApiInstance.purgeCache(),this._chartApiInstance._studyEngine.stopSources(),this._chartWidgetCollection.loadContent(t.json),this._chartWidgetCollection.purgeUnusedWidgets(),t.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(t.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(t.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(t.extendedData.name)),s.symbol.setValue(this.activeChart().symbol()),l.emit("chart_loaded")},o.prototype.getStudiesList=function(){return this._chartApiInstance.allStudiesMetadata().filter(function(t){return!t.is_hidden_study}).map(function(t){return t.name||t.description})},
|
|
|
|
0===C?t("Study `{0}` has no plot or input `{1}`".format(e.description,c)):C>1?t("Study `{0}` ambiguous identifier `{1}`".format(e.description,c)):m?a(e,m,n,o):b?s(e,b.id,b.index,o):g?l(e,g,n,o):y?h(e,y,n,o):S?r(e,o):e[n[1]]=o},m.setProperty=function(e,i){var o=e.split(".")[0],n=d(o);if(!n)return void t("Study `{0}` not found".format(o));m.setMetainfoProperty(n,e.substring(o.length+1),i)},m.applyDefaultsToFactoryDefaults=function(t){var e={};t.forEach(function(t){var i=t.split(".")[0],o=d(i);o&&(e[o.id]=o)}),Object.keys(e).forEach(function(t){var i=e[t];n.createDefaultsForStudy(i)})},i(793),"undefined"!=typeof __initialMetainfoOverrides&&__initialMetainfoOverrides)for(g in __initialMetainfoOverrides)m.setProperty(g,__initialMetainfoOverrides[g]);return m}();t.exports=s}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e,i,o){this._chartWidgetCollection=t,this._chartSaverInstance=e,this._chartApiInstance=i,this._saveLoad=o}var n,s=i(435),r=i(798),a=i(448),l=i(66),h=i(463),c=i(71),d=i(171).closeAllDialogs,p=i(206),u=i(745),_=i(403),f=i(54);o.prototype.subscribe=function(t,e){l.subscribe(t,e)},o.prototype.onContextMenu=function(t){l.subscribe("onContextMenu",function(e){e.callback(t(e.unixtime,e.price))})},o.prototype.onGrayedObjectClicked=function(t){l.subscribe("onGrayedObjectClicked",t)},o.prototype.activeChart=function(){return new r(this._chartWidgetCollection.activeChartWidget.value())},o.prototype.changeSymbol=function(t,e,i){s.interval.setValue(e),s.symbol.setValue(t),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)},o.prototype.setLayout=function(t){this._chartWidgetCollection.layout.setValue(t)},o.prototype.layout=function(){return this._chartWidgetCollection.layout.value()},o.prototype.chartsCount=function(){return a[this.layout()].count},o.prototype.chart=function(t){if(void 0===t&&(t=0),t<0||t>this.chartsCount())throw Error("Incorrect index: "+t);return new r(this._chartWidgetCollection.getAll()[t])},o.prototype.getSymbolInterval=function(t){var e={symbol:s.symbol.value(),interval:s.interval.value()};return t&&t(e),e},o.prototype.getVisibleRange=function(t){var e=this.activeChart().getVisibleRange();return t&&t(e),e},o.prototype.saveChart=function(t){var e=this;this._chartSaverInstance.whenReadyToSave(function(){var i=e._chartSaverInstance.saveToJSON();return t&&t(JSON.parse(i.content))})},o.prototype.loadChart=function(t){this._chartApiInstance.purgeCache(),this._chartApiInstance._studyEngine.stopSources(),this._chartWidgetCollection.loadContent(t.json),this._chartWidgetCollection.purgeUnusedWidgets(),t.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(t.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(t.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(t.extendedData.name)),s.symbol.setValue(this.activeChart().symbol()),l.emit("chart_loaded")},o.prototype.getStudiesList=function(){return this._chartApiInstance.allStudiesMetadata().filter(function(t){return!t.is_hidden_study}).map(function(t){return t.name||t.description})},
|
|
|
|
o.prototype.getSavedCharts=function(t){_.getCharts(t)},o.prototype.loadChartFromServer=function(t){_.loadChart(t)},o.prototype.saveChartToServer=function(t,e,i,o){this._chartSaverInstance.saveChartSilently(t,i,e,o)},o.prototype.removeChartFromServer=function(t,e){_.removeChart(t,e)},o.prototype.getIntervals=function(){return u.sortIntervals(u.getIntervals())},o.prototype.closePopupsAndDialogs=function(){c.dialogs.forEach(function(t){t.dialog.find("._tv-dialog-title-close").click()}),d(),h.hideAll()},n={cursor:"",dot:"",arrow_cursor:"arrow",eraser:"",measure:"",zoom:"",brush:"LineToolBrush"},o.prototype.selectLineTool=function(t){var e=i(800);if(e[t])t=e[t].name;else{if(!n.hasOwnProperty(t))return;t=n[t]||t}p.tool.value()!==t&&(TradingView.supportTouch()&&this._chartWidgetCollection.selectedSource.value()&&this._chartWidgetCollection.activeChartWidget.value().model().lineBeingCreated()&&this._chartWidgetCollection.activeChartWidget.value().model().cancelCreatingLine(),p.tool.setValue(t))},o.prototype.selectedLineTool=function(){var t,e,o,s=i(800),r=Object.keys(s),a=p.tool.value();for(t=0;t<r.length;++t)if(s[r[t]].name===a)return r[t];for(r=Object.keys(n),t=0;t<r.length;++t){if(e=r[t],(o=n[e])&&o===a)return r[t];if(e===a)return e}return""},o.prototype.createStudyTemplate=function(t,e){var i=this.activeChart().createStudyTemplate(t);return e&&e(i),i},o.prototype.mainSeriesPriceFormatter=function(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(t){function e(){i&&(i(),i=null)}t=t||{},t.title=t.title||"",t.body=t.body||"";var i=t.callback;c.showNotice(t.title,"",{html:t.body,onOkButtonClick:e}).on("destroy",e)},o.prototype.showConfirmDialog=function(t){function e(t){i&&(i(t),i=null)}if(t=t||{},t.title=t.title||"",t.body=t.body||"",!t.callback)throw Error("callback must be exist");var i=t.callback;c.showConfirm(t.title,t.body,e.bind(null,!0),e.bind(null,!1),{okButtonText:$.t("OK"),cancelButtonText:$.t("Cancel")}).on("destroy",e.bind(null,!1))},o.prototype.logs=function(){return{getLogHistory:f.getLogHistory,enable:f.loggingOn,disable:f.loggingOff}},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t){var e,i,o=Object.keys(p),n=o.length;for(e=0;e<n;++e)if(i=o[e],p[i].name===t)return i;return null}var n=i(799),s=i(796),r=i(258),a=i(204).DefaultProperty,l=i(331).availIcons,h=i(261),c=i(207).Interval,d=i(256),p=i(800),u=i(483).createTooManyStudiesNotice,_=function(t){this._chartWidget=t};_.prototype._makeSubscriptionFromDelegate=function(t){var e=$.extend({},t);return delete e.fire,e},_.prototype.executeAction=function(t){this._chartWidget.executeActionByName(t)},_.prototype.executeActionById=function(t){this._chartWidget.executeActionById(t)},_.prototype.getCheckableActionState=function(t){return this._chartWidget.getCheckableActionState(t)},_.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},_.prototype.clearMarks=function(){this._chartWidget.clearMarks()},_.prototype.symbol=function(){
|
|
|
|
o.prototype.getSavedCharts=function(t){_.getCharts(t)},o.prototype.loadChartFromServer=function(t){_.loadChart(t)},o.prototype.saveChartToServer=function(t,e,i,o){this._chartSaverInstance.saveChartSilently(t,i,e,o)},o.prototype.removeChartFromServer=function(t,e){_.removeChart(t,e)},o.prototype.getIntervals=function(){return u.sortIntervals(u.getIntervals())},o.prototype.closePopupsAndDialogs=function(){c.dialogs.forEach(function(t){t.dialog.find("._tv-dialog-title-close").click()}),d(),h.hideAll()},n={cursor:"",dot:"",arrow_cursor:"arrow",eraser:"",measure:"",zoom:"",brush:"LineToolBrush"},o.prototype.selectLineTool=function(t){var e=i(800);if(e[t])t=e[t].name;else{if(!n.hasOwnProperty(t))return;t=n[t]||t}p.tool.value()!==t&&(TradingView.supportTouch()&&this._chartWidgetCollection.selectedSource.value()&&this._chartWidgetCollection.activeChartWidget.value().model().lineBeingCreated()&&this._chartWidgetCollection.activeChartWidget.value().model().cancelCreatingLine(),p.tool.setValue(t))},o.prototype.selectedLineTool=function(){var t,e,o,s=i(800),r=Object.keys(s),a=p.tool.value();for(t=0;t<r.length;++t)if(s[r[t]].name===a)return r[t];for(r=Object.keys(n),t=0;t<r.length;++t){if(e=r[t],(o=n[e])&&o===a)return r[t];if(e===a)return e}return""},o.prototype.createStudyTemplate=function(t,e){var i=this.activeChart().createStudyTemplate(t);return e&&e(i),i},o.prototype.mainSeriesPriceFormatter=function(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(t){function e(){i&&(i(),i=null)}t=t||{},t.title=t.title||"",t.body=t.body||"";var i=t.callback;c.showNotice(t.title,"",{html:t.body,onOkButtonClick:e}).on("destroy",e)},o.prototype.showConfirmDialog=function(t){function e(t){i&&(i(t),i=null)}if(t=t||{},t.title=t.title||"",t.body=t.body||"",!t.callback)throw Error("callback must be exist");var i=t.callback;c.showConfirm(t.title,t.body,e.bind(null,!0),e.bind(null,!1),{okButtonText:$.t("OK"),cancelButtonText:$.t("Cancel")}).on("destroy",e.bind(null,!1))},o.prototype.logs=function(){return{getLogHistory:f.getLogHistory,enable:f.loggingOn,disable:f.loggingOff}},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t){var e,i,o=Object.keys(p),n=o.length;for(e=0;e<n;++e)if(i=o[e],p[i].name===t)return i;return null}var n=i(799),s=i(796),r=i(258),a=i(204).DefaultProperty,l=i(331).availIcons,h=i(261),c=i(207).Interval,d=i(256),p=i(800),u=i(483).createTooManyStudiesNotice,_=function(t){this._chartWidget=t};_.prototype._makeSubscriptionFromDelegate=function(t){var e=$.extend({},t);return delete e.fire,e},_.prototype.executeAction=function(t){this._chartWidget.executeActionByName(t)},_.prototype.executeActionById=function(t){this._chartWidget.executeActionById(t)},_.prototype.getCheckableActionState=function(t){return this._chartWidget.getCheckableActionState(t)},_.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},_.prototype.clearMarks=function(){this._chartWidget.clearMarks()},_.prototype.symbol=function(){
|
|
|
|
return this._chartWidget.getSymbol()},_.prototype.symbolExt=function(){var t=this._chartWidget.model().mainSeries().symbolInfo();return t?{symbol:t.name,full_name:t.full_name,exchange:t.exchange,description:t.description,type:t.type}:null},_.prototype.resolution=function(){return this._chartWidget.model().mainSeries().properties().interval.value()},_.prototype.setSymbol=function(t,i){function o(){n._chartWidget.model().mainSeries().onDataLoaded().unsubscribe(null,o),i&&i()}if(t!==this.symbol()||e.enabled("same_data_requery")){var n=this;return this._chartWidget.model().mainSeries().onDataLoaded().subscribe(null,o),this._chartWidget.setSymbol(t)}},_.prototype.resetData=function(){this._chartWidget.model().mainSeries().rerequestData()},_.prototype.setResolution=function(t,e){function i(){o._chartWidget.model().mainSeries().onDataLoaded().unsubscribe(null,i),e&&e()}if((t=t.toUpperCase())!==this.resolution()){var o=this;return this._chartWidget.model().mainSeries().onDataLoaded().subscribe(null,i),this._chartWidget.setResolution(t)}},_.prototype.setEntityVisibility=function(t,e){var i,o=this._chartWidget.model().model().dataSourceForId(t);o&&(i=o.properties())&&i.visible&&i.visible.setValue(e)},_.prototype.getAllStudies=function(){return this._chartWidget.model().model().allStudies().map(function(t){return{id:t._id,name:t._metaInfo.description}})},_.prototype.getAllShapes=function(){return this._chartWidget.model().model().allLineTools().map(function(t){return{id:t._id,name:o(t.toolname)}}).filter(function(t){return null!==t.name})},_.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},_.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},_.prototype.removeEntity=function(t){var e=this._chartWidget.model().chartModel().dataSourceForId(t);if(!e)return void console.warn("Can't find a source with id: "+t);this._chartWidget.model().chartModel().removeSource(e,!0)},_.prototype.createStudyTemplate=function(t){return this._chartWidget.model().model().studyTemplate(t.saveInterval)},_.prototype.applyStudyTemplate=function(t){this._chartWidget.model().model().restoreStudyTemplate(t,""+1e3*Math.random())},_.prototype.setVisibleRange=function(t,e){if(void 0===t||!t.from||!t.to||isNaN(t.from)||isNaN(t.to))return void console.warn("Wrong time range: "+JSON.stringify(t));var i=this._alignPoints([parseInt(t.from),parseInt(t.to)]);t.from=i[0],t.to=i[1],this._chartWidget.setVisibleTimeRange(t.from,t.to,e)},_.prototype.getVisibleRange=function(){var t=this._chartWidget.model().timeScale(),e=t.visibleBars(),i={from:t.indexToUserTime(e.firstBar()<0?0:e.firstBar()),to:t.indexToUserTime(e.lastBar())};return{from:(+i.from||0)/1e3,to:(+i.to||0)/1e3}},_.prototype.getVisiblePriceRange=function(){return this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null},_.prototype._createTradingPrimitive=function(t,e){function i(){var t=o._chartWidget.model().timeScale().m_points.lastTimePointIndex();return{index:t,
|
|
|
|
return this._chartWidget.getSymbol()},_.prototype.symbolExt=function(){var t=this._chartWidget.model().mainSeries().symbolInfo();return t?{symbol:t.name,full_name:t.full_name,exchange:t.exchange,description:t.description,type:t.type}:null},_.prototype.resolution=function(){return this._chartWidget.model().mainSeries().properties().interval.value()},_.prototype.setSymbol=function(t,i){function o(){n._chartWidget.model().mainSeries().onDataLoaded().unsubscribe(null,o),i&&i()}if(t!==this.symbol()||e.enabled("same_data_requery")){var n=this;return this._chartWidget.model().mainSeries().onDataLoaded().subscribe(null,o),this._chartWidget.setSymbol(t)}},_.prototype.resetData=function(){this._chartWidget.model().mainSeries().rerequestData()},_.prototype.setResolution=function(t,e){function i(){o._chartWidget.model().mainSeries().onDataLoaded().unsubscribe(null,i),e&&e()}if((t=t.toUpperCase())!==this.resolution()){var o=this;return this._chartWidget.model().mainSeries().onDataLoaded().subscribe(null,i),this._chartWidget.setResolution(t)}},_.prototype.setEntityVisibility=function(t,e){var i,o=this._chartWidget.model().model().dataSourceForId(t);o&&(i=o.properties())&&i.visible&&i.visible.setValue(e)},_.prototype.getAllStudies=function(){return this._chartWidget.model().model().allStudies().map(function(t){return{id:t._id,name:t._metaInfo.description}})},_.prototype.getAllShapes=function(){return this._chartWidget.model().model().allLineTools().map(function(t){return{id:t._id,name:o(t.toolname)}}).filter(function(t){return null!==t.name})},_.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},_.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},_.prototype.removeEntity=function(t){var e=this._chartWidget.model().chartModel().dataSourceForId(t);if(!e)return void console.warn("Can't find a source with id: "+t);this._chartWidget.model().chartModel().removeSource(e,!0)},_.prototype.createStudyTemplate=function(t){return this._chartWidget.model().model().studyTemplate(t.saveInterval)},_.prototype.applyStudyTemplate=function(t){this._chartWidget.model().model().restoreStudyTemplate(t,""+1e3*Math.random())},_.prototype.setVisibleRange=function(t,e){if(void 0===t||!t.from||!t.to||isNaN(t.from)||isNaN(t.to))return void console.warn("Wrong time range: "+JSON.stringify(t));var i=this._alignPoints([parseInt(t.from),parseInt(t.to)]);t.from=i[0],t.to=i[1],this._chartWidget.setVisibleTimeRange(t.from,t.to,e)},_.prototype.getVisibleRange=function(){var t=this._chartWidget.model().timeScale(),e=t.visibleBars(),i={from:t.indexToUserTime(e.firstBar()<0?0:e.firstBar()),to:t.indexToUserTime(e.lastBar())};return{from:(+i.from||0)/1e3,to:(+i.to||0)/1e3}},_.prototype.getVisiblePriceRange=function(){return this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null},_.prototype._createTradingPrimitive=function(t,e){function i(){var t=o._chartWidget.model().timeScale().m_points.lastTimePointIndex();return{index:t,
|