Swap conversion formula

Hi,

Fist of all thank you for everyone's help in the past, this forum has been very beneficial to me.

I did research on the forum but I could not find an answer to my questions, please send me a link to the post if it already has been answered before.

I basically want to convert every swap modes into the deposit currency, I do think that I will be able to manage the identifier 0,1,2,3 and obviously 4 as it is already the right swap mode (https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_swap_mode) but the identifiers 5 to 8, I am very unsure how to tackle them. Identifier 5 must be calculated depending on the annual interest specified in the symbol specification, the current price (at time of calculation) and the 360 days but I can not link them together, any tips on that please ? For identifier 6 it would obviously be something similar than ID 5 but instead of current price it would be based on the open price. Regarding ID 7 & 8, I am not sure at all how I can convert these into deposit currency.

Any help on how to convert these swap modes mentioned into the deposit currency mode would be well appreciated. If I manage to figure out how in the mean time, I will post my thought about it.

Thank you.

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
• www.mql5.com
Symbol Properties - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

from the description provided -if its correct- the :

SYMBOL_SWAP_MODE_INTEREST_CURRENT

and

SYMBOL_SWAP_MODE_INTEREST_OPEN

appear to be charged after 360 days of holding a position -this is probably present in non currency pair instruments or crypto- and

with the interest on the value of the position at different prices (on the deposit currency probably)

So from the docs i deduce if a broker has a cfd with a 3.1% in the swap reading and the price is 3.23\$ per volume_unit and you have 100 volume_units

then if the mode is SYMBOL_SWAP_MODE_INTEREST_CURRENT you do :

3.23\$ x 100(vol) x 0.031 (%) = 10.013\$ interest 360 days after open .

Lorentzos Roussos #:

from the description provided -if its correct- the :

SYMBOL_SWAP_MODE_INTEREST_CURRENT

and

SYMBOL_SWAP_MODE_INTEREST_OPEN

appear to be charged after 360 days of holding a position -this is probably present in non currency pair instruments or crypto- and

with the interest on the value of the position at different prices (on the deposit currency probably)

So from the docs i deduce if a broker has a cfd with a 3.1% in the swap reading and the price is 3.23\$ per volume_unit and you have 100 volume_units

then if the mode is SYMBOL_SWAP_MODE_INTEREST_CURRENT you do :

3.23\$ x 100(vol) x 0.031 (%) = 10.013\$ interest 360 days after open .

Hi  Lorentzos,

Thank you for this answer, I will have a look at it tomorrow more in details.

I don't think that I understand the documentation saying that you get charged after 360 days holding a position but that a full year for the broker is 360 days and not 365 (probably something to deal with the bank holidays?). I still think that you would get charged daily. I am pretty sure as well that these kind of swap are also calculated on forex pairs too.

Thank you for your contribution though.

Mr Valentin Michel Draperi #:
Hi  Lorentzos,

Thank you for this answer, I will have a look at it tomorrow more in details.

I don't think that I understand the documentation saying that you get charged after 360 days holding a position but that a full year for the broker is 360 days and not 365 (probably something to deal with the bank holidays?). I still think that you would get charged daily. I am pretty sure as well that these kind of swap are also calculated on forex pairs too.

Thank you for your contribution though.

Yeah , well the 360 days are given for a reason . To either find the "per day swap" , i.e. interest like previously calculated / 360 and then i guess apply it to the daily swaps (or triple swaps) or it applies on close of the position on the current price held_days*(interest/360) or it applies every 360 days.

Best approach would be to find a broker that offers these types (or better docs with examples)

Lorentzos Roussos #:

Yeah , well the 360 days are given for a reason . To either find the "per day swap" , i.e. interest like previously calculated / 360 and then i guess apply it to the daily swaps (or triple swaps) or it applies on close of the position on the current price held_days*(interest/360) or it applies every 360 days.

Best approach would be to find a broker that offers these types (or better docs with examples)

Yes, I reckon your calculation may actually be correct, I just need to divide it by 360 days to get the swap per day. I know a few brokers with these kind of swap mode. I just bought on a demo account 1 lot on the EURJPY (see attached picture), I'll see what it'll refund me tomorrow and I'll post it to confirm this calculation is correct.

I mean, the issue I feel like I am facing too is how reliable are the swaps given by the brokers ? They seem like they are very often all over the place, only tested on demo account, maybe on live they may be a bit more reliable?

Files:

I've attached the swap refunded on the demo account. The swap rate is 1 and not 3 at time of calculation (3 is on Wednesday).So, I did not have enough time to check how to calculate it properly yet but I don't think I can get my head around it still.

Mr Valentin Michel Draperi #:
I've attached the swap refunded on the demo account. The swap rate is 1 and not 3 at time of calculation (3 is on Wednesday).So, I did not have enough time to check how to calculate it properly yet but I don't think I can get my head around it still.

Okay so swap Long is 2.65%

You bought 100000 , and the price was in yen @ 157.909

The price "now" is 157.607

so  (( 100000 x 156.607 ) x 0.0265(2.65%) )/360 = 1152.80 yen , divided by 156.607 you get 7.36 euros

Lorentzos Roussos #:

Okay so swap Long is 2.65%

You bought 100000 , and the price was in yen @ 157.909

The price "now" is 157.607

so  (( 100000 x 156.607 ) x 0.0265(2.65%) )/360 = 1152.80 yen , divided by 156.607 you get 7.36 euros

Hey again,

Brilliant thank you very much, could not get any clearer than that ! It makes Absolutely sense now!

Mr Valentin Michel Draperi #:

Hey again,

Brilliant thank you very much, could not get any clearer than that ! It makes Absolutely sense now!

Excellent ,  the SYMBOL_SWAP_MODE_INTEREST_OPEN is the same but with the entry price then .

Lorentzos Roussos #:

Excellent ,  the SYMBOL_SWAP_MODE_INTEREST_OPEN is the same but with the entry price then .