Skip to content

Instantly share code, notes, and snippets.

@currencysecrets
Last active December 23, 2015 06:19
Show Gist options
  • Save currencysecrets/6593479 to your computer and use it in GitHub Desktop.
Save currencysecrets/6593479 to your computer and use it in GitHub Desktop.
Finding out the SWAP values for a currency pair. Run this code in a SCRIPT file NOT an expert advisor file.
//+------------------------------------------------------------------+
//| Swap Values.mq4 |
//| Copyright 2013, Currency Secrets |
//| http://www.currencysecrets.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Currency Secrets (as is)."
#property link "http://www.currencysecrets.com"
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
string sym = Symbol();
string result = sym + "\n" +
"swap type = " + D( MarketInfo( sym, MODE_SWAPTYPE ), 0 ) + "\n" +
"swap long (std) = " + D( MarketInfo( sym, MODE_SWAPLONG ) ) + "\n" +
"swap short (std) = " + D( MarketInfo( sym, MODE_SWAPSHORT ) ) + "\n" +
"margin (mini) = $" + D( MarketInfo( sym, MODE_MARGINREQUIRED ) * MarketInfo( sym, MODE_LOTSTEP ), 2 ) + "\n" +
"tick value = " + D( MarketInfo( sym, MODE_TICKVALUE ) ) + "\n";
SendMail( "SWAP VALUES for " + sym + " @ " + AccountCompany(), result );
return(0);
}
string D( double price, int num = -1 ) {
if ( num == -1 ) { num = Digits; }
return( DoubleToStr( price, num ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment