//+------------------------------------------------------------------+ //| SQ_IndicatorValuesExportEA.mq4 | //| | //| EA to export indicator values from MetaTrader | //| Output to: /{Data folder}/tester/files/******.csv | //+------------------------------------------------------------------+ #property copyright "Copyright © 2018 StrategyQuant" #property link "http://www.StrategyQuant.com" string currentTime = ""; string lastTime = ""; //+------------------------------------------------------------------+ int start() { currentTime = TimeToStr(Time[1], TIME_DATE|TIME_MINUTES|TIME_SECONDS); if(currentTime == lastTime) { return(0); } double value; // change the file name below string fileName = "Envelopes_14_0_0_0_0.1_upper.csv"; int handle = FileOpen(fileName, FILE_READ | FILE_WRITE, ";"); if(handle>0) { FileSeek(handle,0,SEEK_END); // here is the indicator value value = iEnvelopes("NULL", 0 , 14 , 0 , 0 , 0 , 0.1 , 1 , 1); // upper value //value = iEnvelopes(NULL, 0 , 14 , 0 , 0 , 0 , 0.1 , 2 , 1); // lower value FileWrite(handle, TimeToStr(Time[1], TIME_DATE|TIME_MINUTES|TIME_SECONDS), Open[1], High[1], Low[1], Close[1], Volume[1], value); FileClose(handle); } lastTime = currentTime; return(0); } //+------------------------------------------------------------------+