This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>To send command into some widget we use PostMessage (https://developer.mozilla.org/ru/docs/Web/API/Window/postMessage)<br> | |
Way to find required <iframe> is option "id" passed for initialization</p> | |
<p>Javascript and further HTML is Exapmle</p> | |
<p>NOTE: We use this tricky way because we need to handle all widgets the same. Both initialized with tv.js (https://www.tradingview.com/widget/advanced-chart/) and initialized self-replaced script (https://www.tradingview.com/widget/technical-analysis/)</p> | |
<!-- Example start --> | |
<!-- Advanced chart widget initialization --> | |
<div id="advanced-chart-widget-container"></div> | |
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatValue(value, field) { | |
var number = parseFloat(value); | |
// floats greater than maxNumberic will be formatted like an integer | |
var maxNumeric = Math.pow(10, 6); | |
if (isNaN(number)) { | |
return value; | |
} | |
if (fieldTypes[field] === 'percent') { |