I wrote the below function in an EA to check to see the location of current price between 0-8 prices stored in an array that I have calculated. I thought you could return a value from a function but I keep getting zero instead of what the count was when price was located. Can anyone help me by telling me where I'm wrong? I int k at the beginning of the EA...
Thanks
Thanks
PHP Code
int locate_price() // Function to locate price between Gann lines
{ // Check all lines 0-8
for(k=0; k<9; k++)
{
if(level[10] == 1)
{
if(Bid>level[k] && Bid<level[k+1])
{
return(k);
}
else
{
return(0);
}
}
if(level[10] == 2)
{
if(Bid<level[k] && Bid>level[k+1]){
return(k);
}
else {
return(0);
}
}
}
}