Errors, bugs, questions - page 2014

 
fxsaber:
#property strict

It helped.

In MT5 it works fine without it. What is the different approach for?

Or is it historical tails?

 
Kirill Belousov:

are these historical tails?

Yes.

 
fxsaber:

Yes.

I see.

//---

Can you give me a hint?

AccountFreeMarginCheck(...)


Where does it take the value from - request to broker or is it calculated locally somehow (can I get a formula).

The question arose because in broker's conditions it is written, that at opening of averaging with lot exceeding by 50% or more of previous position of the same direction (which is in market), a leverage different from account and pair can be applied. That is, if I understand correctly, AccountLeverage() is effectively useless for such a case

 
Kirill Belousov:

A hint,

AccountFreeMarginCheck(...)


Where does it take value from - request to broker or somehow calculated locally (can formula).

Locally.

Forum on trading, automated trading systems & strategy testing

Expert Advisors: Quantum 103

fxsaber, 2017.09.26 09:55

double AccountFreeMarginCheck(const string Symb,const int Cmd,const double dVolume)
{
 double Margin;

 return(OrderCalcMargin((ENUM_ORDER_TYPE)Cmd, Symb, dVolume,
        SymbolInfoDouble(Symb, (Cmd == ORDER_TYPE_BUY) ? SYMBOL_ASK : SYMBOL_BID), Margin) ?
        AccountInfoDouble(ACCOUNT_MARGIN_FREE) - Margin : -1);
}

Forum on trading, automated trading systems and trading strategy testing

Features of mql5 language, subtleties and tricks

fxsaber, 2017.02.27 18:40

// Альтернатива OrderCalcMargin
bool MyOrderCalcMargin( const ENUM_ORDER_TYPE action, const string symbol, const double volume, const double price, double &margin )
{
  double MarginInit, MarginMain;

  const bool Res = SymbolInfoMarginRate(symbol, action, MarginInit, MarginMain);
  
  margin = Res ? MarginInit * price * volume * SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE) /
                 (SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE) * AccountInfoInteger(ACCOUNT_LEVERAGE)) : 0;
  
  return(Res);  
}
 
In the tester, when trying to make a sell on ASK, the trade opens and gives no errors, in the real account it gives the same results as it should.
 
Anton Ohmat:
In the tester, when trying to make a sell on ASK, the trade opens and gives no errors, in the real account it gives as it should.
Maybe in the tester Spread within Slippage? Or the Ask price in the price stream appeared within TimeOut per trade?
 
fxsaber:
Locally.

Thank you.

 

here's today's dialogue with the dealing department:

Good afternoon! Question for the programmers. Can you please advise at what point does the decision to use the leverage 1:33 for a future averaging situation with a lot greater than 50% or more of the previous position take place? i.e. at what point does the decision take place and what parameter will change the value at this decision (which parameter can be requested ) from the MT4 Expert Advisor to know that the broker is going to apply this rule to the next trade? Thank you

Hello. "To prevent excessive risks of the Company due to sharp drawdown of the Client's total net position at the liquidity provider, the Company reserves the right to limit the leverage at the level of 1:33 for new positions of the Client opened by the averaging method. It means newly opened positions on the same trading instrument, in the same direction, but with an increased lot by 50% or more in relation to the previous position. In this case, all positions are in the market at the same time" This decision is made strictly on an individual basis and starting from the fifth trade opened in this manner. In case the fifth trade is of smaller volume than the previous ones, then this rule will not apply in this case. https://www.fortfs.com/ru/conditions/trading_conditions/account_types Fort Financial Services Ltd.

In order to know that for the next open position the leverage LOSSED AFTER the opening - I can analyse the margin. How do I know that for the next trade the leverage (the one that the "Company reserves the right to...") has been decreased BEFORE the position is opened?

Hello. The leverage can be reduced in case 5 trades in a row are opened with a bigger lot and in one direction on 1 contract. If this general rule is not observed, the leverage will not be reduced. But this is a general rule, in special cases it may be modified (e.g. volatility in the market, or massive moves due to statements of central bank or country leaders). You cannot know for sure in advance that the leverage will be reduced, becausethe algorithm of calculation is triggered after opening a critical position. Fort Financial Services Ltd.

"It is not possible to determine 100% beforehand that the leverage will be reduced, as the algorithm is generated after the opening of a critical position. Fort Financial Services Ltd."

I don't mean FOREVER. I am talking just before a trade (notional - 1 millisecond in advance) how do I determine what the margin for opening a position will be? "The calculation algorithm is triggered after a critical position is opened" Which critical position is that? - The 5th or the 6th position I'm about to open?

1ms before the trade is in advance and is 100% impossible to determine, un fortunately. You may be guided by the general rule that for the 5th trade and all subsequent ones with increasing lot already reduced leverage Fort Financial Services Ltd.


Do we have in our arsenal a mechanism to determine the margin for a specific order/position at least once it has been opened?

MT4 and MT5

 

On the signals website under the Risks tab

Risk tab on the website under signals

 

A request to the developers:

Please make it possible to display chart shortcuts in terminals and open files in MetaEditor not only in one line, but inseveral lines as well.

It isVERY inconvenient when working with a large number of charts - to scroll here and there, and to rearrange is a whole epic.