Cache problem?

 

I'm having a problem with an indicator, when I drop the indicator fresh onto the chart it gets executed normally, but when I recompile it, perhaps the first recompile it still works as it should, but on the 2nd or 3rd try, it just makes completely weird results.


I removed all code that could be executing for a long time, to avoid the case where it would be still working when i recompile... but no luck.


Is it possible that the code is still cached somehow, and I'm not getting the freshest version?


I also found that sometimes when i change something in the Alert(), it still gives me the old text. And when I change it again, it gives me the one i changed, but not the freshest. For example:

1. Code: Alert("1");

2. When i run, it outputs "1"

3. I change it to Alert("2");

4. It still outputs "1";

5. I change it to Alert("3");

6. It now outputs "2".

 

Ok with some code decostructing i have found that Comment is very expensive. Meaning, if you do Comment in the for() loop that cycles through all bars, it really slows it down.


So i have found, that it's wise to put an:

if ( i == 0 )

before every Comment() call. That is if variable "i" is the bar index.

 
The only sure way to see the indicator after compiling is to place it on the chart fresh each time and remove it from the chart before compiling. If you don't do this you will find some things get updated but others don't. Line sizes for instance revert to default and old arrows can be left instead of new positions etc. It is a right pain that the system doesn't initialise indicators correctly after compiling.
 
Ruptor:
It is a right pain that the system doesn't initialise indicators correctly after compiling.

i have also noticed, that variables stay in memory after testing has stopped and started again.