【隔夜拆帳利率】顯示商品隔夜拆帳利率
此工具可以顯示隔夜拆帳利率//+------------------------------------------------------------------+
//| CheckSwaps.mq4 |
//| Copyright 2025, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- create timer
EventSetTimer(60);
int totalSymbols = SymbolsTotal(true); // true = 只顯示交易商品
Print("===== 所有交易商品掉期資訊 =====");
for(int i=0; i<totalSymbols; i++)
{
string sym = SymbolName(i, true); // 取得交易商品名稱
double swapLong = MarketInfo(sym, MODE_SWAPLONG);
double swapShort = MarketInfo(sym, MODE_SWAPSHORT);
string status = "";
if(swapLong==0 && swapShort==0)
status = " ";
else if(swapLong==0)
status = " ";
else if(swapShort==0)
status = " ";
Print(sym, " | SwapLong: ", swapLong, " | SwapShort: ", swapShort, status);
}
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
}
//+------------------------------------------------------------------+
不错,可以免费使用 吗 有些平台的掉期用系统函数好像显示不了
页:
[1]