Volume study
by TradingView
HTML
<script src="https://unpkg.com/lightweight-charts@4.0/dist/lightweight-charts.standalone.production.js"></script>
JavaScript
var chart = LightweightCharts.createChart(document.body, {
width: 600,
height: 300,
rightPriceScale: {
scaleMargins: {
top: 0.3,
bottom: 0.25,
},
borderVisible: false,
},
layout: {
background: {
type: 'solid',
color: '#131722',
},
textColor: '#d1d4dc',
},
grid: {
vertLines: {
color: 'rgba(42, 46, 57, 0)',
},
horzLines: {
color: 'rgba(42, 46, 57, 0.6)',
},
},
});
var areaSeries = chart.addAreaSeries({
topColor: 'rgba(38,198,218, 0.56)',
bottomColor: 'rgba(38,198,218, 0.04)',
lineColor: 'rgba(38,198,218, 1)',
lineWidth: 2,
});
var volumeSeries = chart.addHistogramSeries({
color: '#26a69a',
priceFormat: {
type: 'volume',
},
priceScaleId: '',
});
chart.priceScale('').applyOptions({
scaleMargins: {
top: 0.8,
bottom: 0,
},
});
areaSeries.setData([
{ time: '2018-10-19', value: 54.90 },
{ time: '2018-10-22', value: 54.98 },
{ time: '2018-10-23', value: 57.21 },
{ time: '2018-10-24', value: 57.42 },
{ time: '2018-10-25', value: 56.43 },
{ time: '2018-10-26', value: 55.51 },
{ time: '2018-10-29', value: 56.48 },
{ time: '2018-10-30', value: 58.18 },
{ time: '2018-10-31', value: 57.09 },
{ time: '2018-11-01', value: 56.05 },
{ time: '2018-11-02', value: 56.63 },
{ time: '2018-11-05', value: 57.21 },
{ time: '2018-11-06', value: 57.21 },
{ time: '2018-11-07', value: 57.65 },
{ time: '2018-11-08', value: 58.27 },
{ time: '2018-11-09', value: 58.46 },
{ time: '2018-11-12', value: 58.72 },
{ time: '2018-11-13', value: 58.66 },
{ time: '2018-11-14', value: 58.94 },
{ time: '2018-11-15', value: 59.08 },
{ time: '2018-11-16', value: 60.21 },
{ time: '2018-11-19', value: 60.62 },
{ time: '2018-11-20', value: 59.46 },
{ time: '2018-11-21', value: 59.16 },
{ time: '2018-11-23', value: 58.64 },
{ time: '2018-11-26', value: 59.17 },
{ time: '2018-11-27', value: 60.65 },
{ time: '2018-11-28', value: 60.06 },
{ time: '2018-11-29', value: 59.45 },
{ time: '2018-11-30',...