Errors, bugs, questions - page 125

 
Alexander:

TRADE_RETCODE_ORDER_CHANGED - for example, you change the openingprice of a pending orderin your Expert Advisor , but before the order reaches the server, the order has had time to trigger - therefore you cannot change the opening price.

I see. You have to change the opening price in advance. :)
 

Is it possible to add to MQL5 the possibility of getting margin on individually traded instruments? For example, we trade EURUSD and EURGBP at the same time, i.e. we have two positions. The AccountInfoDouble(ACCOUNT_MARGIN) parameter gives information about the margin of the entire account. Also I want to know how this margin is divided between two positions. This need arises when creating such a MM that would maintain the same risk for all traded instruments.

Документация по MQL5: Торговые функции / OrderCalcMargin
Документация по MQL5: Торговые функции / OrderCalcMargin
  • www.mql5.com
Торговые функции / OrderCalcMargin - Документация по MQL5
 
gpwr:

Is it possible to add to MQL5 the possibility of getting margin on individually traded instruments? For example, we trade EURUSD and EURGBP at the same time, i.e. we have two positions. The AccountInfoDouble(ACCOUNT_MARGIN) parameter gives information about the entire account margin. Also I want to know how this margin is divided between two positions. This need arises when creating such a MM that would maintain the same risk for all traded instruments.

there is a function for this purpose
bool  OrderCalcMargin(
   ENUM_ORDER_TYPE       action,           // тип ордера
   string                symbol,           // имя символа
   double                volume,           // объем
   double                price,            // цена открытия
   double&               margin            // переменная для получения значения маржи
   );
and you can also use the Standard Class Library , for examplethe CAccountInfo class
 

To the developers.

Don't think I'm being cheeky, but a question has arisen here - are you going to add holidays to the calendar as well?

PS

Also I have some suggestions and wishes on the calendar. Should I send them to servicedesk or post them on the forum?

 
sergey1294:
There is a function for this purpose, as well as you can use the Standard Class Library , for examplethe CAccountInfo class

This function calculates the margin required for an order at the current market condition. I asked for a function that calculates the margin of an already open position for each instrument. This margin should not change while the position exists.

My suggestion is to add the POSITION_MARGIN property to PositionGetDouble().

 
Interesting:

10029

TRADE_RETCODE_FROZEN

Order or position frozen


There is a certain level below which a position or an order are "frozen" (any actions with them are prohibited).

This level is a distance to the current price at which the server prohibits any actions with the order or position. This distance is measured in pips, and is set for each symbol.

It can be obtained using SymbolInfoInteger() with theSYMBOL_TRADE_FREEZE_LEVEL parameter .

What is the difference between the SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL parameters? Or should the SymbolInfoInteger() values be the same when using them?
 
olyakish:

The developers seem to have bent the compiler.

Experts which were compiled in build 321 are tested successfully in 324 tester, after recompiling in new build we get error.

Is this a common problem or am I the only one who encountered this ?

I have the same problem...
 
Yedelkin:
What is the difference between SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL parameters? Or their values of SymbolInfoInteger() must coincide?

SYMBOL_TRADE_STOPS_LEVEL

Minimum step back in pips from the current close price to place a stop order

int


As far as I understand, this is the minimum distance for setting a stop.

It's true, the wording is not very good, at least in my opinion.

 
Interesting:

SYMBOL_TRADE_STOPS_LEVEL

Minimum step back in pips from the current close price to place a stop order

int

As far as I understand, this is the minimum distance for placing a stop.

Although the wording is not very good, at least, not in my opinion.

So what is the difference?

 
sergey1294:
there is a function for that purpose...

Yes... and I wanted a function to calculate the necessary margin when opening a position, instead of MODE_MARGINREQUIRED. I typed "margin calculation" into the search and found links asking about it, and it looks like there is no such function... The time until the end of registration was little..., among the references there were also "miraculous" functions for money management. I copied the function GetMarginForOpening(), realizing that it was not optimized (the code was horrible) and had no error protection, and it was not universal (only for forex). Today I saw that everything was OK... They are not as bad developers as I thought copying that function :) Couldn't they make "switch from MT4 to MT5" a bit more useful? It's elementary things, you could spend one working day and describe the analogous functions, how much time would be saved...

p/s and why bother writing articles with making up stupid unnecessary functions when it turns out there is one...