Historical Account Leverage

 

Hi All,

I would like to know whether it is possible to check historical Account Leverage ? 

Alternately, if someone can guide me on how to calculate the Account Leverage using MQL5 code for a given date time would also be useful.


I've tried the below code, but the output in the journal always returns the value from the Leverage selection of the Strategy tester inputs?

//+------------------------------------------------------------------+
//|                                             Account_Leverage.mq5 |
void OnTick()
  {
//---
   printf("ACCOUNT_LEVERAGE =  %d",AccountInfoInteger(ACCOUNT_LEVERAGE));
  }
//+------------------------------------------------------------------+

The journal returns this

 

Which is due to the input from the strategy tester




Kind Regards

 

What do you mean by "historical" account leverage?

Leverage does not usually change during the accounts life.

 

Thanks for your response,

In an ideal world I totally agree, it should not be changed.

In my case however, it has been changed without any notification to me and I confronted the broker about the same, while they accepted the change happened, but did tried to blame external parties. (This is a good example of a fraudulent Broker!!)

Need to know if I can run a code to see if and when the Account Leverage was changed in the past without me noticing it.

Alternatively, code to calculate the leverage based on open positions during a particular time period, would also help.  

 
francisalmeida #: Thanks for your response, In an ideal world I totally agree, it should not be changed. In my case however, it has been changed without any notification to me and I confronted the broker about the same, while they accepted the change happened, but did tried to blame external parties. (This is a good example of a fraudulent Broker!!). Need to know if I can run a code to see if and when the Account Leverage was changed in the past without me noticing it. Alternatively, code to calculate the leverage based on open positions during a particular time period, would also help.  

No, there is no historical record of account leverage, nor can you calculate the leverage from a position's trade details.

You should not be setting a positions size (volume) primarily based on margin/leverage. That is a dangerous way of trading.

A position's size (volume) should be calculated based primarily on stop-loss size and your risk amount, and then only further checked against required margin as a secondary concern.

OrderCalcMargin

Calculates the margin required for the specified order type, in the deposit currency

OrderCalcProfit

Calculates the profit based on the parameters passed, in the deposit currency