513双均线,帮着改一下
这个EA,只能运行于一个货币对(任意)能把他敢成,同时在多个货对下运行
[*]//+----------------------------------------------------------------------------------------+
[*]//| EMA Cross |
[*]//| Clay - Copyright 2006 |
[*]//| v 1.1 fixed emas |
[*]//+----------------------------------------------------------------------------------------+
[*]
[*]
[*]
[*]//---- input parameters
[*]extern double StopLoss = 30;
[*]extern double TakeProfit = 1000;
[*]extern double Lots = 0.1;
[*]extern double TrailingStop = 200;
[*]
[*]extern int ShortEma = 3;
[*]extern int LongEma = 8;
[*]
[*]
[*]//+------------------------------------------------------------------+
[*]//| 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(Bars/ li int isCrossed= 0;br / li br / li if (FEMAnowSEMAnow && FEMAprevious > SEMAprevious && FEMA2previous < SEMAprevious)
[*] {isCrossed = 1;
[*] }
[*]
[*] if (FEMAnow < SEMAnow && FEMAprevious < SEMAprevious && FEMAprevious > SEMAprevious)
[*] {isCrossed = 2;
[*] }
[*]
[*]
[*] //We check the trading terminal to see if it is empty
[*] total= OrdersTotal();
[*] if(total < 1) //If trading terminal is empty...
[*] {
[*] if(isCrossed == 1) //if cross indicates LONG swing...
[*]
[*]
[*] {
[*] ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,2,Ask-StopLoss*Point,Ask+TakeProfit*Point,\"EMa cross\",12345,0,Yellow);
[*] if(ticket>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...
[*]
[*] {
[*]
[*] ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,2,Bid+StopLoss*Point,Bid-TakeProfit*Point,\"EMA cross\",12345,0,Red);
[*] if(ticket>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;cntPoint*TrailingStop)
[*] {
[*] if(OrderStopLoss()0)
[*] {
[*] if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
[*] {
[*] if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
[*] {
[*] OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
[*] return(0);
[*] }
[*] }
[*] }
[*] }
[*] }
[*] }
[*]
[*] return(0);
[*]}//+------------------------------------------------------------------+
复制代码 顶你一下. 必须顶 我该不会是最后一个顶的吧 我怎么没法看帖子了 经过你的指点 我还是没找到在哪 ~~~ 我靠 顶楼主~~~~~~~~~~~~~~~ 想学EA,拜师,谁收了我吧
页:
[1]