//+------------------------------------------------------------------+ //|GetHistoryInd.mq4 - For creating file of closed and open/pending positions //|Updated 4/30/07 - Added Collect Price Action - collect M1 data while position open //+------------------------------------------------------------------+ #property copyright "" #property link "" #property indicator_chart_window extern string OpenOrderComment; extern bool CollectPriceAction=true; static int mPrev; int m; //+------------------------------------------------------------------+ int init() { mPrev=Minute(); return(0); } //+------------------------------------------------------------------+ int start() { int i,handle,hstTotal=HistoryTotal(); m=Minute(); if(m!=mPrev) //Get updates every minute { mPrev=m; GetClosedPositionData(); if(CollectPriceAction) GetPriceAction(); } return(0); } //+------------------------------------------------------------------+ void GetClosedPositionData() { int i, handle; handle=FileOpen("ClosedPositions.csv",FILE_WRITE|FILE_CSV,","); if(handle<0) return(0); for(i=0;i0) { FileSeek(handle,0,SEEK_END); FileWrite(handle,DateStamp+","+sLine); FileClose(handle); } }