[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 529

 
001:
Can you tell me if there is an auto-optimiser that optimises the parameters during the test? I have to check the idea.
There's even a closer one, right on our site.
And there's also such a thing as search, which is when words with which the subject is named are inserted into a search engine.
http://www.google.ru/search?as_sitesearch=mql4.com&as_q=автооптимизатор
 

Could you please advise how to correctly specify in a pending order in an EA to automatically delete it at 23:00?

This option gives an error:

  datetime Tim=D'23:00';
   int    Cur_Hour=Hour();             // Серверное время в часах   
   double Cur_Min =Minute();           // Серверное время в минутах   
   double Cur_time= Cur_Hour + Cur_Min/100; // Текущее время   
   if (Cur_time>=20.00&&Cur_time<=20.00&&order==false)
  {

ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.1,Bid-Spread,2,Bid-Spread-SL,Bid, Tim);
 
Andreev:

Could you please advise how to correctly specify in a pending order in an EA to automatically delete it at 23:00?

This option gives an error:


int Tim=iTime(NULL, Period_D1,0)+23*60*60;
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.1,Bid-Spread,2,Bid-Spread-SL,Bid, Tim);
Something like this
 
dmmikl86:

I'm not a novice programmer for a few years, I rewrote the indicator from another language and came across a redrawing.

I am a beginner, I have rewritten the indicator in another language:


I would rather have the indicator as a file. No one is going to paste the pieces into one file
 
Andreev:

This option gives an error:

int Tim;
   int    Cur_Hour=Hour();             // Серверное время в часах   
   double Cur_Min =Minute();           // Серверное время в минутах   
   double Cur_time= Cur_Hour + Cur_Min/100; // Текущее время   
   if (Cur_time>=20.00&&Cur_time<=20.00&&order==false)
  { Tim=TimeCurrent( )+ (23-Cur_time)*3600

ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.1,Bid-Spread,2,Bid-Spread-SL,Bid, Tim);


Something like this.
 
Vinin:

Something like this

It gives an error:


2011.07.19 18:56:15 2011.07.18 20:00 Return EURUSD,M1: OrderSend error 4062
2011.07.19 18:56:15 2011.07.18 20:00 Return: the comment parameter for OrderSend function must be a string

 
alexshell:

That's the way it is.

For some reason I get the same error. If I remove the Tim function from the order, it works, but some trades open after 23.00. What can I do to limit this?
 
Andreev:

I have an error:


2011.07.19 18:56:15 2011.07.18 20:00 Return EURUSD,M1: OrderSend error 4062
2011.07.19 18:56:15 2011.07.18 20:00 Return: the comment parameter for OrderSend function must be a string


Sorry, I edited your version without checking

 ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.1,Bid-Spread,2,Bid-Spread-SL,Bid, "",0,Tim, CLR_NONE);
 
Vinin:


Sorry, edited your version without checking


Thank you so much!!! It works :)
 

Good evening!!! I have a question about the Alert function. Here's a robot without a big middle chunk and many h

//+------------------------------------------------------------------+
//|                                                    пробныйй .mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
extern double stoploss=0; extern double takeprofit=20;extern int otstup=20; extern datetime expiration=0;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
  
  
  int tiket,tikett;double volume=0.1;int i=0,R1=0,R2=0,A=1 ;double price; int stsBUY;int stsSELL;double Price;int C=0;datetime wremjapomnim;
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {int X,Y; double price=NormalizeDouble((Ask+Bid)/2,4) ; Alert ("price", price);Alert("otstup*Point",otstup*Point);
//----
Alert ("Price +otstup*Point",Price +otstup*Point);Alert ("Price+takeprofit*Point+otstup*Point", Price+takeprofit*Point+otstup*Point);
tiket= OrderSend( Symbol(), OP_BUYSTOP,  volume*A, Price +otstup*Point, Point* 3, R1, Price+takeprofit*Point+otstup*Point, "OP_BUYSTOP", 1000,  expiration, Red); 
   Alert ("OP_BUYSTOP", GetLastError( ));
  Alert ("Price -otstup*Point",Price -otstup*Point);Alert ("Price-takeprofit*Point-otstup*Point", Price-takeprofit*Point-otstup*Point); 
tikett= OrderSend( Symbol(), OP_SELLSTOP,  volume*A, Price -otstup*Point, Point* 3,R2, Price-takeprofit*Point-otstup*Point, "OP_SELLSTOP" , 2000,  expiration,C'0,128,255' );
    Alert ("OP_SELLSTOP", GetLastError( )); 
   
//----

// Здесь код для закрытия всех открытых позиций (тоже в цикле)
         for ( i=0; i<OrdersTotal(); i++) {
           OrderSelect(i, SELECT_BY_POS );
              if (  OrderType( )==OP_BUY && OrderType( )==OP_SELL ){
                          OrderClose( OrderTicket( ), OrderLots( ), OrderClosePrice( ) , 0, CLR_NONE);
   Alert ("OrderClose-vse-2",  GetLastError( ) ); C=0;A=1; }} 
         // Здесь код для удаления всех отложенных ордеров (также в цикле)
         for ( i=0; i<OrdersTotal(); i++) {
         OrderSelect(i, SELECT_BY_POS );
           if (  OrderType( )==OP_BUYSTOP && OrderType( )==OP_SELLSTOP ){ 
            OrderDelete(OrderTicket( )) ; Alert ("OrderDelete-vse-2",  GetLastError( ) ); }}    
        
   return(0);
  }
//+------------------------------------------------------------------+
Alert should log the priceAlert ("price", price); let's say 1.4825, and it does, i.e. the variable is normal. And then!!!

Alert ("Price +otstup*Point",Price +otstup*Point); It is Price + indent(20pp)* multiply by a point(0.0001) total-1.4805 should be, (!!!!) but writes 0.002

etc. Here: How do I understand? What is the syntax for the formulas?