Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1369

 
MakarFX:

I finished it)

Now all the levels are counting correctly.

I'm too lazy to check, but I have my doubts about the correctness of the code.

My thoughts on the design of hint codes:

The code should not be in one line. When code is split into parts it is easier to understand and observe in the debugger.

If you don't mind, show me a screenshot of the chip stretched upwards and values of 2-3 levels except the reference ones, i.e. level 0 and 100. And a second shot, stretched from top to bottom and the same values of the reference levels and 2 or 3 other levels to choose from. If desired, have a printout of all levels.

 
Alexey Viktorov:

I'm too lazy to check, but I have my doubts about the correctness of the code.

My thoughts on the layout of the hint codes:

The code should not be a single line. When the code is split into parts it is easier to understand and easier to observe in the debugger.

If you don't mind, show me a screenshot of the chip stretched upwards and values of 2-3 levels except the reference ones, i.e. level 0 and 100. And a second shot, stretched from top to bottom and also the values of the reference levels and 2 or 3 other levels to choose from. If you wish, have a printout of all levels.

Right?

 

Hi all, I'm trying to make it so that each new lot can be multiplied........ what am I doing wrong that my lots are not multiplying?

//----
double GetLot()
  {
   double MinLot = MarketInfo(Symbol(),MODE_MINLOT);
   double Prots = Risk/100;
   double Lotsi=MathFloor(AccountFreeMargin()*Prots/MarketInfo(Symbol(),MODE_MARGINREQUIRED)
                          /MarketInfo(Symbol(),MODE_LOTSTEP))*MarketInfo(Symbol(),MODE_LOTSTEP);// Лоты
   if(Lotsi<MinLot)
      Lotsi=MinLot;
   return(Lotsi);
  }
//----
 
MakarFX:

For the first part (order counting) I recommend it:

Next

And the error is probably here (highlighted in yellow)

Makar, thank you very much for sending off the good feature and thank you for noticing the missing magician - American spies must have stolen the O_o))))))))))))))))))) magician and it all worked :-) Thanks again
 
MakarFX:

Right?

Yeah.
 
1 Hello Dear forum users. I need mql4 code that turns a losing EA order into a profitable one without any stops and profits. The idea is clear from the screenshot. An EA has opened an order that turned out to be loss-making. We need a program that will close it when the price crosses the indicator line.
 
DanilaMactep:
Makar, thank you very much for sending off the good feature and thank you for noticing the missing magician - American spies must have stolen the O_o))))))))))))))))))) magician and it all worked :-) Thanks again.
You're welcome.
 
Max330:
Hello esteemed forum members. I need mql4 code that turns a losing EA order into a profitable one without any stops and profits. The idea is clear from the screenshot. An EA has opened an order that turned out to be loss-making. We need a program that will close it when the price crosses the indicator line.

I want one too!!!

 
Сергей Дыбленко:

Hi all! I am trying to make each new lot be able to increase........ what am I doing wrong that my lots are not multiplied?

i've made a little trick out of this codehttps://www.mql5.com/ru/forum/107406#comment_3018721

- you can do it from a loss as well as from an increase in funds

I cheated here in this thread from this code abovehttps://www.mql5.com/ru/forum/310846/page54#comment_16379772

- I have an Mt4 and Mt5 Expert Advisor with this function.

Увеличение размера ЛОТА. ПОМОГИТЕ!!!
Увеличение размера ЛОТА. ПОМОГИТЕ!!!
  • 2008.03.07
  • www.mql5.com
Скажите, можно ли как то увеличить размер лота с каждой сделки....??? К примеру, у меня депозит 100, торгую с лотом 0.50. депозит 200, торую 1...
 
SanAlex:

I have made some magic with this codehttps://www.mql5.com/ru/forum/107406#comment_3018721

- it is possible to increase from a loss as well as from an increase in funds

I cheated here in this thread using this code abovehttps://www.mql5.com/ru/forum/310846/page54#comment_16379772

- I have an Mt4 and Mt5 Expert Advisor with this function.

double Lots=0.1;
double ab=AccountBalance();
 
if (ab>=100 && ab<120) Lots=0.2;
if (ab>=120 && ab<200) Lots=0.3;
if (ab>=400          ) Lots=2.0;

It does not work at all! This is bullshit!

Reason: