Custom Study without labels
by sonylnagale
HTML
<link rel="stylesheet" href="https://jsfiddle.chartiq.com/chart/css/stx-chart.css">
<div class="chartContainer" style="width:600px;height:400px;position:relative;"></div>
<script src="https://jsfiddle.chartiq.com/chart/examples/data/STX_SAMPLE_DAILY.js"></script>
<script src="https://jsfiddle.chartiq.com/chart/js/chartiq.js"></script>
JavaScript
const chart = new CIQ.ChartEngine({
container: document.querySelector('.chartContainer')
})
let myStudy = {}
Object.assign(myStudy, CIQ.Studies.studyLibrary['Bollinger Bands'])
myStudy = {
atributes: {
'Standard Deviations': { min: 0.1, step: 0.1 },
'labels': false,
},
name: 'bull Bollinger Bands',
calculateFN: CIQ.Studies.calculateBollinger,
seriesFN: (stx, sd, quotes) => {
chart.preferences.labels = false
CIQ.Studies.displayChannel(stx, sd, quotes)
chart.preferences.labels = true
},
inputs: {
'Period': 20,
'Field': 'field',
'Channel Fill': false,
'Standard Deviations': 2,
'Moving Average Type': 'ma'
},
outputs: {
'Bollinger Bands Bottom': 'auto',
'Bollinger Bands Median': 'auto',
'Bollinger Bands Top': 'auto',
}
}
chart.loadChart('SPY', sampleData)
CIQ.Studies.addStudy(chart, "ma", {
id: "Moving Average"
}, null, null, 'chart');
CIQ.Studies.addStudy(chart, "Bollinger Bands", {
id: "bb"
}, null, null, 'chart', myStudy);