Questions from Beginners MQL4 MT4 MetaTrader 4 - page 60

 
Sergey Gritsay:
put everything I highlighted into the OnTick() function
Can you explain the difference?
 
Michail_David:
Can you explain the difference?

You switch the programme on and it only calculates when you switch it on, and then it does not calculate or recalculate anything, even in the tester

Well, that's a bad start...

You were correctly told above - how to do

 
Renat Akhtyamov:

You switch the programme on and it only calculates when you switch it on, and then it doesn't calculate or recalculate anything

Such a bad start... You have been told above how to do it correctly

You may not open trades because of it. You're right?
 
Michail_David:
And because of that, trades may not open either. Right?
100%
 
Renat Akhtyamov:
100%
The tester still won't open the trades. I will try it on a demo account. Thanks for the tip
 
Michail_David:
The tester still does not open trades. I will try it on a demo account. Thanks for the tip.

It will be the same on the demo, just longer.

If you want to share, publish the code

 
Renat Akhtyamov:

It will be the same on the demo, just longer.

If you want to work together, publish the code

The code is on page 58. Thanks in advance for your help https://www.mql5.com/ru/forum/160587/page58#comment_4072256
Вопросы от начинающих MQL4 MT4 MetaTrader 4
Вопросы от начинающих MQL4 MT4 MetaTrader 4
  • www.mql5.com
Если у Вас вопросы по MQL4, MT4, MetaTrader 4, пожалуйста пишите в этой теме. Особенно когда вопросы касаются торговых функций...
 
Michail_David:
The code is on page 58. Thanks for your help.

You may not have understood exactly what you were told to do.

For example - move the first couple of lines

double Margin_Percent; //Используемые средства для открытия ордеров
double Lots;//Определение общего количества лотов
....................
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
     Margin_Percent=AccountFreeMargin()*Percent/100;
     Lots=Margin_Percent/MarketInfo(Symbol(),MODE_MARGINREQUIRED);
     .........
  
//------
  }
 
Renat Akhtyamov:

You may not have understood exactly what you were told to do.

For example - move the first couple of lines

double Margin_Percent; //Используемые средства для открытия ордеров
double Lots;//Определение общего количества лотов
....................
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
     Margin_Percent=AccountFreeMargin()*Percent/100;
     Lots=Margin_Percent/MarketInfo(Symbol(),MODE_MARGINREQUIRED);
     .........
  
//------
  }
Yes. I moved the whole thing with the data types. Thank you for telling me how to do it.
 
Michail_David:
Yes. I've moved it all together with the data types. Thank you for telling me how to do it.
I hope that OnInit() has some value assigned to the Percent variable?
Reason: