ArrayBSearch Help Pls :)

 

Hi!


I have an array with ticket number in the 1st column, and I've been trying to figure out a way such that my function will return the index of the ticket number I input. When I try to compile the below, the compiler says "Search function returns no result".. Please explain to me how/why. :)



double BuyTable [100][9];


//+------------------------------------------------------------------+
//| Array Search |
//+------------------------------------------------------------------+
void Search(int Ticket)
{
return(ArrayBsearch(BuyTable,RecentSellTicket(),WHOLE_ARRAY, 0, MODE_ASCEND));
}

 

Since you are calling your Search function with the variable "Ticket", don't you need your search to be something like:

//+------------------------------------------------------------------+
//| Array Search |
//+------------------------------------------------------------------+

void Search(int Ticket)
{
return(ArrayBsearch(BuyTable,Ticket,WHOLE_ARRAY, 0, MODE_ASCEND));
}

Presumably somewhere in your code you made the function call "Search(RecentSellTicket())" or you set the variable Ticket equal to RecentSellTicket() at some point prior to calling Search(Ticket).

Reason: