Problem with a script that doesn't save data in a file.

 

I have a script that gets some data from each bar on a chart and it should save the data into a file, but it doesn't work.

Can you see what's missing in the code?

The script can be downloaded here: http://bit.ly/cR37IY

Thank for your reply in advance.

 
What doesn't work. Does it not create the file? Does it overwrite the file? What error message do you get? Have you checked the Documentation for FileOpen()?
 

It doesn't create the file.

I get no error at all.

I have copy/pasted FileOpen from another script that works.

 

It created the file for me. No editing nothing.

Should be under \experts\files\EURUSDShortMyBar.csv not tester\files.

 

I've tried it again and no files where created in \experts\files

I have tried to restart MT4 but no luck and no error at all. Strange!

 

Well here's the file it created in the meantime.

Couple of questions,

How many digits does your broker have? I'm 4 digits.

Is it save as Script or EA? I saved as Script.

What chart or Timeframe are u running on? I'm EUR/USD H1

Do you have Data for EUR/USD H1 going back to Jan 2009?

Files:
 

I don't know what's going on.
While i'm reply to you and testing at the same time suddently it works.
The only thing i did was scrolling back to Jan 2009 to make sure that i had data back to that date.

Thank you for your help. Very much appreciated.

 

Oh i was a bit to fast there :)

If you look at the spreadsheet the price is the same. That is not correct!

Is there a smart way of shorten the 55EMA and 100EMA numbers down from 1.50332766 to 1.5033 or 1.50332

Thanks!

 
Try to normalize double
 

That worked very well on the 55EMA and 100EMA numbers. Thanks!

What about the price, do you know how i can solve this?

I tried the same as the above with the price, but it still have 1.3237 all the way down in the spreadsheet.

Thanks!

This is the code that works for me:

double x55EMA = iMA(NULL, 0,55,0,MODE_EMA,PRICE_CLOSE,ix);
y55EMA = NormalizeDouble(x55EMA,5);
double x100EMA = iMA(NULL, 0,100,0,MODE_EMA,PRICE_CLOSE,ix);
y100EMA = NormalizeDouble(x100EMA,5);

ix = the total number of bars on chart.

Reason: