How do I access the previous bar’s data? high(), low(), close(). Please, I see many questions regarding this but absolutely no answers.
This one is fairly easy:
map(d,index, history) {
const currentHigh = d.high();
const currentLow = d.low();
const prevHigh = history.prior().high();
const prevLow = history.prior().low();
}
Other commands you can find here:
I would suggest you go through tradovates custom indicator intro:
https://tradovate.github.io/custom-indicators/pages/Tutorial/index.html
I wouldn´t call it a tutorial.
Latter day traders youtube playlist helped me too.
Thank you. Some of the links will help I’m sure. I must say, so far the developer experience has been nothing less than brutal here
Update:
since index is set to 0 at the start, you need to add an if clause:
map(d,index, history) {
if(index > 0){
const currentHigh = d.high();
const currentLow = d.low();
const prevHigh = history.prior().high();
const prevLow = history.prior().low();
}
}