//+------------------------------------------------------------------+ //| PDW.mq4 | //| Copyright 2014, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property indicator_chart_window extern string From_date="2014.04.02"; int y=0; //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { Comment(" "); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int total=OrdersHistoryTotal(); if(y==total)return(0); y=total; double x1,x2,x3,x4,x5,f; int y1,y2,y3,y4,y5; datetime t=StrToTime(From_date); for (int i=total-1; i>=0; i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true) { int cmd=OrderType(); if (cmd>1)continue; string symbol=OrderSymbol(); datetime time=OrderCloseTime(); double p=OrderProfit()+OrderCommission()+OrderSwap(); if (time>=t) { double tick=MarketInfo(symbol,MODE_TICKSIZE); if (tick>0) { if (cmd==0) { f=(OrderClosePrice()-OrderOpenPrice())/tick; } else { if (cmd==1) { f=(OrderOpenPrice()-OrderClosePrice())/tick; } } } //---- int s=TimeDayOfWeek(time); if (s==1) { x1+=p; y1+=f; } //---- if (s==2) { x2+=p; y2+=f; } //---- if (s==3) { x3+=p; y3+=f; } //---- if (s==4) { x4+=p; y4+=f; } //---- if (s==5) { x5+=p; y5+=f; } } else { if (time