Announcement

Collapse
No announcement yet.

dynamic output file name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic output file name

    Good day,
    I have successfully found info on using output files from the board, and of course it works. But what I'd like to do is change the file name on the fly. ie. a separate file for EUR & GBP 10 min vs 30 min charts. Since the file declarations are done globally, before the data Symbol is picked up, is there anyway to change this once the script is running?

    Thanks
    Mark

  • #2
    flexie,

    The file declarations can be done at any time. In fact, you can actually wait until you close the efs in the post main function
    PHP Code:
    function postMain() {// executes on efs closure 
        
    var tmp getSymbol()+"_"+getInterval();
        
    nFile = new File(tmp+".txt");
        
    nFile.open("at+");
        
    //write your stuff here
        
    nFile.close();

    Comment


    • #3
      excellent, thanks Steve.

      Interesting though... the file I downloaded declared var nFile (actually 'var f' ) in its first usage. (globally) This gave me the following error

      TypeError: f has no properties

      by deleting the "var" and declaring within my "main/bInit" area, it works great, creating new files when I change the chart interval.

      Thanks
      Mark

      Comment

      Working...
      X