找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
首页论坛EAHub 外汇论坛
查看: 13|回复: 0

【隔夜拆帳利率】顯示商品隔夜拆帳利率

[复制链接]

4万

主题

54

回帖

4万

积分

管理员

积分
45954
发表于 2026-8-26 16:41:00 | 显示全部楼层 |阅读模式
此工具可以顯示隔夜拆帳利率

//+------------------------------------------------------------------+
//|                                                   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 = " [Swap Free / 無掉期]";
        else if(swapLong==0)
            status = " [Long 無掉期]";
        else if(swapShort==0)
            status = " [Short 無掉期]";
        
        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()
  {
//---
   
  }
//+------------------------------------------------------------------+
复制代码



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|EAHub外汇论坛

GMT+8, 2026-10-10 19:57 , Processed in 0.127220 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表