Download MetaTrader 5

script for pending or in time

To add comments, please log in or register
gioew
15
gioew  

Dear, 

 can anybody modified this script for the pending order with a specfic time? for example if the market open at 8 am the order should be active at 9 am.

 thx

 

#property show_inputs

//#property show_confirm

extern double Lots    = 0.1;

extern int Slippage   = 3;

extern int Stop_Loss  = 20;

extern int Take_Profit = 20;

extern double Price = 1.3422;

extern datetime  _ExecuteDate=D'2014.07.31 20:40';

//+------------------------------------------------------------------+

//| script "Open a new Buy Order"                                    |

//+------------------------------------------------------------------+

int start()

  {

 //  double Price = WindowPriceOnDropped();

   bool   result;

   int    cmd,total,error,slippage;

   

//----

   int NrOfDigits = MarketInfo(Symbol(),MODE_DIGITS);   // Nr. of decimals used by Symbol

   int PipAdjust;                                       // Pips multiplier for value adjustment

      if(NrOfDigits == 5 || NrOfDigits == 3)            // If decimals = 5 or 3

         PipAdjust = 10;                                // Multiply pips by 10

         else

      if(NrOfDigits == 4 || NrOfDigits == 2)            // If digits = 4 or 3 (normal)

         PipAdjust = 1;            

//----   

   

   slippage = Slippage * PipAdjust; 

   

   double stop_loss = Price - Stop_Loss * Point * PipAdjust;

   double take_profit = Price + Take_Profit * Point * PipAdjust; 

   

   

   

                              //datetime

    

    

  //{ 

   if(Ask > Price)

   {

   result = OrderSend(Symbol(),OP_BUYLIMIT,Lots,Price,slippage,stop_loss,take_profit,"",0,0,CLR_NONE);

   }

   if(Ask < Price)

   {

   result = OrderSend(Symbol(),OP_BUYSTOP,Lots,Price,slippage,stop_loss,take_profit,"",0,0,CLR_NONE);

   }

  //} 

//----

   return(0);

  }

//+------------------------------------------------------------------+ 
Alain Verleyen
Moderator
32808
Alain Verleyen  

Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

qjol
3243
qjol  

what market are you talking about ?

forex market is open 24/5 

whroeder1
15706
whroeder1  
gioew: can anybody modified this script for the pending order with a specfic time? for example if the market open at 8 am the order should be active at 9 am.
You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
gioew
15
gioew  

hi qjol, 

 

it schould be for the CFD market.  

To add comments, please log in or register