You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Can the hedged margin be calculated somehow?
Thanks for the tip! In the wilderness it is SymbolInfoMarginRate. So now it's like this
double GetMarginRequired( const string Symb )
{
}
You have to clearly understand that in MT5 in different directions there can be very different margin requirements. That is, a single MT4 variant may not work. On Forex, of course, this will not be the case. But you have to remember. Therefore, in the general case it should be written like this
bool MyOrderCalcMargin( const ENUM_ORDER_TYPE action, const string symbol, const double volume, const double price, double &margin )
{
}
Thank you very much! Now it works everywhere without any problems.
I wonder if"MyOrderCalcMargin" function is still trading, and if so, how to trade it at least in the tester)
I think you can calculate everything via Symbol functions.
Forum on trading, automated trading systems and trading strategies testing
Bugs, bugs, questions
fxsaber, 2017.02.28 10:48
Metaquotes-Demo, USD account, RTS-3.17.
TickValue gives wrong value - in rubles, not in account currency (USD).
FxPro-ECN. The symbols GOLD and GOLDEURO have the same TickValue. Although, obviously, they should be different in EURUSD times.
MT5 prank on FIBOGroup-MT5 Server SGDJPY
In this situation, MyOrderCalcMargin calculates correctly, while the regular OrderCalcMargin does not!
Regular function counts in accordance with the contract specification specified in the settings of the instrument - with a margin currency NOK, respectively, for one lot is taken 1000 NOK.
You probably count as splitting the name of the currency pair SGDJPY - it takes 1000 SGD for one lot.
Accordingly, the problem is in the wrong specification of the contract on the broker's side. Contact the broker of the corresponding server.
That is, to make all OrderSend synchronized with the trading environment and avoid pitfalls, it is sufficient to make the above source code as an mqh-file and do the corresponding #include in your programs.
You can stop dancing with tambourine.
The SD told me that since the next build OrderSend() will work properly :)
The regular function counts in accordance with the contract specification specified in the settings of the instrument - with the margin currency NOK, respectively, for one lot is taken 1000 NOK.
In your case, it seems that the name of the currency pair SGDJPY is split - for one lot it takes 1000 SGD.
Accordingly, the problem is in incorrect specifying of the contract on the broker's side. Contact the broker of the corresponding server.
In MT5, there is an internal mechanism, which can convert any currency to the account currency. In this case, OrderCalcMargin 1000 NOK translates into the corresponding number of USD and outputs it.
Please make this mechanism open. For example,
These exchange rates are 100% available in the terminal, since OrderCalcMargin calculates them. Their work is particularly noticeable on MetaQuotes-Demo USD accounts, when you take FORTS symbols - their margin currency is in RUR.
This is particularly relevant because of the TickValue bug.
Forum on trading, automated trading systems and trading strategies testing
Bugs, bugs, questions
fxsaber, 2017.02.28 10:48
Metaquotes-Demo, USD account, RTS-3.17.
TickValue gives wrong value - in rubles, not in account currency (USD).
FxPro-ECN. The symbols GOLD and GOLDEURO have the same TickValue. Although, obviously, they should be different in EURUSD times.
Возвращает количество действующих ордеров.
int OrdersTotal();
Возвращаемое значение
Значение типа int.
Примечание
Не следует путать между собой действующие отложенные ордера и позиции, которые также отображаются на вкладке "Торговля" в панели "Инструменты". Ордер – это распоряжение на проведение торговой операции, а позиция является результатом одной или нескольких сделок.
При "неттинговом" учете позиций (ACCOUNT_MARGIN_MODE_RETAIL_NETTING и ACCOUNT_MARGIN_MODE_EXCHANGE) по каждому символу в любой момент времени может быть открыта только одна позиция, которая является результатом одной или более сделок. Не следует путать между собой позиции и действующие отложенные ордера, которые также отображаются на вкладке "Торговля" в панели "Инструменты".
При независимом представлении позиций (ACCOUNT_MARGIN_MODE_RETAIL_HEDGING) по каждому символу одновременно может быть открыто несколько позиций.
Смотри также
OrderSelect(), OrderGetTicket(), Свойства ордеров
"active pending orders", and NOT active pending orders, what are they?
Hello, I'm reading the documentation:
Возвращает количество действующих ордеров.
int OrdersTotal();
Возвращаемое значение
Значение типа int.
Примечание
Не следует путать между собой действующие отложенные ордера и позиции, которые также отображаются на вкладке "Торговля" в панели "Инструменты". Ордер – это распоряжение на проведение торговой операции, а позиция является результатом одной или нескольких сделок.
При "неттинговом" учете позиций (ACCOUNT_MARGIN_MODE_RETAIL_NETTING и ACCOUNT_MARGIN_MODE_EXCHANGE) по каждому символу в любой момент времени может быть открыта только одна позиция, которая является результатом одной или более сделок. Не следует путать между собой позиции и действующие отложенные ордера, которые также отображаются на вкладке "Торговля" в панели "Инструменты".
При независимом представлении позиций (ACCOUNT_MARGIN_MODE_RETAIL_HEDGING) по каждому символу одновременно может быть открыто несколько позиций.
Смотри также
OrderSelect(), OrderGetTicket(), Свойства ордеров
"active pending orders", and NOT active pending orders, what are they?
Pending orders - bystop, sellstop, bylimit and bystop.
Positions - buy and sell.
Not active - deleted orders and closed positions.
Pending orders - bystop, sellstop, bylimit and bystop.
Positions - buy and sell.
Not active - deleted orders and closed positions.
Since an order is an order to perform a trade operation, only pending orders can be considered as "active orders", while Buy and Sell Positions are not orders to perform a trade operation. Or am I missing something?