salut j ai une erreur de compilaton merc de faire un geste

Présentation, Développement, Améliorations et Ressources pour les Stratégies de Trading Automatique.

Modérateur : Administrateurs

Message
Auteur
Rmarc972
Membre actif
Messages : 10
Inscription : 03 oct. 2012, 15:38

salut j ai une erreur de compilaton merc de faire un geste

#1 Message par Rmarc972 »

ea achat 100/%
les modification portes sur l ouverture au du stop loss
d une nouvelle position d achat 50 ou 100 pips
merci


//+------------------------------------------------------------------+
//| test.mq4 |
//| Rmarc |
//| |
//+------------------------------------------------------------------+
#property copyright "Rmarc"
#property link "marc"
//---- input parameters
extern string time_trader_v2="visit http://www.FxAutomated.com for more!!!";
extern double Lots=0.1;
extern int TakeProfit=20;
extern int TakeProfit1=20;
extern int Slip=0.00001;
extern bool AllowBuy=true;
extern bool AllowBuy1=true;
extern string MagicNumbers="To be changed in case of conflict with other EAs";
extern int BuyMagicNumber =12001;
extern int BuyMagicNumber1 =12002;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
Alert("Rmarc");
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert starts |
//+------------------------------------------------------------------+

int start()
{
//----
int StopMultd,Sleeper=1;



int digits=MarketInfo("EURUSD",MODE_DIGITS);
StopMultd=1;
double TP=NormalizeDouble(TakeProfit*StopMultd,Digits);
double TP1=NormalizeDouble(TakeProfit*StopMultd,Digits);
int Slippage=Slip*StopMultd;

// Calculate take profit
double tpb=NormalizeDouble(Ask+TP*Point,Digits);
double tpb1=NormalizeDouble(Ask+TP1*Point,Digits);

//-------------------------------------------------------------------+
//Check open orders
//-------------------------------------------------------------------+
if(OrdersTotal()>0){
for(int i=1; i<=OrdersTotal(); i++) // Cycle searching in orders
{
if (OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available
{
if(OrderMagicNumber()==BuyMagicNumber) {int halt1=1;}
if(OrderMagicNumber()==BuyMagicNumber1) {int halt11=1;}
}
}
}
//-------------------------------------------------------------------+


if((halt1!=1)&&(AllowBuy==true)){// halt1

// Buy criteria
//Signal Buy
{
int openbuy=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"buy order",BuyMagicNumber,0,Blue);
if(openbuy<1){int buyfail=1;}


}/ halt1

if((halt11!=1)&&(AllowBuy1==true)){// halt11
RefreshRates();
// Buy criteria
//Signal Buy
{
int openbuy1=OrderSend (Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"buy order",BuyMagicNumber,0,Blue);
if(openbuy1<1){int buy1fail=1;}
}
}
}//halt2

//-----------------------------------------------------------------------------------------------------
if(OrdersTotal()>0){
for(i=1; i<=OrdersTotal(); i++){ // Cycle searching in orders

if (OrderSelect(i-1,SELECT_BY_POS)==true){ // If the next is available

if((OrderMagicNumber()==BuyMagicNumber)&&(OrderTakeProfit()0()==0||()==0)) { OrderModify(OrderTicket(),0,0,tpb,0,CLR_NONE); }
if((OrderMagicNumber()==BuyMagicNumber1)&&(OrderTakeProfit()0()==0||()==0)) { OrderModify(OrderTicket(),0,0,tpb1,0,CLR_NONE); }

}
}
}
//-------------------------------------------------------------------+
// Error processing
//-------------------------------------------------------------------+
if(buyfail==1||buy1fail==1{
int Error=GetLastError();
if(Error==130){Alert("Wrong stops. Retrying."); RefreshRates();}
if(Error==133){Alert("Trading prohibited.");}
if(Error==2){Alert("Common error.");}
if(Error==146){Alert("Trading subsystem is busy. Retrying."); Sleep(150); RefreshRates();}

}


//-------------------------------------------------------------------+
return(0);
}

Code : Tout sélectionner

[code]
[/code]
Pièces jointes
test.mq4
(3.96 Kio) Téléchargé 281 fois

anthony
Membre actif et régulier
Messages : 53
Inscription : 10 août 2012, 23:08

Re: salut j ai une erreur de compilaton merc de faire un geste

#2 Message par anthony »

Facile 1er erreur ligne 104 fermer le if avec le ")"
if(buyfail==1||buy1fail==1){
et seconde erreur ligne 95 et 96 OrderTakeProfit()0()==0||()==0) cela est impossible donc c mieux comme sa OrderTakeProfit()==0)

