Skip to content

Instantly share code, notes, and snippets.

@currencysecrets
Created September 17, 2013 12:21
Show Gist options
  • Save currencysecrets/6593609 to your computer and use it in GitHub Desktop.
Save currencysecrets/6593609 to your computer and use it in GitHub Desktop.
SWAP Value Report - save as script in your MetaTrader 4 platform and double click to run.
//+------------------------------------------------------------------+
//| Swap Values.mq4 |
//| Copyright 2013, Currency Secrets |
//| http://www.currencysecrets.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Currency Secrets."
#property link "http://www.currencysecrets.com"
string fx[32];
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
fx[1] = "AUDCAD";
fx[2] = "AUDCHF";
fx[3] = "AUDJPY";
fx[4] = "AUDNZD";
fx[5] = "AUDSGD";
fx[6] = "AUDUSD";
fx[7] = "CADCHF";
fx[8] = "CADJPY";
fx[9] = "CHFJPY";
fx[10] = "EURAUD";
fx[11] = "EURCAD";
fx[12] = "EURGBP";
fx[13] = "EURJPY";
fx[14] = "EURNZD";
fx[15] = "EURSGD";
fx[16] = "EURUSD";
fx[17] = "GBPAUD";
fx[18] = "GBPCAD";
fx[19] = "GBPCHF";
fx[20] = "GBPJPY";
fx[21] = "GBPNZD";
fx[22] = "GBPSGD";
fx[23] = "GBPUSD";
fx[24] = "NZDCAD";
fx[25] = "NZDCHF";
fx[26] = "NZDJPY";
fx[27] = "NZDSGD";
fx[28] = "NZDUSD";
fx[29] = "SGDJPY";
fx[30] = "USDCAD";
fx[31] = "USDCHF";
fx[32] = "USDJPY";
int a = ArraySize( fx );
string l, s, t, sym;
string result;
double lots = MarketInfo( sym, MODE_LOTSTEP );
for ( int i = 1; i < a; i += 1 ) {
sym = fx[i];
result = result + "<h4>" + sym + "</h4><ul><li>swap type = " + D( MarketInfo( sym, MODE_SWAPTYPE ), 0 ) + "</li>" +
"<li>swap long (std) = " + D( MarketInfo( sym, MODE_SWAPLONG ) ) + "</li>" +
"<li>swap short (std) = " + D( MarketInfo( sym, MODE_SWAPSHORT ) ) + "</li>" +
"<li>margin (mini) = $" + D( MarketInfo( sym, MODE_MARGINREQUIRED ) * MarketInfo( sym, MODE_LOTSTEP ), 2 ) + "</li>" +
"<li>tick value = " + D( MarketInfo( sym, MODE_TICKVALUE ) ) + "</li></ul>";
}
SendMail( "SWAP VALUES - " + AccountCompany(), "<html><head></head><body>" + result + "</body></html>" );
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