Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1385

 
JRandomTrader #:

I have sets of conditions to open long and short are treated separately.

That is, for example, like this:

Thank you, I will try

 
JRandomTrader #:

I have sets of conditions to open long and short are treated separately.

I mean, for example, like this:

I'll even burn a piece of my real code, thankfully, it won't reveal any know-how without information about "battle" values of variables and conditions of position maintenance.

You can actually specify one of 224 options here:

It is interesting to be able to account for so many options in one code.

In the extended answer, the expressions under case (VRO and other) are also a set of conditions on which a decision is made?

Both Mode and Mode_... And VRP AVR?

Slightly confused by the code

 
qadexys #:

It is interesting to be able to consider so many options in one code.

In the extended answer, the expressions under case (VRO and other) are also a set of conditions on which a decision is made?

And Mode and Mode_... And VRP AVR?

Got a bit confused in the code.

In the if-condition block, each flag defines check of its own condition, while in the switch block, the particular condition being checked is defined not by a single flag but by a combination of three flags.

 
JRandomTrader #:

   if(  ( !F1 || f1==1 )
      &&( !F2 || f2==1 )
      &&( !F3 || f3==1 )
      &&( !F4 || f4==1 )

Do I understand correctly that in your case f1, ..., fn is not necessarily a bool? I understand that there may be many variants, but I wonder how you do it.

 
qadexys #:

Do I understand correctly that in your case f1, ..., fn is not necessarily a bool? I understand there may be many variants but I wonder how you do it.

Naturally. fn is any, their results are compared to something (and not necessarily to a constant either), and the result of this comparison is a bool.

 
Can you tell me: does OBJ_RECTANGLE_LABEL allow me to add text to it? Or do I need to overlay OBJ_LABEL on top of OBJ_RECTANGLE_LABEL if I want text in an opaque window.
 

Can you tell me how to determine the number of digits in the average price of a position (the one displayed in the Price field of the Toolbox)?

Experimentally it was found out that there can be up to 8 digits. But the same tool can also have 5 digits, etc. I mean, how do you determine how much is displayed in the GUI?

 
void OnInit() 
   { 
   string symb = _Symbol;
   int bars_win_1 = Bars(_Symbol, _Period);
   int bars_win_2 = Bars(symb,    _Period);
   int bars_win_3 = iBars(_Symbol, _Period);
   int bars_win_4 = iBars(symb,    _Period);
   Print("     bars_win_1 = ", bars_win_1,  "     bars_win_2 = ", bars_win_2, "     bars_win_3 = ", bars_win_3,  "     bars_win_4 = ", bars_win_4);
   }
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[]   )       
   {
   return(0);
   }                              

Leave the indicator in the window. Switch the terminal off, switch it on. The result is as follows.

   bars_win_1 = 250688     bars_win_2 = 0     bars_win_3 = 250688     bars_win_4 = 0

Next in my real code the timer is 20ms. It takes about 8-12 iterations before all values become equal to the real number.

Also, they all give an actual value greater than the configured parameter (this is normal, but not according to the help).

This is just an FYI.

 
leonerd #:

Can you tell me how to determine the number of digits in the average price of a position (the one displayed in the Price field of the Toolbox)?

Experimentally it was found out that there can be up to 8 digits. But the same tool can also have 5 digits, etc. I mean, how can I determine how many digits are displayed in the GUI?

Digits()

 

Hello!

Can you tell me, I downloaded an indicator, it is in the indicators section in METEDITOR, but in the terminal, in the custom section it did not appear... What can I do?

Reason: