//有新的K线生成,往下运行
int m=TimeMinute(Time[0]);
int s=TimeSeconds(Time[0]);
if(m0 && s0)
{
//检查有无订单,没有订单则执行
if(OrdersTotal()==0)
{
if(Trend()==0) //多空判断自定义函数若为多头,则准备开多单。
{
if(osma<0)
{
if(ac2<ac3 && a3<ac4 && ac4<0 && 0>ac1 && ac1>ac2)
{
Print(“开多单”);
bool result=OrderSend(Symbol(),OP_BUY,order_lots,Ask,3,Ask-stop_loss10Point,0,“BUY”,1,0,clrRed); //发送买单,止损stop_loss,无止盈,止盈后面用移动止盈
}
}
}
if(Trend()==1) //多空判断自定义函数若为空头,则准备开空单
{
if(osma>0)
{
if(ac2>ac3 && ac3>ac4 && ac4>0 && 0<ac1 && ac1<ac2)
Print("开空单");
bool result=OrderSend(Symbol(),OP_SELL,order_lots,Bid,3,Bid+stop_loss*10*Point,0,"SELL",1,0,clrBlue); //发送卖单,止损stop_loss,无止盈,止盈后面用移动止盈
}
}
}
}

还有一点,我只有加上了Print函数,EA才能跑起来。