Questions from Beginners MQL5 MT5 MetaTrader 5 - page 974

 
Sprut112:

How about this?

Do it like this...

double Freeus =AccountInfoDouble(ACCOUNT_MARGIN_FREE)* MaximumRisk 
               /SymbolInfoDouble(symbol_name[ir],SYMBOL_TRADE_TICK_VALUE)/ 1000;
  input_lots = NormalizeDouble(MathRound(Freeus) * SymbolInfoDouble(symbol_name[ir], SYMBOL_VOLUME_STEP),dg);
 
xxz:

do this...

Nah, it worked when I added Step:) Thanks again!
 
Vladimir Karputov:

Fix initialisation blocks in EAs (OnInit() ).

What exactly ? 0 warnings. Return 0 to
return(INIT_SUCCEEDED) if only.
 
pivomoe:
What about it ? Return 0 on
return(INIT_SUCCEEDED) if only.

Show complete MQL5 code of OnInit() function of EAs which don't reload. Show complete MQL5 code of OnDeinit() function of Expert Advisors which don't reload. Do Expert Advisors use third-party libraries? Dll?

 
Vladimir Karputov:

Show full MQL5 code of OnInit() function of EAs that don't reload. Show complete MQL5 code of OnDeinit() function of EAs which don't reload. Do Expert Advisors use third-party libraries? Dll?

I don't use any Dll. The code of OnInit is 1000 lines long. There is memory allocation for classes. Maybe not all memory is freed in OnDeinit. Closing the terminal with a cross is fine, but the scheduler is fine only 90% of the time.
 
pivomoe:
I don't use Dll. The code of OnInit is 1000 lines long. There is memory allocation for classes. Maybe not all memory is freed in OnDeinit. Closing the terminal with a cross is okay, but the scheduler works fine only 90% of the time.

You have already answered 90% of your question. All that's left is to find the error :)

 
Please advise how to explicitly assign each order a different magik.
For example.
For example, we need to set up
Buy_Stop order and assign it magic_1
order Buy_Stop and assign it magic_2
Buy_Stop order and set its magic_3 to it

So that when modifying orders we could explicitly specify which order to modify.

if an order Buy_Stop == wizard_2, modify it.

 

Good afternoon.

I have questions in connection with absence of Sleep() in the tester. I would like to know how people solve the following problems when using the strategy tester (both single runs and enumeration of input parameters):

1) How do they check if an indicator handle is ready? How would I make me wait until the indicator calculation is complete, and only then move on to the lines.

2) How do I wait for the text file called to open for reading during the EA?

3) How to wait for the response of the OrdersTotal() function? And can there be a delay in the response of this function?

4) How to wait for the OrderCalcMargin() function to respond? And can there be a delay in the response of this function?

5) Does it make sense to wait for the"trade server return code" through MqlTradeResult in the tester (even if it is not clear how).

In the terminal all these tasks were solved using Sleep(), while it doesn't work in the tester. Besides, I'm not sure if Sleep() is necessary, maybe there is a more rational solution?

Thanks already.

 

Hello ! decompose the construction into if... C= (i>0) ? (A>B) ? 1 : (A<B) ? 2 : C: 0;

read the help - but failed)

 
Tango_X:

Hello ! decompose the construction into if... C= (i>0) ? (A>B) ? 1 : (A<B) ? 2 : C: 0;

read the help - but failed)

It seems like this:

C=xxx;
if(i>0)
  {
   if(A>B)
     {
      C=1;
     }
   else
     {
      if(A<B)
        {
         C=2;
        }
      else
        {
         C=C;
        }
     }
  }
else
  {
   C=0;
  }

S.S. It's got nothing to do with the help. It's about logic.

Reason: