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";
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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