Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   ganz kleines problem ordermodify (http://www.expert-advisor.com/forum/showthread.php?t=4328)

Thomas Welling 28.06.15 19:48

Hallo, hab nen funktionierenden Code, ist nicht von mir, kann aber benutzt werden



Code:

   
int start()
{
  itotal=OrdersTotal();
 
  for(int cnt=itotal-1;cnt>=0;cnt--)
  {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
     
      if (OrderSymbol()==Symbol() && OrderType()==OP_BUY)
      {
        ModifyStopLoss(OrderOpenPrice());   
      }
     
      if (OrderSymbol()==Symbol() && OrderType()==OP_SELL)
      {
        ModifyStopLoss(OrderOpenPrice());     
      } 
 
      if(OrderSymbol()==Symbol() && OrderType()==OP_BUY && Bid < OrderOpenPrice())
      {
        Alert("Unable to place SL Break Even - Bid below Order Open Price - Trade in Loss");
      } 
     
      if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && Ask > OrderOpenPrice())
      {
        Alert("Unable to place SL Break Even - Ask above Order Open Price - Trade in Loss");
      } 
  }
  return(0);
}

void ModifyStopLoss(double ldStopLoss)
{
  bool fmSL;
  fmSL=OrderModify(OrderTicket(),OrderOpenPrice(),ldStopLoss,OrderTakeProfit(),0,CLR_NONE);
}



Alle Zeitangaben in WEZ +2. Es ist jetzt 00:48 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum