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 }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.