writeToFile.efs

ICE Data Services -

writeToFile.efs    

File Name: writeToFile.efs

Description:
Demonstrates how to write data to a file.

Formula Parameters:

NA

Notes:

NA

Download File:
writeToFile.efs
EFS Code:

/*****************************************************************
Provided By : eSignal. (c) Copyright 2003
*****************************************************************/

function preMain() {
    setPriceStudy(true);
    setShowCursorLabel(false);
}

var myData = 0; //  example data
function main() {
    var a = new File("myfile.txt");  //the file will be created in:  eSignal/FormulaOutput/
    if (getBarState() == BARSTATE_NEWBAR) {
        myData += 1;  
    }
 
    a.open("at+");   // Opens and appends the file
    //a.open("wt+"); // Opens and overwrites the file
    if(!a.isOpen()) {
        debugPrintln("Could not open file!");
    } else {
        a.writeln(" build a text string, " + myData + " more text etc. ");
    }
    a.close();
}