Scope of global variables to program

 
Global variables to program are set values in the init() function are not visible while in the start() function, is this correct?

double dTest;
int init()
{
dTest=1.234;
return(0);
}
int start()
{
Comment( "dTest:", dTest ); // dTest:0
return(0);
}
 
as far as I can see it should work ... I'm using stuff like that in indies and experts all the time.

Is this an indicator, or expert, or script (possibly scripts don't have an init function ... does the init get called?)?


Markus
 
Thanks Markus, the code for my program first in the init() function set's up various values which will be used by the start() function when doing the analysis on each bar. When you said it should work, I tried the snippet of code above to describe the anomaly, and it worked, I then re-included that line of code in my program and it worked.
I have made so many changes to this program, I use the Comment() function a lot to test it as it progresses, so maybe the hard disk needs defragmenting, or is there a limit to the code size (number of lines)? Thanks again, Ted
 
Btw, you can use the Print function to print to the Expert tab in the Terminal area ... I like it better than Comment because you can see the sequence of outputs.


Markus
 
Thanks Markus.
Reason: