Exporting Data as an indicator.....close when finished?

Questions about MultiCharts and user contributed studies.
hughesfleming
Posts: 235
Joined: 22 Apr 2014
Has thanked: 57 times
Been thanked: 60 times

Exporting Data as an indicator.....close when finished?

Postby hughesfleming » 25 Aug 2014

Hi, I am exporting some data with the following which works fine:

Code: Select all

print( file( "C:\Tempdata\"+GetSymbolName+"_data.txt"), FormatDate("yyyyMMdd", ELDateToDateTime(Date))," ",O," ",H," ",L," ",C);
The problem is that I have to manually delete the indicator or close the chart for it import properly in the target application. Is there way to close the indicator automatically after it has executed the code? Ideally it would run at a certain time and I would run a batch file to processes the different symbols. I was lost yesterday trying to figure out why these files were not importing properly and by acident closed Multicharts and like magic, everything worked.

I now know why it did not work but still don't know how to make it work.

Any suggestions would be great,

Thanks in advance,

Alex

User avatar
CrazyNasdaq
Posts: 296
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 85 times
Been thanked: 84 times

Re: Exporting Data as an indicator.....close when finished?

Postby CrazyNasdaq » 25 Aug 2014

You can't import the file to other application because the file when you create it is still in use by Multicharts or the workspace which uses the indicator. If you close the workspace or the indicator, the TXT file is free and you can use it to import to other applications. You can't use it since it's in use and working.
You can try to insert some conditions about time in the scipt, as:

if time > 1630 and time < 1700 // you can use your specified time by input variables
then begin ....

Print(File( etc....

end;

This way the file is created only in a specified interval of time

hughesfleming
Posts: 235
Joined: 22 Apr 2014
Has thanked: 57 times
Been thanked: 60 times

Re: Exporting Data as an indicator.....close when finished?

Postby hughesfleming » 25 Aug 2014

Thanks, I will give it a try.

Alex

User avatar
Henry MultiСharts
Posts: 9093
Joined: 25 Aug 2011
Has thanked: 1258 times
Been thanked: 2923 times

Re: Exporting Data as an indicator.....close when finished?

Postby Henry MultiСharts » 25 Aug 2014

Hello hughesfleming,

You can also try using FileAppend command.

hughesfleming
Posts: 235
Joined: 22 Apr 2014
Has thanked: 57 times
Been thanked: 60 times

Re: Exporting Data as an indicator.....close when finished?

Postby hughesfleming » 27 Aug 2014

Thanks! This worked perfectly.

Alex


Return to “MultiCharts”