Adding additional content on chart

It is possible to design a chart page that will automatically display additional content, such as studies or drawings, on initial load. It is important to note that this is different from adding an injection API to the draw() function, which will render the injection not only on initial load, but every time the chart changes.

To do this, a callback function must be created and included as an argument for the newChart() function used to display your initial chart. The call back function will be executed after the chart is created and can be used to perform additional operations.

The following code snippet illustrates how this is done. In this case we are also asking for Klinger study and 3 Moving Average overlays to be rendered; so it would look as such:

stxx.newChart("SPY",null,null,function(err){
    if(!err){
        var inputs={"Signal Periods":13, "Short Cycle": 34, "Long Cycle": 55};
        var outputs={"Klinger":"auto","KlingerSignal":"#FF0000"};
        CIQ.Studies.quickAddStudy(stxx, "Klinger", inputs, outputs);

        var inputs= {"Period":20,"Field":"field","Type":"ma"};
        var outputs= {"MA":"red"};
        CIQ.Studies.quickAddStudy(stxx, "ma", inputs, outputs);

        var inputs= {"Period":50,"Field":"field","Type":"ma"};
        var outputs= {"MA":"blue"};
        CIQ.Studies.quickAddStudy(stxx, "ma", inputs, outputs);

        var inputs= {"Period":200,"Field":"field","Type":"ma"};
        var outputs= {"MA":"yellow"};
        CIQ.Studies.quickAddStudy(stxx, "ma", inputs, outputs);
    };
});

Once this callback function is executed, all additional functionality will be included in the chart window.

Example: