Download MetaTrader 5

Leverage at backtester?

To add comments, please log in or register
888FX
13
888FX  

Hi


I m having problem to figure it out what leverage ratio that backtester is using. I opened a n Alpari demo with 1:100 leverage, after downloading the test data. I have the platfrom disconnected from the server in case my historic data get overwritten. Then I started testing my EA, and I got leverage is 500 by calling the AccountLeverage() function. But sometimes I get leverage =100. So I get confused what leverage is used by the backtest. Can it be specified?


Thanks


Ken

cloudbreaker
1577
cloudbreaker  

Leverage is sometimes misunderstood. The values you refer to are safety limits.


The true leverage you are using whilst trading changes depending upon the balance of your account and the lot-size you choose to trade.


At 1:1 leverage, you require 100,000 currency units to make an order of size 1.0 lot.


In simple terms: True Leverage = (100,000*Lot-size)/Balance


CB

888FX
13
888FX  

Thanks CB


Actually I was running an EA on both of Alpari and MIG Test platform. At Alpari, the test was sucessful but it failed at MIG under the same testing parameters and period, I couldn't understand why until I used the Accountleverage() to check, Alpari is returning 500:1 at backtest mode why MIG is returning 100:1. That's why I m seeking an answer of how this leverage ratio get specified in backtest mode.


Regards


Ken

cloudbreaker
1577
cloudbreaker  

The max leverage is specified when you open a demo account. When backtests are run, the strategy tester uses a snapshot of values from the current online account/broker (or if you are offline, the most recent account/broker) accessed by that platform instance.


Does that help?


CB

888FX
13
888FX  

Hi CB


Thanks for your reply.. The weird thing is Alpari Demo account only allows user to choose 100 leverage at max, when it goes to backtest mode the platform is not connected to the server, the Accountleverage() returns 500, so I get stuck of where this 500 leverage comes from?


Thanks


Ken

Clearpaper
10
Clearpaper  

I'm having the same issue as the TS.

I've logged into a 1:500 demo account, use AccountLeverage() and MODE_LOTSTEP and see that it is shows 500 and 0.01 accordingly. For the purposes of locking the spread for backtesting, I delete the account to disconnect it. When I start it up again, the AccountLeverage reverts to 100 and the lotstep to 0.10.

I've tried all manner of getting the latest snapshot to reflect the leverage and lotstep (by having the last account, demo or live, signed in with the desired setting) but to no avail.

This leverage of 100 and lotstep 0.10 has got to be stored somewhere. Is it in the config folder? And is there anything I can do about it?

Kindly note that I've only started facing this issue with build 392. Prior to that, build 226, I had no problem getting the disconnected account to show the leverage of the last signed-in account.

Thank you for your assistance.

Clearpaper
10
Clearpaper  
Alright, I've found that it's stored in the server.ini file in the config folder. Anyone know how to edit it?
Clearpaper
10
Clearpaper  
My bad, it's accounts.ini
To add comments, please log in or register