@arul67800 Not sure which stream you're planning to use, but you can get an idea from this demo https://github.com/tvjsx/trading-vue-js/blob/master/test/tests/DataHelper.vue
Or you can try socket.io if you're building your own stream
@C451 Sorry to trouble you. I've go through the script test demo then checked SMA function in script_std.js file. But what I understood is that function going through all the visible candles and get SUM of last x candle starting from each visible candle. Is there any way to get only last x candles data?
Hope my question is understandable 😊 For the time being I'm getting candles data using DC.get_one('chart'), inside the draw function on my custom overlay. But I'm not sure this is the optimized way to do it.
Thanks
init: `
// here you calculate your sum
for (var i = 0 ...) { ohlcv[i] }
`,
post: `
// here you post it to the settings:
settings({ result })
`
@MhdBssd_gitlab Basically you have to pass the previous candle to candle.js file from candle.vue (Modify this line for that new Candle(this, ctx, c)
) This is what I did 👇
1) Changed this for of for (var c of cnv.candles) {
to loop to normal loop for (let i = 0; i < cnv.candles.length; i++) {
2) Instead of this new Candle(this, ctx, c)
➡️
const pc = i != 0 ? cnv.candles[i-1] : undefined; // previous candle
const c = cnv.candles[i]; // current candle
new Candle(this, ctx, c, pc); // sending both candles
3) change constructor function in candle.js to retrieve the previous candle ex: constructor(overlay, ctx, data, prev)
then pass it to draw function this.draw(data, prev);
4) Inside draw function do whatever logic you need and change body & wick colour
## [0.9.0] - 2020-11-17
* Scripts: advanced samplers (sym() function)
* Implemented Dataset ops (update, merge, remove)
* Countless small bug fixes as always
* Scripts: add onclose()
* Fixed auto-scroll (when new candle is added)
* Scripts: offchart/onchart updates
* DC: aggtool v2 (completely rewritten)
* Custom legend buttons (your custom icon)
* Tool groups
* Scroll wheel modes: prevent, pass, click
* WebWorker RAM limit
* LineTool: add Ray mode
* Legend buttons handlers [EXT]
🙏🙏🙏## [0.9.0] - 2020-11-17 * Scripts: advanced samplers (sym() function) * Implemented Dataset ops (update, merge, remove) * Countless small bug fixes as always * Scripts: add onclose() * Fixed auto-scroll (when new candle is added) * Scripts: offchart/onchart updates * DC: aggtool v2 (completely rewritten) * Custom legend buttons (your custom icon) * Tool groups * Scroll wheel modes: prevent, pass, click * WebWorker RAM limit * LineTool: add Ray mode * Legend buttons handlers [EXT]
@C451 that's quite hidden, but exactly what I'm looking for. Thank you!
On another note, I started using the Ichimoku overlay and I found it kind of buggy with the small spaces between the drawn elements, where the wicks are, and triangles drawn with different colors where the cloud switches from positive to negative (sorry, I don't have the perfect trading vocab for this). So, locally I rewrote it and was thinking about publishing it, just in case it helps others. I'll still have to clean it up, but should I just send a pull request to the current Ichimoku overlay, or create a new "Ichimoku improved" version?