View Single Post
  #54 (permalink)  
Old 09-12-2007, 09:05 AM
swagman1's Avatar
swagman1 swagman1 is offline
Junior Member
 
Join Date: Aug 2006
Location: Outback
Posts: 25
swagman1 is on a distinguished road
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);
}
Reply With Quote