[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 97

 

Here: https://docs.mql4.com/ru/dateandtime/DayOfWeek

I have seen this, it returns the day of the week, but I need to know which day of the week is the last day of next week. Because there are days when the last working day is not Friday

 
Can you please tell me if you can change the template of the chart that opens after testing? To make the deal marks visible, but when I apply my own template, all the marks are there...
 
alexhammer:


Your codes don't work.... :( I just need to open an order at the same time as the stop..... is triggered No indicators... just by closing the lot.... didn't think it was such a difficult task!

HELP ME!!! It's urgent! :(

 
ScioMe:
Can you please modify the chart pattern that will be opened after the test? I am using my own template and all the marks are there...

Start the tester with "Visualisation" checked.

When the tester loads the history and starts working, press the pause button and set your pattern on the graph,

press the pause button to continue the tester. You can skip the visualisation if you wish (Skip to button).

When the tester finishes, you will see all the arrows on the chart with your pattern.

 
PariaH:


Your codes don't fit.... :( I just need to open an order at the same time as the stop..... is triggered No indicators... just by closing the lot.... didn't think it was such a difficult task!

PLEASE help!!! It's urgent!!! :(

I think this can be solved by keeping track of the number of hanging lots. The CalculateOrders() function in the built-in MovingAverage Expert Advisor.

You have placed an order->calculate the number of active orders->remember it in a variable->.

check each iteration in the Start function-> if the number of orders has decreased-> if it has decreased, react as necessary.

 
PariaH:


Your codes don't fit.... :( Just need to open an order at the same time as stop..... is triggered No indicators... just by closing the lot.... didn't think it was that hard a task!

HELP ME!!! It's urgent! :(

F-function returns flag to close last position on stop:

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.05.2008                                                     |
//|  Описание : Возвращает флаг закрытия последней позиции по стопу.           |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//+----------------------------------------------------------------------------+
bool isCloseLastPosByStop(string sy="", int op=-1, int mn=-1) {
  datetime t;
  double   ocp, osl;
  int      dg, i, j=-1, k=OrdersHistoryTotal();

  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
      if (OrderSymbol()==sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderCloseTime()) {
                t=OrderCloseTime();
                j=i;
              }
            }
          }
        }
      }
    }
  }
  if (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) {
    dg=MarketInfo(sy, MODE_DIGITS);
    if (dg==0) if (StringFind(OrderSymbol(), "JPY")<0) dg=4; else dg=2;
    ocp=NormalizeDouble(OrderClosePrice(), dg);
    osl=NormalizeDouble(OrderStopLoss(), dg);
    if (ocp==osl) return(True);
  }
  return(False);
}

... on the take:

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.05.2008                                                     |
//|  Описание : Возвращает флаг закрытия последней позиции по тейку.           |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//+----------------------------------------------------------------------------+
bool isCloseLastPosByTake(string sy="", int op=-1, int mn=-1) {
  datetime t;
  double   ocp, otp;
  int      dg, i, j=-1, k=OrdersHistoryTotal();

  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
      if (OrderSymbol()==sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderCloseTime()) {
                t=OrderCloseTime();
                j=i;
              }
            }
          }
        }
      }
    }
  }
  if (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) {
    dg=MarketInfo(sy, MODE_DIGITS);
    if (dg==0) if (StringFind(OrderSymbol(), "JPY")<0) dg=4; else dg=2;
    ocp=NormalizeDouble(OrderClosePrice(), dg);
    otp=NormalizeDouble(OrderTakeProfit(), dg);
    if (ocp==otp) return(True);
  }
  return(False);
}

Look it up for yourself here. Then you can write your own...

 

Hello.

I am working on one Expert Advisor, I can't understand how the following line should be executed:

if (profitbuy<=0)mtpb=tpb;

The condition is clear, it is not clear at what result the variable mtpb takes the value of variable tpb.

 
paibolit:

Hello.

I am working on one Expert Advisor, I can't understand how the following line should be executed:

if (profitbuy<=0)mtpb=tpb;

The condition is clear, it is not clear at what result the variable mtpb takes the value of variable tpb.

If the profit of the bay positions is no more than zero, then mtpb=tpb.
 
ZZZEROXXX:

Here: https://docs.mql4.com/ru/dateandtime/DayOfWeek

I have seen this, it returns the day of the week, but I need to know which day of the week is the last day of next week. Because there are days when the last day of the week is not Friday.

The end does not justify the means.

To clarify, here's a question: yourself, when you want to determine "which day of the week will be the last next week", what do you do? Right, you look up the calendar for the current year, see what holidays fall in your country specifically, and find out if the weekend was transferred from one day to another (for example from Sunday to Thursday, for that every year the parliament, i.e. the State Duma, adopts a separate document), etc. Do you think anyone would take the trouble to create a programme in MQL for this purpose? Personally, it's easier for me to look at the calendar...

 

Good evening! Sorry, I want to understand the principle, what, such a construction is not possible?

int u; u=0-10; for( u;u<30;u++) {Alert("u",u); } Writes error ';' - assignment expect C:\Òãîðóìa MF Trader 4\documents\experts\cycle.mq4 (33, 31)
It shows a semicolon between u; u I checked it once with help, please explain!