Features of the mql5 language, subtleties and tricks - page 25

 
Alexey Viktorov:

If you're not used to it, you can write it this way

and in the OrderSend() function send a variable contract regardless of the whim of the DC.

You wrote that there is a 10 000 contract. If we will have cent accounts on MT5, they may be 1000. I would like versatility through standard MQL5 variables.
 
Vasiliy Pushkaryov:
You may have written that there is also a 10k contract. If they will have cent accounts on MT5, they may be even 1000. I want it to be universal through standard MQL5 variables.

This is the universal formula for translating into familiar lots. All normal ones have a standard lot equal to 100,000 and have always counted a lot from it. Lot 0.1 = 10000 units of base currency.

If SymbolInfoDouble(_Symbol, SYMBOL_TRADE_CONTRACT_SIZE) == 10000, we get 100000/10000 (this would be 10), and multiplying by lot 0.1 we get 1, that is 10000 base currency units.

 
Alexey Viktorov:

This is the universal formula for translating into familiar lots. All normal ones have a standard lot equal to 100,000 and have always counted a lot from it. Lot 0.1 = 10000 units of base currency.

If SymbolInfoDouble(_Symbol, SYMBOL_TRADE_CONTRACT_SIZE) == 10000 then it means 100000/10000 (this will be 10) and multiplying by 0.1 lot we get 1, that is 10000 base currency units.

I'm more interested in the pip value. I just do not remember that this cost was different in 4 on standard and cent accounts (i.e. when the contract sizes were different). I hope it's just one Just2Trade only so different. But now I will have to always check this property on new brokers or new account types.
 
Vasiliy Pushkaryov:
I am more interested in the pip value. When I was working with 4, I don't remember it ever being different for standard and cent accounts (when the contract size was different). I hope it's just one Just2Trade only so different. But now I will have to always check this property on new brokers or new account types.

Well, the point value mql counts for 1 standard lot set by the broker(DC). It is the size of the standard lot set by the broker and you need to know before you start trading. At one time it was the standard, everyone had 100000, but times have changed.

As for standard and cent accounts, that's where the difference is set on the DC's server, and it doesn't change in MT in any way. Although everything can be, but I have not met any perverts.

 
Alexey Viktorov:

Well, the point value mql counts for 1 standard lot set by the broker(DC). It is the size of the standard lot set by the broker and you need to know before you start trading. It used to be a standard, ALL had 100000, but times have changed.

As for the standard and cent accounts, the difference is set on the server DC, and in MT it does not change. This is the difference between these two types of accounts.

There are micro accounts where the contract size is 100 times less with the same volume
 
Vitaly Muzichenko:
There are micro accounts, where the contract size is 100 times less, with the same volume
If your broker sets the standard contract size at 100000 units of the base currency and applies the conversion coefficient in cents, then there is no difference for mql. The point value counts for the standard contract set by the broker (DC). Instead of these considerations, it is better to check any broker (DC) with any account.
 

Please tell me how to get the data from the left part of the Depth of Market, where each trade is displayed. The MarketBookGet() function gets data from the right part of the Depth of Market, where the volumes are aggregated.


Glass of Price

 
Maksym Mudrakov:

Please tell me how to get the data from the left part of the Depth of Market, where each trade is displayed. The MarketBookGet() function receives data from the right part of the Depth of Market, where the volumes are aggregated.


https://www.mql5.com/ru/docs/series/copyticks
Документация по MQL5: Доступ к таймсериям и индикаторам / CopyTicks
Документация по MQL5: Доступ к таймсериям и индикаторам / CopyTicks
  • www.mql5.com
Доступ к таймсериям и индикаторам / CopyTicks - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Thank you, just what I needed.
 

Forum on trading, automated trading systems and trading strategies testing

MetaEditor build 1470

fxsaber, 2016.11.12 15:05

A handy feature for Hedge accounts.

PositionSelect generates information on the net position.

The PositionGetInteger(POSITION_TICKET) returns the ticket of the first position opened, which finally formed the net position direction (PositionGetInteger(POSITION_TYPE)).

The TP and SL will correspond to the last position in time of opening, which coincides with the net position direction.

Reason: