Questions from Beginners MQL5 MT5 MetaTrader 5 - page 980

 
Kolya32:
Fixed)
Tonight I will write a check for deals with a filter by symbol and magic
 
Alexey Viktorov:

This is in MQL5 itself

Trading is done by several EAs, each with their own Magic. I'm reading the manual for this function but so far not a bum how to do it all in the function...
bool  HistorySelect(
   datetime  from_date,     // с даты
   datetime  to_date        // по дату
   );
 
Vladimir Karputov:
I will write a deal check in the evening with a filter on the symbol and magic
Thank you very much very much looking forward to it)
 
Kolya32:

I really need a FUNCTION in MQL5 that would check if a trade was made today. If yes, then true, if no, then false (with Magic set, of course). I use this function on MT4.

Insert before function

#include <MT4Orders.mqh>

#define False false
#define True  true

int TimeYear(const datetime dt)
{
  MqlDateTime mdts;
  TimeToStruct(dt, mdts);
  return mdts.year;
}

int TimeMonth(const datetime dt)
{
  MqlDateTime mdts;
  TimeToStruct(dt, mdts);
  return mdts.mon;
}

int TimeDay(const datetime dt)
{
  MqlDateTime mdts;
  TimeToStruct(dt, mdts);
  return mdts.day;
}

int Day()   { return(TimeDay(TimeCurrent())); }
int Month() { return(TimeMonth(TimeCurrent())); }
int Year()  { return(TimeYear(TimeCurrent())); }

and everything becomes crossplatform.

 
fxsaber:

Insert before the function

and everything becomes cross-platform.

Thank you. Very helpful. Nice library after all)
 

Hello!

Suppose I have a custom indicator with parameters (external parameters for optimisation). The tester only sees the parameters in the Expert Advisor. How can I enumerate these parameters for optimization?

I took the indicator from the standard library as a test case and added this parameter there. If I declare input in the file with the Expert Advisor, I cannot drag this parameter to the indicator. As far as I understand, the Expert Advisor uses signals of the indicator, not the indicator itself.

Or where can I read the description of interaction of the components of the standard library?

P.S. How much we miss a good IDE with highlighting and parser. Maybe there is something better than the standard editor in MetaTrader?

 
Kolya32:
Thank you. Very helpful. Nice library after all)

Oops, didn't make it in time. Oh, well, never mind :)

 
Kolya32:
Thank you. Very helpful. Nice library after all)

Under kim functions made.

 

can't work out what the result of 0 in the first printout means?

void OnStart()
  {
Print(GetFilling()); 					// 0
Print(EnumToString(GetFilling())); 			// ORDER_FILLING_FOK
Print(SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE)); 	// 1
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Возвращает тип заполнения                                        |
//+------------------------------------------------------------------+
ENUM_ORDER_TYPE_FILLING GetFilling()
  {
   int filling=(int)SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE);

   if(filling==1)
      return(ORDER_FILLING_FOK);
   else if(filling==2)
      return(ORDER_FILLING_IOC);
   return(WRONG_VALUE);
  }

 
Fast528:

can't work out what the result of 0 in the first printout means?


It means that the function returned the first value in the list. The values are numbered as in all arrays from zero.