Bonjour a tous,
j'aurais besoin de votre aide car j'ai trouvé Un petit script très simple qui prend la relève de la gestion des ordres dès qu’on passe un ordre en manuel.
Ce script prend la main, dès que l’on passe un ordre, sur cet ordre.
Il lui ajoute un stoploss prédéfini. Il ramène ce stoploss sur le cours d’entrée lorsque le cours atteint le seuil de breakeven, peut aussi gérer un take profit, et même pyramider les entrées en les sécurisant.
il marche tres bien en buy mais en sell ne marche pas pourriez si vous m indiqué d'ou vient le bug ..
merci
//+------------------------------------------------------------------+
//| OBO_Order_Management.mq4 |
//| Copyright © 2009, Christophe Sangouard |
//| O-BO: Bourse, forex et trading |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Christophe Sangouard"
#property link "http://www.o-bo.com/"
//---- parametres saisis
extern int StopLoss=100;
extern int BreakEven=3000;
extern bool Pyramidage=true;
extern int TakeProfit=500;
//+------------------------------------------------------------------+
//| initialization de l'expert |
//+------------------------------------------------------------------+
int init()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| deinitialisation de l'expert |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| démarrage de l'expert |
//+------------------------------------------------------------------+
int start()
{
if (OrdersTotal()>0) OrdersList();
return(0);
}
//+------------------------------------------------------------------+
void OrdersList()
{
for (int cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS);
if (OrderSymbol()==Symbol())
{
if (OrderType()==OP_BUY)
{
if (OrderStopLoss()==0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOp enPrice()-StopLoss*Point,OrderOpenPrice()+TakeProfit*Point,0 ,LightGreen);
return(0);
}
//---- BreakEven
if (Bid-OrderOpenPrice()>Point*BreakEven&&OrderStopLoss()< OrderOpenPrice())
{
if(Pyramidage==true)
{OrderModify(OrderTicket(),OrderOpenPrice(),OrderO penPrice()+StopLoss*Point,OrderTakeProfit(),0,Ligh tGreen);
OrderSend(Symbol(),OP_BUY,0.1,Bid,30,0,0,NULL,1234 56,Red);}
else
{OrderModify(OrderTicket(),OrderOpenPrice(),OrderO penPrice(),OrderTakeProfit(),0,LightGreen);
return(0);}
}
}
if (OrderType()==OP_SELL)
{
if (OrderStopLoss()==0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOp enPrice()+StopLoss*Point,OrderOpenPrice()+TakeProf it*Point,0,Yellow);
return(0);
}
//---- BreakEven
if (OrderOpenPrice()-Ask>Point*BreakEven&&OrderStopLoss()>OrderOpenPric e())
{
if(Pyramidage==true)
{OrderModify(OrderTicket(),OrderOpenPrice(),OrderO penPrice()-StopLoss*Point,OrderTakeProfit(),0,LightGreen);
OrderSend(Symbol(),OP_SELL,0.1,Bid,30,0,0,NULL,123 456,Red);}
else
{OrderModify(OrderTicket(),OrderOpenPrice(),OrderO penPrice(),OrderTakeProfit(),0,Yellow);
}
return(0);
}
}
}
}
}
![]() |
|


LinkBack URL
About LinkBacks
Répondre avec citation