You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python调用MultiCharts的GlobalVariable.dll找不到AccuracyGetNamedInt函数求助

问题:Python调用MultiCharts GlobalVariable.dll获取全局变量失败

我在MultiCharts中使用GlobalVariables功能一切正常,比如创建如下指标:

inputs:     DayValue(18);
AccuracySetNamedInt("Day", DayValue);
RecalcLastBarAfter(1);

在其他指标中可以通过以下代码正常获取变量"Day"的值:

value1 = AccuracyGetNamedInt("Day", -1);

我需要通过Python获取"Day"变量的值,尝试了以下代码:

import ctypes

# Load the GlobalVariable.dll
gv = ctypes.CDLL("C:\\Program Files\\MultiCharts\\GlobalVariable.dll")

# Define the function prototypes
gv.AccuracyGetNamedInt.argtypes = [ctypes.c_char_p, ctypes.c_int]
gv.AccuracyGetNamedInt.restype = ctypes.c_int

# Access the global variable
variable_name = "Day".encode('utf-8')
default_value = -1
value = gv.AccuracyGetNamedInt(variable_name, default_value)

print(f"The value of the global variable 'Day' is: {value}")

但运行后出现错误:

AttributeError: function 'AccuracyGetNamedInt' not found

查看该DLL的可用函数列表(通过dir(gv))如下:

['LoadLibrary',
 '__class__', '__class_getitem__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_dlltype']

列表中并没有AccuracyGetNamedInt函数,请问我是否可以使用该DLL中的其他函数来获取该变量的值?

内容的提问来源于stack exchange,提问作者Martingale

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 10:17:23