Probleme de commande EA
Publié : 21 mai 2013, 21:16
Bonjour à tous,
je créer ce sujet car j'ai un problème avec un message de mon metaeditor qui me dit :
" if - semicolon expected"
Voici si dessous mon EA que j'ai commencer c'est sur le croisement de moyenne mobile Simple 5 et 10
donc moi j'ai fait sa :
//+------------------------------------------------------------------+
//| Moyenne Mobile Simple 5-10 .mq4 |
//| Test n1 |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Test n1"
#property link ""
// Variable Externes
extern int MAGIC_NUMBER = 123456;
extern double LOT = 0.01;
// Variables Globales
double MMS5, MMS10;
double MMS5_p, MMS10_p;
int Ticket;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
MMS5 = iMA(Symbol (),0,5,2,MODE_SMA, PRICE_CLOSE, 0);
MMS10 = iMA(Symbol (),0,10,2,MODE_SMA, PRICE_CLOSE, 0);
MMS5 = iMA(Symbol (),0,5,2,MODE_SMA, PRICE_CLOSE, 1);
MMS10 = iMA(Symbol (),0,10,2,MODE_SMA, PRICE_CLOSE, 1);
iF(isTrade() == false)
(
// Vendre
if(MMS5_p > MMS10_p && MMS5 < MMS10)
(
Ticket = OrderSend(Symbol(), OP_SELL, LOT,Bid 3, 0, 0, NULL, MAGIC_NUMBER, 0, Red);
)
// Achat
if(MMS5_p < MMS10_p && MMS5 > MMS10)
(
Ticket = OrderSend(Symbol(), OP_BUY, LOT,Ask 3, 0, 0, NULL, MAGIC_NUMBER, 0, Green);
)
)
else
(
if(OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES) == true)
(
if(OrderType() ==OP_SELL)
(
if(MMS5_p < MMS10_p && MMS5 > MMS10)
(
OrderClose(Ticket, OrderLots(), Ask, 3, Blue);
)
)
if(OrderType() == OP_BUY)
(
if(MMS5_p > MMS10_p && MMS5 < MMS10)
(
OrderClose(Ticket, OrderLots(), Ask, 3, Blue);
)
)
)
)
return(0);
}
bool isTrade()
if(OrdersTotal() >= 1)
(
return(true);
)
else
(
return(false);
)
Merci a vous =)
je créer ce sujet car j'ai un problème avec un message de mon metaeditor qui me dit :
" if - semicolon expected"
Voici si dessous mon EA que j'ai commencer c'est sur le croisement de moyenne mobile Simple 5 et 10
donc moi j'ai fait sa :
//+------------------------------------------------------------------+
//| Moyenne Mobile Simple 5-10 .mq4 |
//| Test n1 |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Test n1"
#property link ""
// Variable Externes
extern int MAGIC_NUMBER = 123456;
extern double LOT = 0.01;
// Variables Globales
double MMS5, MMS10;
double MMS5_p, MMS10_p;
int Ticket;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
MMS5 = iMA(Symbol (),0,5,2,MODE_SMA, PRICE_CLOSE, 0);
MMS10 = iMA(Symbol (),0,10,2,MODE_SMA, PRICE_CLOSE, 0);
MMS5 = iMA(Symbol (),0,5,2,MODE_SMA, PRICE_CLOSE, 1);
MMS10 = iMA(Symbol (),0,10,2,MODE_SMA, PRICE_CLOSE, 1);
iF(isTrade() == false)
(
// Vendre
if(MMS5_p > MMS10_p && MMS5 < MMS10)
(
Ticket = OrderSend(Symbol(), OP_SELL, LOT,Bid 3, 0, 0, NULL, MAGIC_NUMBER, 0, Red);
)
// Achat
if(MMS5_p < MMS10_p && MMS5 > MMS10)
(
Ticket = OrderSend(Symbol(), OP_BUY, LOT,Ask 3, 0, 0, NULL, MAGIC_NUMBER, 0, Green);
)
)
else
(
if(OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES) == true)
(
if(OrderType() ==OP_SELL)
(
if(MMS5_p < MMS10_p && MMS5 > MMS10)
(
OrderClose(Ticket, OrderLots(), Ask, 3, Blue);
)
)
if(OrderType() == OP_BUY)
(
if(MMS5_p > MMS10_p && MMS5 < MMS10)
(
OrderClose(Ticket, OrderLots(), Ask, 3, Blue);
)
)
)
)
return(0);
}
bool isTrade()
if(OrdersTotal() >= 1)
(
return(true);
)
else
(
return(false);
)
Merci a vous =)