MetaTrader 4 Build 529 beta released with new compiler - page 125

 
stringo:

You cannot change input variables!

Use the keyword input instead of extern, then the compiler won't let you do this

We'll see what we can do to keep the old quadruplet functionality.

PS thank you very much for bringing it up


So there was no aim to change them!

They're just used for further calculations. Nothing more!

Well, in principle I see, we solved this problem by introducing an extra variable.

extern int TakeProfit_= 10;
int TakeProfit;
......  
   int dig = (int)MarketInfo(Symbol(), MODE_DIGITS);
   if (dig == 5 || dig == 3)
   {
      TakeProfit  = TakeProfit_* 10;
.....
 
Night63:


So there was no purpose in changing them!

They are simply used for further calculations. No more than that!

Well, in principle, we have solved this problem by introducing an additional variable.


That's true... But why bother checking an immutable constant at every tick? It's enough to define it once in init()
 
stringo:

You cannot change the input variables!

I use the value of external variables (for some variables) as the default value, and read the rest of the data for the same parameter from the ini file.

Expert Advisors work simultaneously with several strategies that have their own input parameters. Example:

extern int TF = 15;
int gia_TF[5];
void start()
{
    for (int li_TF = 0; li_TF < ArraySize (gia_TF); li_TF++)
    {
        TF = gia_TF[li_TF];
    }
}

Yes - the issue can be solved by entering additional variables, but why? Clarify, will this functionality be deprived by the new MT?

 
TarasBY:
I use value of external variables (for some variables) as default value, and I read other data for the same parameter from ini-file.

Advisors work simultaneously with several strategies that have their own input parameters. Example:

Yes - the question can be solved by entering additional variables, but why? Clarify, will this functionality be deprived by the new MT?

Told you so. :-))

This is redundant. This means that an inline with external variables as external variables is unnecessary. You can remove extern. You won't even notice the difference. You initialize from the INI file anyway.

 
TarasBY:
I use value of external variables (for some variables) as default value, and read other data for the same parameter from ini-file.

Advisors work simultaneously with several strategies that have their own input parameters. Example:

Yes - the issue can be solved by introducing additional variables, but why?! Clarify, will this functionality be deprived by the new MT?


No, it will not be deprived.

Everything will be the same as in the old four. Long written codes (even recompiled with the new compiler) will work as before.

 
Zhunko:

Told you so... :-))

It's redundant. It means that inclusion with external variables as external variables is unnecessary. You may omit extern. You won't even notice the difference. You initialize from INI file anyway.

Vadim! Who is a fighter for universality and multivariance?! :)
 
stringo:

No, it won't.

Everything will be the same as in the old quad. Long written code (even recompiled with the new compiler) will work as before.

Thank you. OK.
 
avtomat:

That's true... But why bother checking an immutable constant at every tick? It's enough to define it once in init()


You're right, that's how it was at first, we just tried all sorts of things at the stage of problem solving.

Now back to init, thanks for pointing out the flaw!

 
stringo:

Can you explain the physical meaning of your code?

The symbol is already selected, if its chart is open, on which this Expert Advisor works.

The already selected symbol cannot be re-selected. Cannot hide a symbol whose chart is open.


The physical meaning is to check that the symbol whose name is entered as a string in the EA input parameters is available for trading. Identical code in MT5 works.

The code I cited is just an example. It is a bit different there, but the meaning remains the same.

P.S. What about error 138 in the tester?

Code:

void OnTick()
  {
   if(OrdersTotal()==0)
     {
      string SYMBOL=Symbol();
      int digits=(int)SymbolInfoInteger(SYMBOL,SYMBOL_DIGITS);
      MqlTick lasttick={0};
      if(!SymbolInfoTick(SYMBOL,lasttick))
         return;
      double ask=lasttick.ask;
      double bid=lasttick.bid;

      OrderSend(SYMBOL,OP_BUY,0.1,NormalizeDouble(ask,digits),1000,0,0,"Test",0,0,CLR_NONE);
     }
  }

Result:

 
Some trivia with graphical objects.

This time OBJ_EDIT.

1) impossible to enter data, when clicking inside OBJ_EDIT nothing happens, data in the field are not highlighted (before it was impossible to exit the field except with "ENTER" key, now it is impossible to enter);

2) OBJPROP_ANCHOR does not work;

3) When OBJ_EDIT is selected, a point to move the object appears in the upper left corner, but with a certain, albeit very small, offset depending on which corner of the chart (OBJPROP_CORNER) the coordinates are counted from.

No other problems with rendering or moving of graphical objects. Thanks for the correction.
Reason: