FIXED TIME

MQL5 Эксперты

Работа завершена

Время выполнения 2 минуты
Отзыв от исполнителя
Excellent customer. Clear specifications and fast payment. Thank you.

Техническое задание

I want an EA that closes open positions at a fixed time.

for example.

I have an open buy trade on EURUSD, and i want it to close at say 4am, regardless of if it is in profit or not. if it has not hit my tp or sl by 4am i want the EA to close it.

I had AI write a code for me, but i have errors and i dont know how to fix it.

#property strict

// Define the exit time (hours and minutes)
int exitHour = 16;
int exitMinute = 0;

// Timer interval (in seconds) - Adjust as needed
int timerInterval = 60; // Check every minute

// Function to check if current time matches exit time
bool IsExitTime() {
  time_t currentTime = TimeCurrent();
  tm someTime;
  gmtime(&currentTime, &someTime); // Assuming you have gmtime defined
  return (someTime.tm_hour == exitHour && someTime.tm_min == exitMinute);
}

int OnTimer() {
  // Flag to prevent multiple executions within the timer interval
  static bool alreadyExecuted = false;

  // Check for first execution or exit time reached
  if (!alreadyExecuted && IsExitTime()) {
    alreadyExecuted = true;

    // Loop through all open positions
    int totalPositions = PositionsTotal();
    for (int i = 0; i < totalPositions; i++) {
      // Get position information
      position_info position = PositionGet(i);
      if (position.magic == EMPTY) continue; // Skip positions without magic number

      // Close the position
      double lots = position.lot;
      int result = OrderClose(position.ticket, lots, position.bid ? position.bid : position.ask, 0, "");
      if (result != RET_OK) {
        Print("Error closing position:", GetLastError());
      }
    }
  }

  return 0;
}


Откликнулись

1
Разработчик 1
Оценка
(512)
Проекты
773
63%
Арбитраж
33
27% / 45%
Просрочено
23
3%
Свободен
2
Разработчик 2
Оценка
(36)
Проекты
45
47%
Арбитраж
5
40% / 60%
Просрочено
9
20%
Свободен
3
Разработчик 3
Оценка
(76)
Проекты
85
34%
Арбитраж
2
0% / 0%
Просрочено
1
1%
Работает
4
Разработчик 4
Оценка
(61)
Проекты
186
73%
Арбитраж
4
100% / 0%
Просрочено
1
1%
Свободен
5
Разработчик 5
Оценка
(5)
Проекты
6
17%
Арбитраж
0
Просрочено
0
Свободен
6
Разработчик 6
Оценка
(23)
Проекты
29
14%
Арбитраж
3
0% / 67%
Просрочено
3
10%
Работает
7
Разработчик 7
Оценка
(3)
Проекты
4
0%
Арбитраж
0
Просрочено
0
Свободен
8
Разработчик 8
Оценка
(28)
Проекты
34
15%
Арбитраж
5
40% / 60%
Просрочено
5
15%
Свободен
9
Разработчик 9
Оценка
(6)
Проекты
6
33%
Арбитраж
3
0% / 67%
Просрочено
0
Работает
10
Разработчик 10
Оценка
(563)
Проекты
932
47%
Арбитраж
302
59% / 25%
Просрочено
124
13%
Загружен
11
Разработчик 11
Оценка
Проекты
0
0%
Арбитраж
1
0% / 100%
Просрочено
0
Свободен
Похожие заказы
a coder is required to add an indicator to existing ea The new indicator will work as 1. option to combine with exiting indicator to open trade 2. it will be used as alternative BE point 3. It can also be used to close order or combine with other to close trade The second Job is telegram bot to get alert fr news trade and others Details when you apply i will test the ea work on live market and all bug is fixed before
Hello, I want to make an EA based on SMC and a developer that is familiar with the concept and full understanding of this. Must have done similar jobs before and be able show it. I only want to work with developer that has good track record and is precise. Further information will be handed when contact is made. Developers that has zero rating will not be considered. Listed price is a base point. The project can also
EA DEJA FABRIQUE ? MODIFIER QUELQUE LIGNE POUR LE RENDRE RENTABLE /////////////////////++++++++++++++++++++++++++++++++++ EA AVEC UN SYTEME SIMPLE ; SEULEMENT A MODIFIER %%%%%%%%%%%%%%%%%% SI PERSONNE SACHANT CODER CORRECTEMENT , CE TRAVAIL EST POUR TOI
Trade methodology based on Red and Green lines entering Overbought / Oversold zone. Using confluence of Higher time frame, Moving Average a trade can enter when there is a strong slope angle. Market Base Line is used to determine overall market sentiment. This is designed to be an established trend scalping strategy on lower time frames. To be used initially on demo then real account when settings have been fine
There are six conditions in total . source code from an existing expert will be provided to aid the completion of this job . - Install the following by the Panel (copy paste form my existing Expert ) 1. Pips Lost : number of pips lost ( monthly reset ) 2. Pips Gained : number of pips gained ( monthly reset ) 3. Have a black background to avoid the
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: function (A) Add Transform combine the 4 Expert Advisors into just 1 Expert Advisor, maintaining the individuality of each one Leave in extern (false) or (true)
Description: I am seeking an experienced MQL5 developer to create a custom Expert Advisor (EA) for MetaTrader 5 based on a specific trend-following strategy. The strategy includes precise risk management, advanced trade management features, and additional risk management tools. The EA should be adaptable to any timeframe on which it is attached. Below are the detailed requirements and parameters for the EA: Strategy
I need an EA trading frequently (HFT or something like), and it sould have some features below: 1、Have a clear trading logic 2、Have a good backtest result 3、Have a demonstrated benefitable result in a live account trading 4、Can avoid the news time period or not sensitive to news
New york session based strategy 9:30 open Price takes out buy side or sell side liquidity Usually using 15min high and lows 5m entry Price takes out that high/low and price must close strongly back into the zone Is price is above price we have a sell bias vis versa for buys Sl is at the high or low with option for “offset” for cushion Tp is usually the opposite High or low. Would like the option for set pips-points &
Hello, I am looking for a skilled developer to create an Expert Advisor (EA) for MT4. The EA should close an open trade automatically when a Golden or Death Cross occurs in the Alligator Indicator. Please let me know if you have experience with similar projects and how we can discuss the details further

Информация о проекте

Бюджет
30+ USD
Исполнителю
27 USD
Сроки выполнения
до 1 дн.