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

 
Вероника Баранова:
I wonder if you can help me. Please. I am afraid to do something wrong.

When you register a real account, you have registered a personal account on the DC website, you can change your password there.

Or call support and they will tell you everything.

 

Please advise how to implement

Lots=NormalizeDouble(AccountBalance()/CheckLots,2);

Rounding down, i.e. if AccountBalance()/CheckLots = 0.019

rounded to 0,01

 
MakarFX:

Please advise how to implement

Rounding down, i.e. if AccountBalance()/CheckLots = 0.019

rounded down to 0.01

seeit

Вопросы от начинающих MQL5 MT5 MetaTrader 5
Вопросы от начинающих MQL5 MT5 MetaTrader 5
  • 2020.01.02
  • www.mql5.com
Подскажите пожалуйста, такой показатель тестера в жизни реален? И хороший это или плохой результат за год с депо 3000...
 
Vitaly Muzichenko:

Take a lookat this.

Solved the problem in a different, simpler way I think.

NormalizeDouble rounds 0.5 to 1 and 0.4 to 0 The solution is

Lots=NormalizeDouble(AccountBalance()/CheckLots-0.005,2);
 
Документация по MQL5: Математические функции / MathFloor
Документация по MQL5: Математические функции / MathFloor
  • www.mql5.com
Математические функции / MathFloor - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Airat Safin:

returns the integer numeric value nearest to the bottom.

Is 0.01 an integer?

 
Vitaly Muzichenko:

returns the integer value nearest to the bottom.

Is 0.01 an integer?

MakarFX:

Can you tell me how to implement

Lots=NormalizeDouble(AccountBalance()/CheckLots,2);

Rounding down, i.e. if AccountBalance()/CheckLots = 0.019

rounded down to 0,01


Lots=NormalizeDouble(AccountBalance()/CheckLots,

2); => int    Digits = 2                         ;
    => double Power  = MathPow   ( 10 , Digits ) ;

    => double Lots   = MathFloor ( Power * AccountBalance / CheckLots ) / Power ;

int OnInit () {
Print ( "==================================================================" ) ;

int    Digits = 2                       ;
double Power  = MathPow ( 10 , Digits ) ;

double AccountBalance =  0.19 ;
double CheckLots      = 10.00 ;

double Lots1 =                       AccountBalance / CheckLots           ;
double Lots2 = MathFloor   ( Power * AccountBalance / CheckLots ) / Power ;

Print ( "AccountBalance= " , AccountBalance ) ;
Print ( "CheckLots=      " , CheckLots      ) ;

Print ( "Lots1=          " , Lots1          ) ;
Print ( "Lots2=          " , Lots2          ) ;

Print ( "==================================================================" ) ;
return INIT_SUCCEEDED ; }
void   OnTick () {}

1

Документация по MQL5: Математические функции / MathFloor
Документация по MQL5: Математические функции / MathFloor
  • www.mql5.com
Математические функции / MathFloor - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 

Another question

   ObjectSetText("Lev",StringConcatenate("Lev: ",DoubleToStr(MarketInfo(Symbol(),MODE_STOPLEVEL),0)),SizeINFO,"Times New Roman",InfoColor);

How to set font thickness FW_BOLD

I'm afraid I won't understand it in words.

P.S. The MQL4 Reference didn't help(.

 
Airat Safin:

This issue has already been resolved
 

Attempt number 2.

Please help, it seems like a simple question.

ObjectSetText("Lev",StringConcatenate("Lev: ",DoubleToStr(MarketInfo(Symbol(),MODE_STOPLEVEL),0)),SizeInfo,"Times New Roman",InfoColor);

How to set font thickness FW_BOLD, or rather how to relate to

 

TextSetFont( "Time New Roman",9,FW_BOLD,0);
I am afraid I won't understand it in words.

P.S. The MQL4 Reference didn't help(.

Reason: