Backgound:
- using mt5
- "swap" (rollover) price is defined in points (0.00001/0.001) - 5-digit broker
- account currency: USD
The question is: how to calculate the "swap value" in terms of acc. currency in mt5. With other words, how many cents i will paid for one day rollover?
Currently have this "mql5" script:
#include <Trade\SymbolInfo.mqh>
void OnStart() {
CSymbolInfo sym; // symbol informations object
sym.Name( ChartSymbol() ); // get the object for the current chart symbol
if( sym.SwapMode() == SYMBOL_SWAP_MODE_POINTS) {
double lot = 0.1;
double swapUSD_long = sym.SwapLong() * 0; // need help here
double swapUSD_short = sym.SwapShort() * 0; // need help here
PrintFormat(
"symbol: %s swap_long: %.2f swap_short: %.2f swapUSD_long: %.2f swapUSD_short: %.2f",
sym.Name(),
sym.SwapLong(),
sym.SwapShort(),
swapUSD_long,
swapUSD_short
);
}
}
When attaching the script to EURAUD, it prints to terminal:
symbol: EURAUD swap_long: -10.80 swap_short: 6.80 swapUSD_long: 0.00 swapUSD_short: 0.00
so: the rollover price is 6.8 points for the short position. How to convert it to USD with current rate? For this need:
- find the pair with the acc currency (in this case need find AUDUSD)
- get the rate of AUDUSD sym.Bid() or sym.Ask()
- and ...
simply need some help ;)