Download MetaTrader 5

Need help with calculating Swap when MODE_SWAPTYPE is 0

To add comments, please log in or register
user3822
158
user3822  

Hi guys,

I'm working on an indicator that presents a market overview, showing stuff like symbol, quote, tickvalue, atr, and swap.

My broker is using a 0 swaptype.

I've done some research and the best thing I could find is this formula:

MarketInfo(symbol,MODE_SWAPLONG)*MarketInfo(symbol,MODE_TICKVALUE)

I don't know how to view the swap rate directly from my broker, so I'm relying on this website: http://www.forexchurch.com/forex-broker-details.cfm?brokername=OANDA

My results seem to align with the results from the website about 60% of the time, but there are times when it's not right.

For example, here are some of my results that don't match up with the website:

Pair
My Short
Website Short
My Long
 Website Long
CADJPY
-1.22
0.740.65
-1.38
EURCAD
-0.07
-0.09-0.31
-0.42
EURGBP
0.23
0.19
-0.56
-0.45
USDJPY
-1.31
-1.48
0.76
0.86

I don't know if it's because I have to convert the currency, or if the website isn't up-to-date, if the formula I'm using is wrong, or who knows.

From my understanding, MODE_SWAPLONG/MODE_SWAPSHORT is basically just the swap rate in the form of pips, so the formula I'm using should work, in theory.

user3822
158
user3822  
Update: I downloaded a free Swap indicator from the market and everything seems to be lining up, other than the free indicator rounds down and my results round up.
To add comments, please log in or register