Einzelnen Beitrag anzeigen
  #28 (permalink)  
Alt 29.01.15
pako pako ist offline
Mitglied
 
Registriert seit: Sep 2012
Beiträge: 224
pako befindet sich auf einem aufstrebenden Ast
Standard

Code:
//+------------------------------------------------------------------+
//|                                                        daxV1.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
int countB,countS;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   countB=0;
   countS=0;
   for(int pos=OrdersTotal()-1; pos>=0; pos--)
     {
      if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==Symbol())
           {
            if(OrderType()==OP_BUY)
              {
               countB++;
               if(OrderStopLoss()==0)
                 {
                  bool res=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()-(OrderOpenPrice()/100)*0.5,Digits),0,0,Blue);
                  if(!res)
                     Print("Error in OrderModify. Error code=",GetLastError());
                  else
                     Print("Order modified successfully.");
                 }
              }
            if(OrderType()==OP_SELL)
              {
               countS++;
               if(OrderStopLoss()==0)
                 {
                  bool res=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()+(OrderOpenPrice()/100)*0.5,Digits),0,0,Blue);
                  if(!res)
                     Print("Error in OrderModify. Error code=",GetLastError());
                  else
                     Print("Order modified successfully.");
                 }
              }
           }
     }
//--------------------------------------------------------------+
   if(countB==0) int ticket=OrderSend(Symbol(),OP_BUY,1.0,Ask,30,0,0,"buy",16384,0,clrGreen);

   if(countS==0) int ticket=OrderSend(Symbol(),OP_SELL,1.0,Bid,30,0,0,"sell",16384,0,clrGreen);
//--------------------------------------------------------------+

  }
//+------------------------------------------------------------------+
brocker JFD
Angehängte Grafiken
Dateityp: jpg dax.jpg (304,3 KB, 3x aufgerufen)