Hello,
I fall in a problem where the following code directly uses iCustom works
But the below using a middle variable doesn't work.
I thought that the above 2 codes should be be the same. Definitely I am wrong but I dont know how to fix it.
Please help.
Many thanks.
HHC
Maybe this?
double good=0.0; double medium1=iCustom(NULL,0,"indiname",7,10,199,0,i); if(medium1==-3 ) good=1; sell[i]=good;
Maybe this?
Thanks, Iceron.
but why your works and mine fail? I am really curious.
HHC
Thanks, Iceron.
but why your works and mine fail? I am really curious.
HHC
double medium1=iCustom(NULL,0,"indiname",7,10,199,0,i); if(medium1==-3 ) { double good=1; //variable good is declared and assigned a value //scope of good is only between the brackets } //good is already out of scope sell[i]=good; //unknown variable good (undeclared identifier)
Your code is fine, but you are using #property strict on your code.
New MQL4 with #property strict: Variable scope is from declaration to the end of the block, in which the variable is declared
http://docs.mql4.com/mql4changes#compiler_difference
Either remove the strict property or update the code to the changes.Hello,
I fall in a problem where the following code directly uses iCustom works
But the below using a middle variable doesn't work.
I thought that the above 2 codes should be be the same. Definitely I am wrong but I dont know how to fix it.
Please help.
Many thanks.
HHC
double medium1=0;//or int medium1=0;
medium1=iCustom(NULL,0,"indiname",7,10,199,0,i);
double good=0;//or int good=0;
if(medium1==-3 ) good=1;
sell[i]=good;
Thanks you all for explaining.
HHC
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I fall in a problem where the following code directly uses iCustom works
But the below using a middle variable doesn't work.
I thought that the above 2 codes should be be the same. Definitely I am wrong but I dont know how to fix it.
Please help.
Many thanks.
HHC