For the start, I'm just joined to this server and I'm an absolute newbie in forex at all. So please, don't kill me if will ask some stupid question and remember a saying "no stupid questions exists, only answers" ;) :)
So trying to learn "mql5" basics - (i have some programming background - other languages):
Looking for a way, how to calculate with mql5 script the swap, (in USD cents) what i will pay when holding a position overnight.
My current mql5 script is the next:
#include <Trade\SymbolInfo.mqh>
voidOnStart() {
CSymbolInfo sym; // symbol informations object
sym.Name( ChartSymbol() ); // get the object for the current chart symbolif( sym.SwapMode() == SYMBOL_SWAP_MODE_POINTS) {
double lot = 0.1;
double swapUSD_long = sym.SwapLong() * 0; // need help heredouble swapUSD_short = sym.SwapShort() * 0; // need help here// multiplied by zero only for testing - need help how to calculate the swap in USDPrintFormat(
"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 above script to for example: 'EURAUD" it prints to the terminal:
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
For the start, I'm just joined to this server and I'm an absolute newbie in forex at all. So please, don't kill me if will ask some stupid question and remember a saying "no stupid questions exists, only answers" ;) :)
So trying to learn "mql5" basics - (i have some programming background - other languages):
Looking for a way, how to calculate with mql5 script the swap, (in USD cents) what i will pay when holding a position overnight.
My current mql5 script is the next:
When attaching the above script to for example: 'EURAUD" it prints to the terminal:
symbol: EURAUD swap_long: -10.80 swap_short: 6.80 swapUSD_long: 0.00 swapUSD_short: 0.00
so here is a 10.8 points swap for long pos. How to convert this to "USD" (my account currecy?) with mql5? For this (probably need) somewhat to get:
Can someone give some insights how to do this?