Download MetaTrader 5

I need help with coding an EA for mt4

To add comments, please log in or register
Abhinand Bajikumar Sreekala
876
Abhinand Bajikumar Sreekala  

Hi, i got an mql4 file of an EA and i would like to add a code in it.

i want the EA not to trade if the spread goes above 12 .

what should i do ? please help.


thanks in advance

Marco vd Heijden
Moderator
6147
Marco vd Heijden  
if(MarketInfo(Symbol(),MODE_SPREAD)<12)
{
  // Trade
}
Abhinand Bajikumar Sreekala
876
Abhinand Bajikumar Sreekala  
Marco vd Heijden:
if(MarketInfo(Symbol(),MODE_SPREAD)<12)
{
  // Trade
}
Hi , thank you... i should place this inside start function right ?
PCRider
26
PCRider  
Abhinand Bajikumar Sreekala:
Hi , thank you... i should place this inside start function right ?
Replace all Ordersend function in your code inside this structure which you have
or simply put this in start function after { :

if(MarketInfo(Symbol(),MODE_SPREAD)>12)
{
  return;
}
if your start function is not return void type:

if(MarketInfo(Symbol(),MODE_SPREAD)>12)
{
  return 0;
}
BTW, it is very bad Idea to stop trading when spread is over than a number
whroeder1
17063
whroeder1  

Abhinand Bajikumar Sreekala: i want the EA not to trade if the spread goes above 12 . what should i do ? please help.

learn to code it, or pay (Freelance) someone to code it.
We're not going to code it for you.
We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
Abhinand Bajikumar Sreekala
876
Abhinand Bajikumar Sreekala  
PCRider:
Replace all Ordersend function in your code inside this structure which you have
or simply put this in start function after { :

if(MarketInfo(Symbol(),MODE_SPREAD)>12)
{
  return;
}
if your start function is not return void type:

if(MarketInfo(Symbol(),MODE_SPREAD)>12)
{
  return 0;
}
BTW, it is very bad Idea to stop trading when spread is over than a number
Thank you very much for your information. i will try it .
Abhinand Bajikumar Sreekala
876
Abhinand Bajikumar Sreekala  
whroeder1:
learn to code it, or pay (Freelance) someone to code it.
We're not going to code it for you.
We are willing to help you when you post your attempt (using SRC) and the nature of your problem.

Hi, I asked for "Help" .... it means make it easier for (someone) to do something by offering one's services or resources...And i never asked anyone to code a full program for me.

I know that there are some good people out there who are willing to help me and they are doing it too...(Because, sharing knowledge is the best thing you can do in your life).

Anyway...thanks for giving me links to study about mt4. i will do it.


honest_knave
Moderator
2342
honest_knave  
Abhinand Bajikumar Sreekala:
Thank you very much for your information. i will try it .

Be very careful with this if your EA manages or closes your trades as well as opens them. That code cripples your EA whenever spread > 12

Also be clear about the difference between points and pips 

To add comments, please log in or register