"I don't believe you. Print the values and show the log." Stop telling us what you THINK you have and show us the printout of what you ACTUALLY have (both variables,) before the IF and put a print statement inside the IF showing it doesn't execute.
I donno what log you are talking about, so I decided to upload the screenshots. As you see, Here1 or Here2 message never gets printed (I waited for long dont worry) but the values of slope_up and slope_dn are as I reported above.
Thanks guys for your answers. The code above never enters into the if scope. I donno why. The Slope_Direction_Line draws a line with green and red colors. When the greenBuffer obtains the value RedBuffer obtains the value of EMPTY_VALUE and vise versa. Can you help me find out the reason why the if scope is never reached? Thank you
int start()
{
//----double val = 0;
int goodcnt = 0;
int badcnt = 0;
for(int i=0; i<1000000; i++)
{val = 2147483647;
if(val == EMPTY_VALUE)
{goodcnt++;
}
else
{badcnt++;
}}
Print ("val was not equal to EMPTY_VALUE ",badcnt," times.");
Print ("val was equal to EMPTY_VALUE ",goodcnt," times.");
Print ("EMPTY_VALUE is ",EMPTY_VALUE);
//----return(0);
}
output:
2013.08.16 22:41:42 EmptyValue test EURUSD,M1: EMPTY_VALUE is 2147483647
2013.08.16 22:41:42 EmptyValue test EURUSD,M1: val was equal to EMPTY_VALUE 1000000 times.
2013.08.16 22:41:42 EmptyValue test EURUSD,M1: val was not equal to EMPTY_VALUE 0 times.
Actually I had done such but the result was still the same (it didn't enter the if block). That's why I blamed it on EMPTY_VALUE equality and decided to normalize that value. If the script was like this:
I donno what log you are talking about, so I decided to upload the screenshots. As you see, Here1 or Here2 message never gets printed (I waited for long dont worry) but the values of slope_up and slope_dn are as I reported above.
Play video
For large amounts of code, attach it.
You don't need to normalize EMPTY_VALUE.
output:
2013.08.16 22:41:42 EmptyValue test EURUSD,M1: EMPTY_VALUE is 2147483647
2013.08.16 22:41:42 EmptyValue test EURUSD,M1: val was equal to EMPTY_VALUE 1000000 times.
2013.08.16 22:41:42 EmptyValue test EURUSD,M1: val was not equal to EMPTY_VALUE 0 times.
Actually I had done such but the result was still the same (it didn't enter the if block). That's why I blamed it on EMPTY_VALUE equality and decided to normalize that value. If the script was like this:
the result is identical, the if block is skipped. I believe Im getting you confused but I have no idea why it behaves such. What may I be missing?!
I dont know maybe you should try it like this to see where it fails.