Errors, bugs, questions - page 1014

 

In the help:

structMqlTradeRequest

{

ENUM_TRADE_REQUEST_ACTIONSaction;// Type of action to be performed

ulongmagic;// Expert stamp (magic number identifier)

ulongorder;// Ticket order

stringsymbol;// Trade symbol name

doublevolume;// Requested volume of the transaction in lots

doubleprice;// Price

doublestoplimit;// StopLimit order level

doublesl;// Stop Loss level of order

doubletp;// Take Profit level of order

ulongdeviation;// Maximal deviation from the requested price

ENUM_ORDER_TYPEtype;// Order type

ENUM_ORDER_TYPE_FILLINGtype_filling;// Order type

ENUM_ORDER_TYPE_TIMEtype_time;// Order type by time of execution

datetimeexpiration;// expiration time (for ORDER_TIME_SPECIFIED orders)

stringcomment;// comment on the order

};

However, there is a description in the table below:

deviation

Maximum acceptable deviation from the requested price, set in pips.


I.e. the type of the variable must be at least float, but never ulong.

 
<br / translate="no">.

I.e. the variable type must be at least float, but never ulong.

deviation*_Point will be float
 
joo:

In the help:

structMqlTradeRequest

{

ENUM_TRADE_REQUEST_ACTIONSaction;// Type of action to be performed

ulongmagic;// Expert stamp (magic number identifier)

ulongorder;// Ticket order

stringsymbol;// Trade symbol name

doublevolume;// Requested volume of the transaction in lots

doubleprice;// Price

doublestoplimit;// StopLimit order level

doublesl;// Stop Loss level of order

doubletp;// Take Profit level of order

ulongdeviation;// Maximal acceptable deviation from the requested price

ENUM_ORDER_TYPEtype;// Order type

ENUM_ORDER_TYPE_FILLINGtype_filling;// Order type

ENUM_ORDER_TYPE_TIMEtype_time;// Order type by time of execution

datetimeexpiration;// expiration time (for ORDER_TIME_SPECIFIED orders)

stringcomment;// comment on the order

};

However, there is a description in the table below:

deviation

Maximum acceptable deviation from the requested price, set in pips.


I.e. the type of the variable must be at least float, but never ulong.

The number of points is an integer.

 
19P2l2MaS0:
Please advise what MQL5 - password is and where to find it????
This is an account and password for logging in to MQL5.com.
 
Contender:

The number of points is a whole number.

Where does it say "Number of points"?

In fact, in the structure it is of the ulong type, and in the tabular description below: doublePoint();

This is where the discrepancy lies. Either fix the structure and help, or just fix the help to match the structure.

Документация по MQL5: Основы языка / Типы данных / Целые типы / Типы char, short, int и long
Документация по MQL5: Основы языка / Типы данных / Целые типы / Типы char, short, int и long
  • www.mql5.com
Основы языка / Типы данных / Целые типы / Типы char, short, int и long - Документация по MQL5
 

Hello!

I tried to adapt the Expert Advisor to work on markets other than forex, and therefore the following questions have arisen:

1)If on Forex, the quote is given per unit of currency, then, for example on futures andCFD per contract. This question is not specifically mentioned in the documentation. Can we assume that the type of quotation corresponds to the way the security is calculated, from the enumeration of ENUM_SYMBOL_CALC_MODE. That is: With ENUM_SYMBOL_CALC_MODE: SYMBOL_CALC_MODE_FOREX the quote is given per currency unit (and the exchange rate of the account currency against the quote currency is calculated asSymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)/SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE)/SymbolInfoDouble(_Symbol,SYMBOL_TRADE_CONTRACT_SIZE)), and at valuesSYMBOL_CALC_MODE_FUTURES,SYMBOL_CALC_MODE_CFD,SYMBOL_CALC_MODE_CFDINDEX,SYMBOL_CALC_MODE_CFDLEVERAGEthe quote is given for 1 contract (and the exchange rate of the account currency against the quote currency is calculated asSymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)/SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE)) or there are exceptions?

2)What does the PositionGetDouble(POSITION_SWAP) function return? The accumulated swap in the account currency by the time of the request? Does the returned value depend on the swap accrual method fromthe ENUM_SYMBOL_SWAP_MODE enumeration. For example could it be points, base or margin currencies?

3. In the margin calculation table:

ENUM_SYMBOL_CALC_MODE enum is intended to provide information on how to calculate the amount of margin on an instrument (amount of margin requirements).

ENUM_SYMBOL_CALC_MODE

Identifier

Description

Formula

SYMBOL_CALC_MODE_FOREX

