Custom indicator displays wrong values in visual mode backtesting
Never mind, I solved it by removing this statement:
// Initialize the previous longStop and shortStop values on the first run if(i == start) { longStopPrev = MAvg - fark; // Start at MAvg - fark shortStopPrev = MAvg + fark; // Start at MAvg + fark }
Hey guys,
I wrote a custom indicator that has two buffers, named as VIDYA and OTT. The problem is they show correct values when dropped on the chart, but wrong OTT values when testing in visual mode. VIDYA values are correct in both modes.
Does anyone have an idea about the reason and solution?
Below is the code of the indicator and two screenshots showing the difference between the chart and visual-mode testing.