|
Help with script please
I want a script that writes a file of last 50 MACD entries from MACD 2 indicator.
What I have prints zero for the MACD values and only
one value for each.
I have tried another indicator and it prints only the figure at the max
loop number (in this case bar 50 only not 49,48,47,etc).
Any help greatly appriecated.
This is what I have so far
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
double macd,sig;
int start()
{
//----
int handle=FileOpen("my_data.csv",FILE_CSV|FILE_WRITE, ',');
if (handle<0)return(0);
FileWrite(handle,"macd","sig");
for (int i=1;i<50;i++)
{
macd = iCustom(Symbol(),0,"MACD 2",0,i);
sig = iCustom(Symbol(),0,"MACD 2",1,i);
FileWrite(handle,macd,sig);
FileClose(handle);
}
//----
return(0);
}
|