有您的持续关注
我们会做得更好

MT4复盘工具displayPostion EA



displayPostion EA在图表中标识已经平仓订单的开仓点及平仓点。对于MT4复盘不愧为一款好工具。

MT4 EA文件放置方法请参阅:http://www.125808047.com/?p=56

使用方法如下图所示,开启智能交易然后加载displayPostion EA到图表就会显示已经平仓订单的开平仓信息。

displayPostion EA图表效果:MT4复盘工具displayPostion EA

displayPostion EA源码:

//+------------------------------------------------------------------+
//|                                               displayPostion.mq4 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link      "http://www.125808047.com/"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int SignalBS =0;
datetime startTime=NULL, endTime = NULL;
color    SignalPriceBUY = Yellow;
color    SignalPriceSELL = Cyan;
double startPrice, endprice;
int start()
  {
 int    orders=HistoryTotal(); Print("Ord=",orders);
 int i;
 for(i=orders-1;i>=0;i--)
 { 
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)  
    {
      if (OrderType( )==OP_BUY) 
        {
         SignalBS =1;      
         startTime= OrderOpenTime();endTime = OrderCloseTime ();
         startPrice= OrderOpenPrice(); endprice = OrderClosePrice ();
          SetBS();
        }
        else if (OrderType( )==OP_SELL) 
        {
          SignalBS =-1;     
          startTime= OrderOpenTime();endTime = OrderCloseTime ();
          startPrice= OrderOpenPrice(); endprice = OrderClosePrice ();
          SetBS();
       }
    }
 }  
//----
   return(0);
  }
//+------------------------------------------------------------------+
void deinit() {
   Comment("www.125808047.com");
}

void SetBS()
{
if (SignalBS == 1)
   {
   ObjectDelete("BUY SIGNAL: " + TimeToStr(startTime));
   ObjectDelete("BUY : " + TimeToStr(endTime));
   ObjectDelete("BUY Close: " + TimeToStr(endTime));
   ObjectCreate("BUY SIGNAL: " + TimeToStr(startTime),OBJ_ARROW,0,startTime,startPrice);
   ObjectSet("BUY SIGNAL: " + TimeToStr(startTime),OBJPROP_ARROWCODE,5);
   ObjectSet("BUY SIGNAL: " + TimeToStr(startTime),OBJPROP_COLOR,SignalPriceBUY);
   ObjectCreate("BUY : " + TimeToStr(endTime),OBJ_TREND,0,startTime,startPrice,endTime,endprice);
   ObjectSet("BUY : " + TimeToStr(endTime),OBJPROP_COLOR,SignalPriceBUY);
   ObjectSet("BUY : " + TimeToStr(endTime),OBJPROP_RAY,false);
   ObjectSet("BUY : " + TimeToStr(endTime),OBJPROP_STYLE,STYLE_DOT);
   ObjectCreate("BUY Close: " + TimeToStr(endTime),OBJ_ARROW,0,endTime,endprice);
   ObjectSet("BUY Close: " + TimeToStr(endTime),OBJPROP_ARROWCODE,5);
   ObjectSet("BUY Close: " + TimeToStr(endTime),OBJPROP_COLOR,Tan);
   }
if (SignalBS == -1)
   {
   ObjectDelete("SELL SIGNAL: " + TimeToStr(startTime));
   ObjectDelete("SELL : " + TimeToStr(endTime));
   ObjectDelete("SELL Close: " + TimeToStr(endTime));   ObjectCreate("SELL SIGNAL: " + TimeToStr(startTime),OBJ_ARROW,0,startTime,startPrice);
   ObjectSet("SELL SIGNAL: " + TimeToStr(startTime),OBJPROP_ARROWCODE,5);
   ObjectSet("SELL SIGNAL: " + TimeToStr(startTime),OBJPROP_COLOR,SignalPriceSELL);
   ObjectCreate("SELL : " + TimeToStr(endTime),OBJ_TREND,0,startTime,startPrice,endTime,endprice);
   ObjectSet("SELL : " + TimeToStr(endTime),OBJPROP_COLOR,SignalPriceSELL);
   ObjectSet("SELL : " + TimeToStr(endTime),OBJPROP_RAY,false);
   ObjectSet("SELL : " + TimeToStr(endTime),OBJPROP_STYLE,STYLE_DOT);
   ObjectCreate("SELL Close: " + TimeToStr(endTime),OBJ_ARROW,0,endTime,endprice);
   ObjectSet("SELL Close: " + TimeToStr(endTime),OBJPROP_ARROWCODE,5);
   ObjectSet("SELL Close: " + TimeToStr(endTime),OBJPROP_COLOR,Green);
   }
}

如您喜欢此文章请点下面分享按钮↴峰汇在线 » MT4复盘工具displayPostion EA
上一篇:
下一篇:
分享到:更多 ()