Errors, bugs, questions - page 611

 
x100intraday:

I'm afraid to imagine how. Actually, I need a flexible variant, I don't need one string in unchanged form, but several different strings to form, in a loop... If it's possible, I'd like to see a more specific example...

...

You can also form more complicated conditions in #define into one line:

#define LOG(text,logs,html,type,spc,style)  if(type){if(logs){okLOG(text,spc);}if(html){okHTML(text,spc,style);}}  if(!type){if(logs){erLOG(text,spc);}if(html){erHTML(text,spc,style);}}

I don't know how to solve your problem, I haven't tried it. I'll have to experiment... ))

Maybe you may form several #define' s like this and then choose what you may need in a loop.

From string to enum you can prepare function with switch in advance. But you may have a very large number of options, apparently, and this method will not work...

Oh, here's another option! You can generate an mqh file, which is preconnected to the main file. That is, there should be a function that accepts a string and then generates an mqh file. The file will be overwritten all the time. That's exactly how it would work.)))

 

tol64, the #define option makes me break into a cold sweat... I'm not disputing that I can probably work out where I need to, but it's somewhere in the Olympiad on programming using non-standard ways - if only to achieve the result at any cost. I rejected the switch method for the same reason I described above: I do not want to add extra large blocks of code for an ideologically elementary task. It seems to me that there should be a quite simple standard way... Otherwise I'm starting to feel like a hacker trying to hack into the system and get the desired result in a sophisticated way...

There's a crucial question in the air: is it possible and how to access element by element the standard list of the same timeframe periods, timeframe object visibility list and the like ready-made lists? So far I have to manually fill the array by brute force and then retrieve from there what I need by index:

ENUM_TIMEFRAMES TFsArr[3]={PERIOD_M15, PERIOD_M20, PERIOD_M30);
How much longer! Maybe you can take these elements out of the predefined array/list at once? It's one thing if I don't have enough knowledge... but I've never yet encountered anyone accessing predefined resources in someone else's code without first stuffing the cushion with copies of feathers...
 
x100intraday:
How can I prepare in advance a string with logical(?) enumeration like: OBJ_PERIOD_M10| OBJ_PERIOD_H4, to then just substitute in ObjectSetInteger () ready variable in the form of glued string? I tried to glue it together symbolically and then wrap it in StringToInteger(), but it did not work... BecauseOBJ_PERIOD_... - is an element of enum type but has the flag hex-equivalent of int type? Then this enumeration looks more like a bitwise OR operation...
You could just add them up, something like that:
ObjectSetInteger(0,highlevel,OBJPROP_TIMEFRAMES,(int)OBJ_PERIOD_M10+(int)OBJ_PERIOD_H4);

...i.e. by adding the required enums to the int variable.

 

Unrealistically large spreads:

On AlpariFS server GBPUSD 648, USDCHF 110

GBPUSD 168, USDCHF 185 on the MQ-Demo server

other symbols are within the norm.

Is it a peculiarity of the thin market or a bug in MetaTrader 5?

Pound seems to have calmed down now, but spreads on Canadian and Aussie are 88 and 61 correspondingly. The Swiss is still stuck with 185 pips spread.

void OnStart()
  {
   while(!IsStopped()){Comment(SymbolInfoInteger(_Symbol,SYMBOL_SPREAD));Sleep(100);}
   Comment("");
  }
 
Swan:
You can just add them up, that's how it works:

i.e. by adding the desired enums to the int variable.

Where do you take the enums from? They are sort of embedded in the language as predefined (reserved) words/values. I don't want to have my own array of duplicate enums.
 
x100intraday:

How can I prepend a string with logical(?) enumeration like: OBJ_PERIOD_M10| OBJ_PERIOD_H4

Then this enumeration looks more like an OR bitwise operation...

It doesn't look like that. It is what it is.

Where do you take the enums from? They're sort of embedded in the language in the form of predefined (reserved) words/values.

From the enums, of course. Look in the help.

I don't want to create my own array of duplicate enums.

you'll have to have something at least... enums, arrays, defines.

otherwise you won't get any further than that

 
sergeev:

It doesn't look like that. It is what it is.

from the enums, of course. Look it up in the help.

You'll have to do something about it. Enums, arrays, defines.

You won't get any further than that.

If you want to start it, that's fine, it's already done. But why can't we access the repository of list items embedded in the language in the form of pre-defined names and constants? Somewhere the developers stashed all these enumerations...
 
x100intraday:
Where do you take the enums from? They are sort of embedded in the language as predefined (reserved) words/values. Don't want to create my own array of duplicate enums.

don't understand the question)

ENUMs = integers, no predefined array/list.

 
Swan:

don't understand the question)

ENUM_es = integers, no predefined array/list.

ENUM_y = is an enum. A predefined list.
 
x100intraday:
But why can't we access a repository of list items embedded in the language in the form of predefined names and constants? Where did the developers put all these enumerations...

You're using the same ENUM_TIMEFRAMES. What's that to you?