//+------------------------------------------------------------------+ //| MyHistory.mq4 | //| MOZALEV | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Vovantos 2015" #property link "vldmrkrv@yandex.ru" #property version "1.00" #property indicator_separate_window #property strict #property indicator_buffers 1 #property indicator_color1 DarkOrange //--- input parameter //--- buffers double arr[]; int numord,numday; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //--- indicator line SetIndexStyle(0,DRAW_LINE,EMPTY,2); SetIndexBuffer(0,arr); //--- name for DataWindow and indicator subwindow label short_name="MyHistory("")"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //--- check for input parameter numord=OrdersHistoryTotal(); //--- SetIndexDrawBegin(2,WindowFirstVisibleBar()); nomsc=AccountNumber(); //--- initialization done return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void deinit() { ArrayFree(arr); return; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int nomsc; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { if(AccountNumber()!=nomsc) { ChartIndicatorDelete(0,ChartWindowFind(),"MyHistory()"); return 0; } uint data[65000][2]; int n,i=0; double sm=0.0; while(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) { data[i][0]=(int)OrderCloseTime(); data[i++][1]=OrderTicket(); } ArraySort(data,i,0,MODE_ASCEND); int numcndl=WindowFirstVisibleBar(); int ordoncndl=numord/numcndl+1; ArrayFill(arr,0,numcndl+1000,0); n=0; while(n<=i/ordoncndl) { int j=0; while(j