|
- #property copyright "frlin2003"
- #property link "http://my.fx3q.com"
- input double 浮盈=200;
- void OnTick(void)
- {
- int cnt,total;
- bool res;
- total=OrdersTotal();
- for(cnt=0;cnt<total;cnt++)
- {
- if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
- continue;
- if(OrderType()<=OP_SELL &&
- OrderSymbol()==Symbol())
- {
- if(OrderType()==OP_BUY)
- {
- if(Bid-OrderOpenPrice()>Point*浮盈)
- {
- res=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Blue);
- if(!res)
- Print("Error in OrderModify. Error code=",GetLastError());
- else
- Print("Order modified successfully.");
- }
- }
- else
- {
- {
- if((OrderOpenPrice()-Ask)>(Point*浮盈))
- {
- res=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Red);
- if(!res)
- Print("Error in OrderModify. Error code=",GetLastError());
- else
- Print("Order modified successfully.");
- }
- }
- }
- }
- }
- }
复制代码
优化中,简洁了起来。 |
|