Libraries: TimeManagement

 

TimeManagement:

The header file contains functions and input variables for a time management.

#include <TimeManagement.mqh>

void OnTick()
{
   if( !CheckTime() )
   {
      Print("The trade is not allowed by time management");
      return;
   }

   if( !CheckDayOfWeek() )
   {
      Print("The trade is not allowed in this day of week");
      return;
   }
}

Author: Alexey Lopatin

 

Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий

Советники: Three Point Arbitrage

fxsaber, 2018.01.20 09:58

int DayOfWeek( void )
{
  MqlDateTime sTime = {0};

  TimeToStruct(TimeCurrent(), sTime);

  return(sTime.day_of_week);
}
 
Kiril Vasilev:
Hi, I am trying to use time management function for day of the week, but I receive error message can you help me? Where do I have to define DayOfWeek and how?

This library is designed for MT4, not MT5.
 
fxsaber:

This code is designed for MT4.

For MT5 you can try this code:

MqlDateTime currentTime;
TimeCurrent(currentTime);
int day_week=currentTime.day_of_week;
 
 
Alexey Lopatin:

This code is designed for MT4.

For MT5 you can try this code:

Can you point me to more detailed solution  like the one in the library for MT4, with the whole code, includes and etc, I don`t have a lot of experience with mql5? :)

 
Alexey Lopatin:

This code is designed for MT4.

For MT5 you can try this code:

Next enough. There will be problem with StringConcatenate() for example. I didn't check all.
 
Kiril Vasilev:

Can you point me to more detailed solution  like the one in the library for MT4, with the whole code, includes and etc, I don`t have a lot of experience with mql5? :)

In the attached file code for MT5.

Files:
Reason: