![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello all again,
Oops, I am telling lies here, I must have been tired last night when posting this.
It is actually Error #3 which is not the generic error, but "ERR_INVALID_TRADE_PARAMETERS" or Invalid parameters were passed to the trading function, for example, wrong symbol, unknown trade operation, negative slippage, non-existing ticket number, etc. The program logic must be changed.
I can probably fix this by myself later today.
Sorry for the trouble of reading this thread, I got mixed up with the Error reporting from 0,1,2,3 e.t.c instead of 1,2,3!
Howard
Need some help with arrayBsearch
Hi guys,
Still working on the Holy grail LOL I need some help with arrayBsearch if anyone can assist here, please PM me and send an email address so that I can forward yuo the two files that I need help on
Thanks
plz...can anybary help me...
I have a expert advisor....
it's work very well in backtest,
bat it not run in demo account....
why...what is wrong???![](https://c.mql5.com/forextsd/smiles/cry_smile.png)
Expert is heare...
Can anyone help me with my simple MA EA?
But i have hit a snag. The EA compiles ok. But when i run it it never opens an order.
Can anyone tell me what lines to add to get an order to open.
The general idea is just to have an OP_BUY order to open when the simple ma of 1 closes above the sma of 10.
For the purpose of this EA i am not concerned with TP, SL, or short orders.
It's just supposed to open an order every time the sma1 closes above the sma 10.
Any help will be greatly appreciated. And thanks in advanced to Coder Guru and the rest of you guys.
extern double Lots = 0.1;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
int Crossed (double line1, double line2)
{
static int lastDirection = 0;
static int currentDirection = 0;
if (line1>line2) currentDirection = 1;
if (line1<line2) currentDirection = 2;
if (currentDirection !=lastDirection)
{
lastDirection=currentDirection;
return(lastDirection);
}
else
{
return(0);
}
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int ticket, total;
double shortSMA, longSMA;
double Crossed;
if(Bars<100)
{
Print("There is not enough data to analyze");
return(0);
}
shortSMA=iMA(NULL,0,1,0,MODE_SMA,PRICE_OPEN,0);
longSMA=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,0);
int isCrossed=Crossed(shortSMA,longSMA);
total=OrdersTotal();
if(total<1)
if (Crossed ==1)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"Minute Chart",12345,0,Silver);
if (ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
Print("Buy order opened on Minute Chart at: ",OrderOpenPrice());
}
else
Print("Encountered Error on Minute Chart ", GetLastError());
return(0);
}
//----
//----
return(0);
}
//+------------------------------------------------------------------+
How to change alert into trading EA
Hi Guys,
How do you change an alert indicator into a trading EA?
I've tried changing the command Alert(Symbol()+" "+Period()+" XO Long ",Bid); into OrderSend(Symbol(),OP_BUY,0.01,Ask,3,20,20,"XO-CCI",1,0,Blue); at the start I chose menu to make EA, then content of my alert indicator, i copied to this EA, then I changed the command alert to trading command as above, then i compiled. But the compiled EA is not making any trade after i tried it on 1M chart for a day.
Please help.
my first ea based on fractal_dimension indicator
fractal_dimension indicator draw a line with the parameter e_ramdom_line= 1.5 I want my expert the stop trading when the fdi ( fractal dimension index) is >1.5, and continue trading when fdi is < 1.5.
I am looking for help writing an icustom to handle this condition inside my ea.
thanks
Expert Advisor
Please help...
How come the EA works with my Demo account but not with the Live account. (same set up, same broker, same everything...)
I believe some brokers don't allow EA's to be run by default. It might be worth checking with your broker.
Its also possible within the EA to determine if the account is a demo, take a look at the source code and see if the EA uses the function IsDemo, it may be the developer only wanted it to run on demo accounts