无法运行简单的专家顾问。Wnd.dll
- 来自 " bin
" 文件夹的文件,使用 VS2015 创建。
Wnd.dll
文件位于正确的“ MQL4\Libraries\
”文件夹中。
所以我尝试在实时模式下运行这个顾问,但什么也没发生。请帮助我做错了什么。
#property copyright "(c) 2012-2015 Brainroom Ltd."
#property link "http://www.nquotes.net"
#import "nquotes/nquoteslib.ex4"
int nquotes_setup( string className, string assemblyName );
int nquotes_init();
int nquotes_start();
int nquotes_deinit();
double nquotes_on_tester();
int nquotes_on_timer();
int nquotes_on_chart_event( int id, long lparam, double dparam, string sparam );
int nquotes_set_property_bool( string name, bool value );
int nquotes_set_property_int( string name, int value );
int nquotes_set_property_double( string name, double value );
int nquotes_set_property_datetime( string name, datetime value );
int nquotes_set_property_color( string name, color value );
int nquotes_set_property_string( string name, string value );
int nquotes_set_property_adouble( string name, double &value[], int count = WHOLE_ARRAY, int start = 0 );
bool nquotes_get_property_bool( string name );
int nquotes_get_property_int( string name );
double nquotes_get_property_double( string name );
datetime nquotes_get_property_datetime( string name );
color nquotes_get_property_color( string name );
string nquotes_get_property_string( string name );
int nquotes_get_property_array_size( string name );
int nquotes_get_property_adouble( string name, double &value[] );
#import
int init()
{
nquotes_setup( "Wnd.Wnd", "Wnd" ); // !!!!changed only this line (NULL, NULL) ->("Wnd.Wnd", "Wnd")
return ( nquotes_init() );
}
int start()
{
return ( nquotes_start() );
}
int deinit()
{
return ( nquotes_deinit() );
}
double OnTester()
{
return ( nquotes_on_tester() );
}
void OnTimer()
{
nquotes_on_timer();
}
void OnChartEvent( const int id, const long& lparam, const double& dparam, const string& sparam )
{
nquotes_on_chart_event( id, lparam, dparam, sparam );
}
和 C# 代码如下所示:
using NQuotes;
namespace Wnd
{
public class Wnd : MqlApi
{
public bool formCreated = false;
public override int start()
{
if (formCreated == false)
{
Form form = new Form();
form.Show();
formCreated = true;
Alert("Hello!");
}
return 0;
}
}
}
[ 更新 ]
Expert Wnd EURUSD,M15: removed EURUSD,M15: 50 tick events (3503 bars, 89656 bar states) processed (total time 0:00:05.390)
Wnd EURUSD,M15: EA.deinit() nquotes_deinit()-> [0]
Wnd OnTester returns 0.00000000000000
Wnd EURUSD,M15: EA.OnTester() nquotes_on_tester()-> [ 0.0000000000]
Tester: stop button pressed
Wnd EURUSD,M15: EA.start() nquotes_start()-> [0]
Wnd EURUSD,M15: Alert: Hello!
Wnd EURUSD,M15: EA.init() nquotes_init()-> [0]
Wnd EURUSD,M15: EA.init() nquotes_setup()-> [0]
Wnd test started