Announcement

Collapse
No announcement yet.

writeToFile.efs

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • writeToFile.efs

    File Name: writeToFile.efs

    Description:
    Demonstrates how to write data to a file.

    Formula Parameters:


    Notes:


    Download File:
    writeToFile.efs

    Image:
    N/A


    EFS Code:
    PHP Code:
    /*********************************
    Provided By : eSignal. (c) Copyright 2003
    *********************************/
    function preMain() {
        
    setPriceStudy(true);
        
    setShowCursorLabel(false);
    }

    var 
    myData 0//  example data
    function main() {
        var 
    = 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();

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation
Working...
X