Errors, bugs, questions - page 106

 
Rosh:

This is probably for those symbols that are not in MarketWatch, as it says for SymbolName:

Output the name of the symbol for which you get an unexpected result and compare with the list in MarketWatch.
All symbols are present in MarketWatch, in particular, it returns zero for instruments of type #AA, I specifically put false in the script
string symbol=SymbolName(i,false);
If there is no symbol in the MarketWatch window, the function
if(SymbolInfoTick(symbol,last_tick))
returns error 4302, the help does not specify that for the successful operation of this function, the symbol must be present in the MarketWatch window
 
sergey1294:
...it is not mentioned in the help, that for successful work of this function it is necessary for the tool to be present in the MarketWatch window

The help really needs to be staffed with normal examples and bottlenecks.

PS

Also, there are often situations where, after making changes in the language, some EAs from the base stop working (or generate compilation errors).

 

Noticed today...MT5(access.metatrader5.com:443)

EURJPY, Daily:

For example GBPJPY, Daily: Everything is fine here.

And here is a screenshot of EURJPY, Daily of one MT4 DC:

The difference is visible to the naked eye....

How can this be fixed?

 
Rosh:

This is probably for those symbols that are not present in MarketWatch, as for SymbolName it says:

Output the name of the symbol for which you get an unexpected result and compare it to the list in MarketWatch.

For symbols that are not present in MarketWatch, SymbolInfoTick() returns an error ERR_MARKET_SELECT_ERROR "Symbol not selected in MarketWatch" (code 4302). Only EURUSD and GBPUSD are selected in MarketWatch. An elementary run shows that SymbolInfoTick() returns an error ERR_MARKET_SELECT_ERRORfor unselected symbols :

IS      0       1 (EURUSD,M15)  01:53:21        ************************************************
MF      0       1 (EURUSD,M15)  01:53:21        Инструмент - EURUSD
RR      0       1 (EURUSD,M15)  01:53:21        Валюта депозита = USD
RG      0       1 (EURUSD,M15)  01:53:21        Базовая валюта = EUR
QM      0       1 (EURUSD,M15)  01:53:21        Валюта маржи = EUR
CH      0       1 (EURUSD,M15)  01:53:21        Маржа для покупки = 1271.23
QG      0       1 (EURUSD,M15)  01:53:21        Маржа для продажи = 1271.05
CQ      0       1 (EURUSD,M15)  01:53:21        ************************************************
JQ      0       1 (EURUSD,M15)  01:53:21        Инструмент - GBPUSD
HQ      0       1 (EURUSD,M15)  01:53:21        Валюта депозита = USD
EH      0       1 (EURUSD,M15)  01:53:21        Базовая валюта = GBP
RN      0       1 (EURUSD,M15)  01:53:21        Валюта маржи = GBP
MI      0       1 (EURUSD,M15)  01:53:21        Маржа для покупки = 1553.53
DP      0       1 (EURUSD,M15)  01:53:21        Маржа для продажи = 1553.25
MG      0       1 (EURUSD,M15)  01:53:21        ************************************************
LR      0       1 (EURUSD,M15)  01:53:21        Инструмент - USDCHF
NG      0       1 (EURUSD,M15)  01:53:21        Валюта депозита = USD
NJ      0       1 (EURUSD,M15)  01:53:21        Базовая валюта = USD
EQ      0       1 (EURUSD,M15)  01:53:21        Валюта маржи = USD
RI      0       1 (EURUSD,M15)  01:53:21        SymbolInfoTick() failed, error = 4302
GL      0       1 (EURUSD,M15)  01:53:21        ************************************************
PE      0       1 (EURUSD,M15)  01:53:21        Инструмент - USDJPY
DL      0       1 (EURUSD,M15)  01:53:21        Валюта депозита = USD
DF      0       1 (EURUSD,M15)  01:53:21        Базовая валюта = USD
OL      0       1 (EURUSD,M15)  01:53:21        Валюта маржи = USD
HL      0       1 (EURUSD,M15)  01:53:21        SymbolInfoTick() failed, error = 4302
QH      0       1 (EURUSD,M15)  01:53:21        ************************************************

...

By the way, the last data block in sergey1294's log is different from the others: first, SymbolInfoTick() returns the same error code this time, and second, - don't you think that the instrument, base currency and margin currency have some strange names in this data block?

Is this a bug? Have you noticed this weirdness at all?

CE      0       OrderCalcMargin (EURUSD,M1)     20:44:27        ************************************************
IG      0       OrderCalcMargin (EURUSD,M1)     20:44:27        Инструмент - 
LS      0       OrderCalcMargin (EURUSD,M1)     20:44:27        Валюта депозита = USD
DD      0       OrderCalcMargin (EURUSD,M1)     20:44:27        Базовая валюта = 
CL      0       OrderCalcMargin (EURUSD,M1)     20:44:27        Валюта маржи = 
RG      0       OrderCalcMargin (EURUSD,M1)     20:44:27        SymbolInfoTick() failed, error = 4302
 
As for the last block of data, this is just a bit of a glitch in the loop, and in the last data query it accessed a non-existent instrument, so all fields except the deposit currency are empty
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Информация о счете - Документация по MQL5
 
sergey1294:
As for the last data block, it's just the brute force loop glitched a bit and in the last data query accessed a non-existing symbol, so all fields except deposit currency are empty

How is this? I mean, the log is not from the version of the code that was given?

Judging by the code, everything is fine there.

Or SymbolsTotal() returned one value, but during the script run, somewhere in the middle of the cycle, by a terrible accident, the broker, setting the server part, removed one symbol from available, and the SymbolsTotal() - if the script requested it - would return a new value, one less, but, since the loop end condition was based on the old value stored in the Total variable, then the corresponding functions at the last iteration when accessing the now non-existing symbol returned empty lines? :)

So far, only this scenario came up to make this happen. :)

 
I don't know how it happened, but it hasn't happened yet
 
simpleton:

... Then the calculated value is explicitly converted to ulong. Exactly to ulong, because there is a guarantee that the value to be casted is non-negative.

While being cast to an integer type, the fractional part of the real type is discarded. It is not rounding to the nearest one, but precisely the throwing away of the fractional part that guarantees non-increasing of maximum lots' value, which free margin allows. That is exactly what we need.

Simpleton, I also followed a similar way, but used an explicit conversion to int type. I assumed that the maximum possible lot size will be limited either by broker/dealer, or by the size of my own funds. So using int should be enough. Do you think there are any pitfalls with this approach (rounding "from below" using int)?
 

Developers.

How do I make parameters appear in the scripts (I'm too lazy to constantly change the code for new conditions)...?

 
Interesting:

Developers.

How do I make parameters appear in the scripts (I'm too lazy to constantly change the code for new conditions)...?


#property script_show_inputs