Voici le code que j'ai rentrer pour le moment, il manque pleins de choses notamment le else pour mes conditions de sorti et surtout la prise en compte dans mes conditions de ggtrendbar et semafor j’espère que vous allez pouvoir m'aider
//+------------------------------------------------------------------+
//| BELKASYS.mq4 |
//| Copyright 2012, wimz2012 |
//|
http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, wimz2012"
#property link "
http://www.metaquotes.net"
// Variables externes
extern string NOTE2 = " Parametres trade ";
extern double AccountRiskPercent = 0.1;
extern string Indicator_Setting = " Parametres
indicateurs ";
extern int FastMAPeriod = 3,
FastMAType = 1, //0:SMA 1:EMA 2:SMMA 3:LWMA
FastMAPrice = 0, //0:Close 1:Open 2:High 3:Low 4:Median 5:Typical 6:Weighted
FastMAshift = 0,
SlowMAPeriod = 34,
SlowMAType = 0, //0:SMA 1:EMA 2:SMMA 3:LWMA
SlowMAPrice = 0, //0:Close 1:Open 2:High 3:Low 4:Median 5:Typical 6:Weighted
SlowMAshift = 0;
int magicalNumber,ticket;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
magicalNumber = 00002;
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double MAFAST = iMA(NULL,0,FastMAPeriod,FastMAshift,FastMAType,FastMAPrice,0);
double MASLOW = iMA(NULL,0,SlowMAPeriod,SlowMAshift,SlowMAType,SlowMAPrice,0);
double MAFAST_p = iMA(NULL,0,FastMAPeriod,FastMAshift,FastMAType,FastMAPrice,1);
double MASLOW_p = iMA(NULL,0,SlowMAPeriod,SlowMAshift,SlowMAType,SlowMAPrice,1);
double TREND_D1 = iCustom(NULL,0,"GG-TrendBar",0,0);
double RETOUR = iCustom(NULL,0,"3_Level_ZZ_Semafor",0,0);
if (istrade() == false)
{
if (MAFAST_p < MASLOW_p && MAFAST > MASLOW)
{
ticket = OrderSend(Symbol(),OP_BUY,MathMin(NormalizeDouble((AccountBalance() + AccountCredit()) / 10000 * AccountRiskPercent,Ask,3,0,0,"BUY",magicalNumber,0,Green);
}
if (MAFAST_p > MASLOW_p && MAFAST < MASLOW)
{
ticket = OrderSend(Symbol(),OP_SELL,MathMin(NormalizeDouble((AccountBalance() + AccountCredit()) / 10000 * AccountRiskPercent,Bid,3,0,0,"SELL",magicalNumber,0,Red);
}
}
Comment( "GG-TrendBar : " + TREND_D1 + "\n3_Level_ZZ_Semafor" + RETOUR);
else
//----
return(0);
}
bool istrade ()
{
if (OrdersTotal () >= 1)
{
return (true) ;
}
else
{
return (false) ;
}
}
//+------------------------------------------------------------------+