Calculating Swap values in deposit currency
Faisal Mahmood:
The type depends on your broker. You will need the MODE_SWAPLONG and MODE_SWAPSHORT modes for MarketInfo when getting swap. Usually, the swap type used is zero, which is in points, so just multiply the value returned by tick value. But to be honest, I have not yet seen brokers which use the other methods for returning swap. Hi, I am trying to calculate Swap values in deposit currency, however I find that
MarketInfo(symbol,MODE_SWAPTYPE) has four possible values, 0 points, 1 Base, 2 Interst, 3 Margin.
What is the best way to calculate this?
SwapTp=MarketInfo(Symbol(),MODE_SWAPTYPE); swapx3=SymbolInfoInteger(Symbol(),SYMBOL_SWAP_ROLLOVER3DAYS); string Swap_Type; switch(SwapTp) { case 0: Swap_Type="pips"; break; case 1: Swap_Type=Symbol(); break; case 2: Swap_Type="%"; break; case 3: Swap_Type=AccountCurrency(); } string swapx3day; switch(swapx3) { case 0: swapx3day="SUNDAY"; break; case 1: swapx3day="MONDAY"; break; case 2: swapx3day="TUESDAY"; break; case 3: swapx3day="WEDNESDAY"; break; case 4: swapx3day="THURSDAY"; break; case 5: swapx3day="FRIDAY"; break; case 6: swapx3day="SATURDAY"; }
Hi, I am trying to calculate Swap values in deposit currency, however I find that
MarketInfo(symbol,MODE_SWAPTYPE) has four possible values, 0 points, 1 Base, 2 Interst, 3 Margin.
What is the best way to calculate this?