Hello,
I am trying to export to a csv file Open, High, Low , Close, Volume and a Custom Indicator with iCustom. The Open, High, Low , Close, Volume is exported correctly for length=100 with last 100 values but the Custom Indicator is only returning the last value 100 times, anybody could help ?
Thanks.
I am trying to export to a csv file Open, High, Low , Close, Volume and a Custom Indicator with iCustom. The Open, High, Low , Close, Volume is exported correctly for length=100 with last 100 values but the Custom Indicator is only returning the last value 100 times, anybody could help ?
Thanks.
Inserted Code
#property copyright "Copyright 2013, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window extern int length = 100; // The amount of bars sent to be processed double ExtMap[]; // Chart buffer string nameData; int init() { nameData = Symbol()+".txt"; // name of the data file to be sent return(0); } int start() { static int old_bars = 0; // remember the amount of bars already known if (old_bars != Bars) // if a new bar is received { write_data(); // write the data file } old_bars = Bars; // remember how many bars are known return(0); } //+------------------------------------------------------------------+ void write_data() { int handle; handle = FileOpen(nameData, FILE_CSV|FILE_WRITE,';'); if(handle < 1) { Comment("Creation of "+nameData+" failed. Error #", GetLastError()); return(0); } FileWrite(handle, ServerAddress(), Symbol(), Period()); // heading FileWrite(handle, "DATE","TIME","HIGH","LOW","CLOSE","OPEN","VOLUME"); // heading int i; for (i=length-1; i>=0; i--) { FileWrite(handle, TimeToStr(Time, TIME_DATE), TimeToStr(Time, TIME_SECONDS), High, Low, Close, Open, Volume,iCustom(NULL,0,"JJMA",5,100,0,0,0)); } FileClose(handle); Comment(""); Comment("File "+nameData+" has been created. "+TimeToStr(TimeCurrent(), TIME_SECONDS) ); return(0); }