le code au complet


//+------------------------------------------------------------------+
//| test.mq4 |
//| Rmarc |
//| http://trackertendance-forex.e-monsite.com |
//+------------------------------------------------------------------+
#property copyright "Rmarc"
#property link "http://trackertendance-forex.e-monsite.com"
//---- input parameters
extern string time_trader_v2="visit www.FxAutomated.com for more!!!";
extern double Lots=0.1;
extern int TakeProfit=20;
extern int TakeProfit1=20;
extern int Slip=0.00001;
extern bool AllowBuy=true;
extern bool AllowBuy1=true;
extern string MagicNumbers="To be changed in case of conflict with other EAs";
extern int BuyMagicNumber =12001;
extern int BuyMagicNumber1 =12002;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
Alert("Rmarc");
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert starts |
//+------------------------------------------------------------------+

int start()
{
//----
int StopMultd,Sleeper=1;



int digits=MarketInfo("EURUSD",MODE_DIGITS);
StopMultd=1;
double TP=NormalizeDouble(TakeProfit*StopMultd,Digits);
double TP1=NormalizeDouble(TakeProfit*StopMultd,Digits);
int Slippage=Slip*StopMultd;

// Calculate take profit
double tpb=NormalizeDouble(Ask+TP*Point,Digits);
double tpb1=NormalizeDouble(Ask+TP1*Point,Digits);

//-------------------------------------------------------------------+
//Check open orders
//-------------------------------------------------------------------+
if(OrdersTotal()>0){
for(int i=1; i<=OrdersTotal(); i++) // Cycle searching in orders
{
if (OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available
{
if(OrderMagicNumber()==BuyMagicNumber) {int halt1=1;}
if(OrderMagicNumber()==BuyMagicNumber1) {int halt11=1;}
}
}
}
//-------------------------------------------------------------------+


if((halt1!=1)&&(AllowBuy==true)){// halt1

// Buy criteria
//Signal Buy
{
int openbuy=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"buy order",BuyMagicNumber,0,Blue);
if(openbuy<1){int buyfail=1;}


}// halt1

if((halt11!=1)&&(AllowBuy1==true)){// halt11
RefreshRates();
// Buy criteria
//Signal Buy
{
int openbuy1=OrderSend (Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"buy order",BuyMagicNumber,0,Blue);
if(openbuy1<1){int buy1fail=1;}
}
}
}//halt2

//-----------------------------------------------------------------------------------------------------
if(OrdersTotal()>0){
for(i=1; i<=OrdersTotal(); i++){ // Cycle searching in orders

if (OrderSelect(i-1,SELECT_BY_POS)==true){ // If the next is available

if((OrderMagicNumber()==BuyMagicNumber)&&(OrderTakeProfit()==0)) { OrderModify(OrderTicket(),0,0,tpb,0,CLR_NONE); }
if((OrderMagicNumber()==BuyMagicNumber1)&&(OrderTakeProfit()==0)) { OrderModify(OrderTicket(),0,0,tpb1,0,CLR_NONE); }

}
}
}
//-------------------------------------------------------------------+
// Error processing
//-------------------------------------------------------------------+
if(buyfail==1||buy1fail==1){
int Error=GetLastError();
if(Error==130){Alert("Wrong stops. Retrying."); RefreshRates();}
if(Error==133){Alert("Trading prohibited.");}
if(Error==2){Alert("Common error.");}
if(Error==146){Alert("Trading subsystem is busy. Retrying."); Sleep(150); RefreshRates();}

}


//-------------------------------------------------------------------+
return(0);
}



voila =)

Rmarc972
Membre actif
Messages : 10
Inscription : 03 oct. 2012, 15:38

Re: salut j ai une erreur de compilaton merc de faire un geste

#3 Message par Rmarc972 »

salut anthony je te remercie du cou de main mais la 2 commande travaille en paralelle avec la premiere
si tu te penchés quand tu aura un moment
la combinaison suivante

ouverture prise de position 1
le marché par en sens inverse au lieu de coupé( stop loss)
ouverture d une autre position toujours a l achat
merci à bientot

anthony
Membre actif et régulier
Messages : 53
Inscription : 10 août 2012, 23:08

Re: salut j ai une erreur de compilaton merc de faire un geste

#4 Message par anthony »

et ? :)

Répondre