Weird !! can you see whats wrong ?

 

Hi,
Could you tell me why this function only returns "WAIT" and "SELL"
but NEVER any "BUY"?


//+------------------------------------------------------------------+
string Trending_for(string Trending)
{
if (Close[3]<Open[1])Trending="BUY";else Trending="Wait";
if (Close[3]>Open[1])Trending="SELL";else Trending="Wait";
Alert("TRENDING--------------- = ",Trending);
return(Trending);
}
//---------------------------------------------------------------------


______________________________________________________________________________
Question # 2
______________________________________________________________________________

I had another weird thing happening also.
In the following, (EX:1)
the EA would loop back in the Open_Trades function even Though the "if" conditions where not met.
But in EX:2 it cured it.
What is wrong with the first (EX:1)?

For the If state, Total_Orders is = to 1, Trade_Active is true, and Ready_to_Trade is false and EX:1 still went to the Open_Trades function.

______________________________________________________________________________

EX:1

int start()
{ Alert("(START) - ************* NEW TICK *******************");
Manage_Trade();

if (Total_Orders==0 && !Trade_Active && Ready_to_Trade)

{
Open_Trades();
}


______________________________________________________________________________

EX:2

int start()
{ Alert("(START) - ************* NEW TICK *******************");
Manage_Trade();

if (Total_Orders==0 && !Trade_Active && Ready_to_Trade) Open_Trades();

// {
// Open_Trades();
// }

______________________________________________________________________________

If anyone knows what could have gone wrong, I would appreciate an explanation.

Thanks for your help
Micky

 

Replace

if (Close[3]<Open[1])Trending="BUY";else Trending="Wait";
if (Close[3]>Open[1])Trending="SELL";else Trending="Wait";

to

if (Close[3]<Open[1])Trending="BUY";
else if (Close[3]>Open[1])Trending="SELL";else Trending="Wait";