//+------------------------------------------------------------------+ //| HighLowExtractor.mq4 | //| ttitto | //|Extracts the difference between high and low of a bar and // writes it a file | //+------------------------------------------------------------------+ #property copyright "ttitto" #property link "" //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { datetime PreviousBarTime; int HighLowDifference; int handle; HighLowDifference=(High[1]-Low[1])*MathPow(10,Digits); PreviousBarTime=Time[1]; handle=FileOpen(Symbol()+"_HighLowExtractor_"+Period()+"M.csv", FILE_CSV|FILE_READ|FILE_WRITE, ';'); if(handle>0) { FileSeek(handle,0,SEEK_END); FileWrite( handle,TimeToStr(PreviousBarTime), Close[1], Open[1], High[1], Low[1], HighLowDifference); FileClose(handle); } return(0); } //+------------------------------------------------------------------+