Helloworld with 2 built-in studies using custom properties
This is the jsfiddle implementation of helloworld.html including the initial rendering of 2 built-in studies loaded using custom properties for 'input' and 'output' values
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/js/chartiq.js"></script>
<script src="https://jsfiddle.chartiq.com/chart/examples/feeds/quoteFeedSimulator.js"></script>
<script src="https://jsfiddle.chartiq.com/chart/examples/data/STX_SAMPLE_DAILY.js"></script>
JavaScript
var stxx = new CIQ.ChartEngine({
container: document.querySelector(".chartContainer")
});
stxx.attachQuoteFeed(quoteFeedSimulator, {
refreshInterval: 0
});
stxx.setChartType('none');
stxx.loadChart(" ", [{ DT: new Date(), Value: 100}], function() {
stxx.addSeries(
"GE", {
color: "yellow",
shareYAxis:true,
},
function() {
var inputs = {
"Period": 50,
"Field": "GE",
"Type": "ma"
};
var outputs = {
"MA": "blue"
};
CIQ.Studies.addStudy(stxx, "ma", inputs, outputs);
}
);
stxx.addSeries(
"Test", {
color: "purple",
shareYAxis:true,
},
function() {
// in this case we are adding a moving average study
var inputs = {
"Period": 50,
"Field": "Test",
"Type": "ma"
};
var outputs = {
"MA": "green"
};
CIQ.Studies.addStudy(stxx, "ma", inputs, outputs);
}
);
});