Questions from Beginners MQL5 MT5 MetaTrader 5 - page 433

 
Leanid Aladzyeu:
What's the point of all this? Why not make it 0/1 or "Online"/"Offline"?
 
in the first case it shows the number of trades open, in the second it indicates that the function is switched off
 
Leanid Aladzyeu:
in the first case it shows the number of trades opened, in the second it tells you that the function is switched off
Why not make two variables? One numeric and one string variable?
 
Tapochun:
Why not make two variables? One numeric and one string variable?
It would be harder to write in a comment with different variables, but this way I think it's compact.
 
Leanid Aladzyeu:
it would be harder to write in a comment with different variables, but I think it's compact.
Comment( "c = ",AAA ? (string)c : "offline" );	// Наиболее компактный вариант
 
Leanid Aladzyeu:
It will be harder to write in the comment with different variables, but I think it's compact.
This is done in one line, not half a page. int ABC=30.44; stringABC=DoubleToStr(ABC,2); //as far as I remember
 

Tapochun:

it is strange when AAA is false . it does not show offline : 0

 

Leanid Aladzyeu:

It is strange when AAA is spelled false. offline does not write : 0 shows

Because it is not written correctly.

int c; string cc;
с = 0;
сc = с > 0 ? (string) с : "offline";
Comment("c = ", cc);
 

I saw it in the help . but it doesn't fit as there is nothing to hook to(with > 0).

I wrote a direct conversion and with a warning everything works.

Can I change the colour of the whole comment? If it's complicated it's not worth it.

why 0 ?

double p1=(NormalizeDouble(iHigh(Symbol(),PERIOD_MN1,1),Digits)-NormalizeDouble(iLow(Symbol(),PERIOD_MN1,1),Digits))/Point; Print("Величина бара 1 = ", p1);
 
Leanid Aladzyeu:

Can you change the colour of the whole comment? If it's complicated, it's not worth it.

Why 0 ?

You cannot change the colour of a comment. If you want the colour, you can change it.
//+------------------------------------------------------------------+
#property version   "1.00"
#property strict
#property script_show_inputs
//--- input parameters
input int      CandleNumber=1;
int candle_number=(CandleNumber<0)?0:CandleNumber;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   int p1=int((iHigh(_Symbol,PERIOD_D1,candle_number)-iLow(_Symbol,PERIOD_D1,candle_number))/Point());
   Alert("Размер дневной свечи №"+IntegerToString(candle_number)+" с тенями : "+IntegerToString(p1)+" пп");
  }
//+------------------------------------------------------------------+