Time input

 
I am looking for the Expert Advisor programme which I can use it for inputs and outputs at a certain time. For example I want to do this: input 12:00, output 12:30 and I would like to use SL programme also. Is anybody able to help me, pls?
thx much
 
what?
 
I need only one thing, i need programe buy/sell, input and output time and SL.
 

based on your nickname i assume you are german.

Maybe it's easier for you to explain it in german..


//z

 

i'm not sure what you mean.


as i understand it you want to:


switch Buy/Sell

Lay marketorder at InTime = 12:00

exit market at OutTime = 12:30

FixedStoploss = X pips


am i right?

 
exactly
enotrek:
exactly
 

Had some time over, consider it an early x-mas gift.


code does compile and runs, but thats it, no errorhandling or recover from expected shutdown.

Files:
timeea_2.mq4  4 kb
 
enotrek:

Had some time over, consider it an early x-mas gift.


code does compile and runs, but thats it, no errorhandling or recover from expected shutdown.

Thank you, exactly what I needed to ". But there is a problem, do not work inputs Sell (value 1). Buy them in order but can not sell transactions not open.
 

ooh, just a typo, change:

if(Buy0_Sell1 == OP_SELL){     // OpenSell
         RefreshRates();
         Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage*mt,Bid-Stoploss*pt,0,"TimeEA",MagicNumber,0,CLR_NONE);
         if(Ticket <= 0)
            Print("Error occured at open: ", GetLastError());
         
      }

to:

if(Buy0_Sell1 == OP_SELL){     // OpenSell
         RefreshRates();
         Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage*mt,Bid+Stoploss*pt,0,"TimeEA",MagicNumber,0,CLR_NONE);
         if(Ticket <= 0)
            Print("Error occured at open: ", GetLastError());
         
      }


the only thing changed is the - sign to a +

 

Mql5 code:

bool CheckTime()

  {

   datetime tm=TimeCurrent();

   string date =TimeToString(tm,TIME_DATE);

   //string str=TimeToString(tm,TIME_MINUTES);

   datetime _start= StringToTime(date+" "+Start+":00");

   datetime   _end= StringToTime(date+" "+End  +":00");

   Print("tm " + tm);

   Print("Start_time " + _start);

   Print("End_time "+ _end);

   if(_start<=tm && tm<=_end)

      return true;

   else

      return false;

  }

 
Enotrek #: the only thing changed is the - sign to a +
 Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage*mt, Bid+Stoploss*pt,0,"TimeEA",MagicNumber,0,CLR_NONE);

You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.

  1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

  2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
              MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25

  3. The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
    Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).

Reason: