用下面语句调试:
Print(那些自定义指标的值);
估计那些iCustom的结果不对!
OrderModify(0,NULL,NULL,p2,NULL,Blue);可能不对, 不修改的参数 应使用原来的值。而不是null, 也不是0.
OrderModify(OrderTicket(),OrderOpenPrice(),........,0,Blue);
谢谢!icstom的值已经测试过正确了!在另一程序里已经成功运行icstom值
谢谢你的指导!作为感谢请留下联系方式,我将我承诺的系统发给你!
2009.05.01 16:38:56 2007.03.07 03:29 liusong EURUSD,H4: OrderSend error 3
问题提示是这样的
OrderSend(Symbol(), OP_BUYLIMIT, Lots, p1, 0,
NormalizeDouble(p1-SL*Point, Digits),NormalizeDouble(p1+TP*Point, Digits), NULL, 0,F,Red);
估计 F有错,应该是日期型的数据
OrderSend(Symbol(), OP_SELLLIMIT, Lots, p1, 0,
NormalizeDouble(p1+SL*Point, Digits), NormalizeDouble(p1-TP*Point, Digits), NULL, 0, F,Green);
我想问题应该是出现在滑点数上,你的滑点数设置为“0“,一般默认设置是”3“。
另外注释文本格式改一下,不要用 NULL 值,用一对 双引号 "" 代替,双引号内可以不需要内容。
改为:OrderSend(Symbol(), OP_SELLLIMIT, Lots, p1, 3,
NormalizeDouble(p1+SL*Point, Digits), NormalizeDouble(p1-TP*Point, Digits), "", 0, F,Green);
我贴上小小改动的文件,你测试下看行不行。
OrderSend参数错误,可能的地方,一个是楼上说的倒数第四个参数的 NULL 应该用一对双引号。
另外倒数第2个参数F应该也有问题,这个是挂单到期时间,这个应该是个时间常量。你前面定义了extern int F = 240;240这个数不是个时间(年月日小时分钟)
//+------------------------------------------------------------------+
//| liusong.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link " qq:569638390"
extern double A = 10;
extern double B = 30;
extern double C = 30;
extern double Lots = 0.1;
extern int F = 240;
extern int SL = 2000;
extern int TP = 2000;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double d1_main = iCustom(Symbol(), PERIOD_D1, "QQEA", 0, 0);
double d1_sign = iCustom(Symbol(), PERIOD_D1, "QQEA", 1, 0);
double h4_main_2 = iCustom(Symbol(), PERIOD_H4, "QQEA", 0, 2);
double h4_main_1 = iCustom(Symbol(), PERIOD_H4, "QQEA", 0, 1);
double h4_main_0 = iCustom(Symbol(), PERIOD_H4, "QQEA", 0, 0);
double p1,p2;
if ( h4_main_1-h4_main_2>A && h4_main_2<B) {
p1 = NormalizeDouble((Low[2]+Close[2])/2, Digits);
p2 = NormalizeDouble((High[2]+Close[2])/2, Digits);
OrderSend(Symbol(), OP_BUYLIMIT, Lots, p1, 0,
NormalizeDouble(p1-SL*Point, Digits),NormalizeDouble(p1+TP*Point, Digits), NULL, 0, F,Red);
}
return(0);
if (h4_main_1>C && h4_main_2-h4_main_1>A) {
p1 = NormalizeDouble((Low[2]+Close[2])/2, Digits);
p2 = NormalizeDouble((High[2]+Close[2])/2, Digits);
OrderModify(0,NULL,NULL,p2,NULL,Blue);
return(0);
}
if ( h4_main_2-h4_main_1>A && h4_main_2>C){
p1 = NormalizeDouble((Low[2]+Close[2])/2, Digits);
p2 = NormalizeDouble((High[2]+Close[2])/2, Digits);
OrderSend(Symbol(), OP_SELLLIMIT, Lots, p1, 0,
NormalizeDouble(p1+SL*Point, Digits), NormalizeDouble(p1-TP*Point, Digits), NULL, 0, F,Green);
}
return(0);
if(h4_main_1<B && h4_main_1-h4_main_2>A) {
p1 = NormalizeDouble((Low[2]+Close[2])/2, Digits);
p2 = NormalizeDouble((High[2]+Close[2])/2, Digits);
OrderModify(0,NULL,NULL,p1,NULL,Blue);
return(0);
}
//----
return(0);
}
//+------------------------------------------------------------------+