请问一下这个EA为啥不能卖?各位老大帮忙一下
顺便帮我改好行吗
:loveliness:
extern double StopLoss = 30;//止损
extern double TakeProfit = 1000;//止赢
extern double Lots = 0.1;//默认交易单位
extern double TrailingStop = 200;//移动止损
extern int ShortEma = 10;//均线1的周期
extern int LongEma = 60;//均线2的周期
//+------------------------------------------------------------------+
//| expert initialization function 初始化函数 |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function反初始化函数 |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function 专家启动功能 //主程序 +
//| This is where we initialize internal variables for program use +
//+------------------------------------------------------------------+
int start()
{
//----
//LotCalc Declarations
int cnt, ticket, total;
//MAs
double FEMAnow,FEMAprevious,FEMA2previous,SEMAnow,SEMAprevious,SEMA2previous;
if(Bars0)
//如果开仓>0
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print(\"BUY order opened : \",OrderOpenPrice());
//如果选择定单(开仓 来自交易的定单 输出 开始购买 当前选择定单返回开盘价格
// (开单和挂单),
}
else Print(\"Error opening BUY order : \",GetLastError());
//否则 输出 购买失败或错误 返回错误原因
return(0);
}
if(isCrossed == 2) //if cross indicates SHORT swing...
//如果交叉==2
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,2,Bid+StopLoss*Point,Bid-TakeProfit*Point,\"EMA cross\",12345,0,Red);
// 开仓
if(ticket>0)
//如果开仓>0
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print(\"SELL order opened : \",OrderOpenPrice());
//如果选择定单(开仓 输出 开始销售 当前选择定单返回开盘价格
}
else Print(\"Error opening SELL order : \",GetLastError());
//否则 输出 销售失败或错误 返回错误原因
return(0);
}
return(0);
}
//Position exit function...
for(cnt=0;cnt(Point*TrailingStop))
//如果 开盘价 卖价 点值 移动止损
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
//如果/止损值 卖价 点值 移动止损 止损值
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
//修改定单 定单编号 开盘价 卖价 点值 移动止损 赢利值 颜色常数
return(0);
}
}
}
}
}
}
return(0);
}
//+------------------------------------------------------------------+
图片上传不了 |