Forex mode - profit and margin calculation for Forex

Margin: Lots*Contract_Size/Leverage

Profit: (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_FUTURES

Futures mode - calculate margin and profit for futures

Margin: Lots *InitialMargin*Percentage/100

Profit: (close_price-open_price)*TickPrice/TickSize*Lots

SYMBOL_CALC_MODE_CFD

CFD mode - calculation of margin and profit for CFD

Margin: Lots *ContractSize*MarketPrice*Percentage/100

Profit: (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFDINDEX

CFD index mode - calculation of margin and profit for CFD indexes

Margin: (Lots*ContractSize*MarketPrice)*TickPrice/TickSize

Profit: (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFDLEVERAGE

CFD Leverage mode - calculation of margin and profit for CFD when trading with leverage

Margin: (Lots*ContractSize*MarketPrice*Percentage)/Leverage

Profit: (close_price-open_price)*Contract_Size*Lots

it is not specified in which currency the margin and profit are calculated? How do I requestPercentage? What is the peculiarity ofCFD Leverage mode?

4. The function requesting leverage AccountInfoInteger(ACCOUNT_LEVERAGE), which works correctly in forex, gives 1 on the futures market. How do I correctly request/define leverage in futures?

5. SymbolInfoDouble(_Symbol,SYMBOL_MARGIN_INITIAL) function - works only for futures?

Is there a more detailed description of these questions with regard to MQL5?


 
Andrew1469:

Hello!


Isn't there a more detailed description of these issues with regard to MQL5?


The calculation principles themselves can be searched on the internet, and the correct result can be achieved with the instrument specification by checking with a specific instrument and broker.
 
zfs:
The calculation principles themselves can be found on the Internet, and you can get the correct result by focusing on the instrument specification by checking on a particular instrument and broker.

Can you suggest a broker where you could check currency pairs and CFDs of all kinds from one account, and preferably also futures from one demo account?

Finam has currency pairs, CFDs on stocks and indices in MT4, but in MT5, unfortunately, only currency pairs.

Now I try currency pairs at Finam and futures at Open, but at Open the server gives 33 and 34 on request SymbolInfoInteger(_Symbol,SYMBOL_TRADE_CALC_MODE) - which is not in the ENUM_SYMBOL_CALC_MODE list.

Also I haven't found a broker for testing different ways of calculating swaps and from the documentation it is not clear, if the way of calculating swaps influences results of PositionGetDouble(POSITION_SWAP) request.

Thanks in advance!

Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте - Документация по MQL5
 
Andrew1469:
zfs:
The principles of calculation may be found on the Internet, and the correct result may be obtained by checking on a specific instrument and broker.

Can you suggest a broker where you could check currency pairs and CFDs of all kinds from one account, and preferably also futures from one demo account?

Finam has currency pairs, CFDs on stocks and indices in MT4, but in MT5, unfortunately, only currency pairs.

Now I try currency pairs at Finam and futures at Open, but at Open the server gives 33 and 34 on request SymbolInfoInteger(_Symbol,SYMBOL_TRADE_CALC_MODE) - which is not in the ENUM_SYMBOL_CALC_MODE list.

Also I haven't found a broker for testing different ways of calculating swaps and from the documentation it is not clear, if the way of calculating swaps influences results of PositionGetDouble(POSITION_SWAP) request.

Thanks in advance!

There is no such broker apparently. Use several terminals. The value there is a long type, that's why it gives you the figure, make a comparison if you don't want to get into numbers. Value of swap PositionGetDouble(POSITION_SWAP) actual by position. Yes it does, the swap is accrued on the same day over the weekend.

 
zfs:

There is no such broker, apparently. Use multiple terminals. The value there is a long type, that's why it gives you the figure, make a comparison if you don't want to get into numbers. Value of swap PositionGetDouble(POSITION_SWAP) actual by position. Yes it does, the swap is accrued on the same day over the weekend.

Then where can I find a CFD for Metatrader 5?

I'm trying to get into the numbers, but I'm somewhat hampered by the lack of clarity in the documentation, e.g. the enum tables don't list the corresponding numbers. I have found by experience that SYMBOL_CALC_MODE_FOREX is 0, but 33 and 34 are not identified in the opening server response in any way.

Regarding swaps - do I understand correctly that PositionGetDouble(POSITION_SWAP) and HistoryDealGetDouble(Deal_Ticket,DEAL_SWAP) actually give the accumulated swap in the currency of the deposit, regardless of how it is calculated?

Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства позиций
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства позиций
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Свойства позиций - Документация по MQL5