.

Script to expert

#1
Hi guys i have a simple script which opens many orders (both limit and stop). I don't know how to transform it into an EA, instead of starting manually time after time.

I also need it to place again the same pending order of the orders closed by SL or TP: same price, direction (buy or sell - stop or limit), TP, SL, lot size.

Now i have this:

Code: Select all

///+------------------------------------------------------------------+
//|Safe Scalping System                                              |
//|alessandromagno 2018                                         |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
   int    ticket,expiration;
   double point;
//----
   point=MarketInfo(Symbol(),MODE_POINT);
   expiration=CurTime()+PERIOD_MN1*60;
//----
  

     
         while(true)
     {
      ticket=OrderSend(Symbol(),OP_SELLLIMIT,0.01,Bid+100*point,0,Bid+0.20+0.10,Bid-1.00+0.10,"some comment",16384,expiration,Green);
      if(ticket<=0) Print("Error = ",GetLastError());
      else { Print("ticket = ",ticket); break; }
      //---- 10 seconds wait
      Sleep(10000);
      
      
     }
 
         while(true)
     {
      ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask-100*point,0,Ask-0.20-0.10,Ask+1.00-0.10,"some comment",16384,expiration,Green);
      if(ticket<=0) Print("Error = ",GetLastError());
      else { Print("ticket = ",ticket); break; }
      //---- 10 seconds wait
      Sleep(10000);
      
      
     }

        while(true)
     {
      ticket=OrderSend(Symbol(),OP_BUYSTOP,0.01,Ask+200*point,0,Ask-0.20+0.20,Ask+1.00+0.20,"some comment",16384,expiration,Green);
      if(ticket<=0) Print("Error = ",GetLastError());
      else { Print("ticket = ",ticket); break; }
      //---- 10 seconds wait
      Sleep(10000);
      
      
     } 

        while(true)
     {
      ticket=OrderSend(Symbol(),OP_SELLSTOP,0.01,Bid-200*point,0,Bid+0.20-0.20,Bid-1.00-0.20,"some comment",16384,expiration,Green);
      if(ticket<=0) Print("Error = ",GetLastError());
      else { Print("ticket = ",ticket); break; }
      //---- 10 seconds wait
      Sleep(10000);
      
      
     }
And so on...
Someone can help me, please?

Thank you!


Who is online

Users browsing this forum: No registered users and 4 guests