Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1050

 
Ekburg:

Good afternoon.

I'm working through the code of an expert and can't understand one line:

From the name of the variable I understand what the programmer wanted to achieve.

But at my amateur programming level I don't understand anything exceptMarketInfo(Symbol(),MODE_MINLOT).

Explain what for, where and with what sauce)

Do you understand what logarithm is?

Although this code is not very clear. It's not clear why the logarithm of a value should be divided by logarithm(10) if log(10) will always be 1.

 
kocunyc89 code, in the indicator that shows in the corner of the screen
#property indicator_chart_window  //Вывод информации в окно графика
#property strict
int Число=25;

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
{
  // Проверка наличия метки для вывода информации
  if(ObjectFind("Итог")<0)
  {
    ObjectCreate("Итог", OBJ_LABEL, 0, 0, 0);   // Создание
    ObjectSet("Итог", OBJPROP_CORNER, 1);  // Правый верхний угол
    ObjectSet("Итог", OBJPROP_XDISTANCE, 10); //X   
    ObjectSet("Итог", OBJPROP_YDISTANCE, 10);       //Y
  }
  ObjectSetText("Итог", string(Число), 14,"Arial",Yellow);
  return(0);
}

void OnDeinit(const int reason)
{
  ObjectDelete("Итог");
}
 
AlexeyVik

log(10) will always be 1.

Alert(log(10)); log(10)=2.302585092994046. MathLog is a natural logarithm, just like simple Log. There is no decimal log in MQL. I wanted the decimal logarithm and through it the number of digits in the integer part of the number, the so-called number order. The decimal logarithm LG(X) can be obtained through any other logarithm. Here LG(X)=Log(X)/Log(10)
 
I don't understand where the answer is in there. You mean this: "The function has a built-in check for the status of the EA stop flag every 0.1 seconds"? If so, how can this flag be removed?
 
LRA:

Sorry, I'm not very good at programming, can you help me put it all into an indicator?
#property indicator_chart_window  //Вывод информации в окно графика
#property strict
int Число=25;

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
{
  // Проверка наличия метки для вывода информации
  if(ObjectFind("Итог")<0)
  {
    ObjectCreate("Итог", OBJ_LABEL, 0, 0, 0);   // Создание
    ObjectSet("Итог", OBJPROP_CORNER, 1);  // Правый верхний угол
    ObjectSet("Итог", OBJPROP_XDISTANCE, 10); //X   
    ObjectSet("Итог", OBJPROP_YDISTANCE, 10);       //Y
  }
  ObjectSetText("Итог", string(Число), 14,"Arial",Yellow);
  return(0);
}

void OnDeinit(const int reason)
{
  ObjectDelete("Итог");
}
Files:
j_1.mq4  6 kb
 
rapid_minus:
poz = OrderSend(Symbol(),OP_SELL,lot,Bid,slip,0,0,NULL,magic,Red);
Sleep(10000);
poz = OrderSend(Symbol(),OP_SELL,lot,Bid,slip,0,0,NULL,magic,Red);
Sleep(10000);
poz = OrderSend(Symbol(),OP_SELL,lot,Bid,slip,0,0,NULL,magic,Red);
Sleep(10000);
poz = OrderSend(Symbol(),OP_SELL,lot,Bid,slip,0,0,NULL,magic,Red);
Sleep(10000);
poz = OrderSend(Symbol(),OP_SELL,lot,Bid,slip,0,0,NULL,magic,Red);
One of the reasons: after 10 seconds of slip, Bid gets old and there will be an error. Check logs. You can increase slip or RefreshRates(). In tester, slips glop and all is OK
 
kocunyc89:   stick ... into the indicator

First, put this at the end of the indicator. When you see the mark on the screen, figure out how to put what you need into it. Here you get advice, but you have to do it yourself.

  int Число=25;

  if(ObjectFind("Итог")<0)        // Проверка наличия метки для вывода информации
  {
    ObjectCreate("Итог", OBJ_LABEL, 0, 0, 0);   // Создание
    ObjectSet("Итог", OBJPROP_CORNER, 1);       // Правый верхний угол
    ObjectSet("Итог", OBJPROP_XDISTANCE, 10);   //X   
    ObjectSet("Итог", OBJPROP_YDISTANCE, 10);   //Y
  }
  ObjectSetText("Итог", string(Число), 14,"Arial",Yellow);   // Вывод в метку
 
rapid_minus: The function has a built-in check for the status of the EA's stop flag every 0.1 seconds. how do I remove this flag?
The flag raises the terminal to inform the Expert Advisor that it will be silenced in three seconds. Seeing the flag, the slip glows down and does not prevent the EA from collecting toys before escaping.
 
LRA:
Alert(log(10)); log(10)=2.302585092994046. MathLog as simply Log is anatural logarithm. There is no decimal log in MQL. I wanted the decimal logarithm and through it the number of digits in the integer part of the number, the so-called number order. The decimal logarithm LG(X) can be obtained through any other logarithm. Here LG(X)=Log(X)/Log(10)

log(10) is really not 1, but the fact that mql has no decimal logarithm surprised me...

What is it then? https://docs.mql4.com/ru/math/mathlog10 although there is a mistake in the text.

The question is solved in a much simpler way.

(int)MathAbs(MathLog10(MarketInfo(_Symbol, MODE_LOTSTEP)));
 
It's clear that the bid has aged, but I was hoping that this design would allow me to open several positions on the current bar with different bid opening prices. And in the tester it works fine, but on the demo it opens one position and closes immediately. how to avoid it is not clear.