由于我的测试平台和MT4之间在技术指标计算方面的差异,我决定尝试通过与MetaTrader兼容的自定义指标DLL将开源TA-LIB API引入MetaTrader。
我知道要使函数对MetaTrader可用,我可以简单地创建一个导出文件,然后在MT4代码中使用#import声明,但我很难理解如何使用它在C中编写自定义指示器,然后如何通过MT4访问它。
我知道这是可以做到的,但我在互联网上找不到任何例子。
有没有人有用C,C++写的指示器的参考资料或样本模板?
发布于 2012-10-06 00:48:49
我相信你会创建一个DLL,然后从指示器或EA调用它。
在谷歌上搜索生成动态链接库和/或转到http://www.mql4.com。
还有一个由Metatrader专家和指标组成的雅虎小组,其中有很多人可能会给你一个更好的答案。
发布于 2012-10-13 19:50:36
查看您的文件夹MetaTrader\experts\samples\DLLSample\,将会有源文件:
StdAfx.h
ExpertSample.dsp
ExpertSample.dsw
ExpertSample.def
ExpertSample.cpp这里有你的DLL的模板。使用它。
不要忘记在MetaTrader中正确地从DLL导入。
发布于 2014-06-14 05:38:17
自定义指标。__________________C++端
// Setup the standard call specification keyword for the compiler.
#define MQL_EXPORT __declspec(dllexport)
#define WINAPI __stdcall
MQL_EXPORT void WINAPI aCallToSimpleExternalCustomIndicatorCODE(){
return;
}自定义指标。__________________MQL4端
//
#include <aSimpleExternalCustomIndicatorCODE_HEADER.h> // should you deploy .h declarations
//
#import "aSimpleExternalCustomIndicatorCODE.dll" // #import-<start>
void aCallToSimpleExternalCustomIndicatorCODE(); // <fun> interface declaration
#import // #import-<end>
//
int start(){ // MT4.anEventFACTORY -> launched per each aNewQuoteArrivalEVENT
aCallToSimpleExternalCustomIndicatorCODE(); // example of a simple external code
return( 0 );
}https://stackoverflow.com/questions/12729775
复制相似问题