Announcement

Collapse
No announcement yet.

Getting the chart file name?

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

  • Getting the chart file name?

    I am working on a way to save the input parameters as defaults on a chart basis. Does anyone know of a way to obtain the fully qualified path name of the chart file so that the parameters can be saved for that chart?

    Thanks in advance for any assistance you might be able to provide.

    Carl Evans

  • #2
    Hello Carl,

    We don't have a method for referencing the path of a chart file. Another idea you could try is to create text files and name them with a combination of Symbol and Interval. Then add a routine in your formula that builds a string equivalent of the text file containing your parameters for that chart using getSymbol() and getInterval(). The text files would have to be placed in the eSignal/FormulaOutput/ folder.

    PHP Code:

    var aParameters = new Array(3);
    var 
    bLoaded false;
    var 
    vPar1 null;
    var 
    vPar2 null;
    var 
    vPar3 null;

    function 
    main() {
        if (
    bLoaded == false) {
            
    loadParameters();
            if (
    aParameters != null) {
                if (
    vPar1 == nullvPar1 aParameters[0];
                if (
    vPar2 == nullvPar2 aParameters[1];
                if (
    vPar3 == nullvPar3 aParameters[2];
                
    bLoaded true;
            }
        }

    }

    function 
    loadParameters() {
        var 
    getSymbol() + "-" getInterval();
        
    f.open("rt");
        if (
    f.open()) {
            var 
    0;
            for (
    03; ++i) {
                
    aParameters[i] = f.readln();
            }
        }
        
    null;
        return;

    Your text file would need to have 3 parameters, each on a separate line for this example.
    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

    Comment


    • #3
      What Jason provided is a very nice method of identifying unique files for different efs's.

      FWIW, be aware that the values that are stored need to be delimited somehow (I use commas), and when you read the line, the whole line is read as a single string. You must split(sSeparator, nLimit) the line which will then become an array. You then have to parseFloat( sValue ) the individual values to convert them from strings to numerical values.

      Comment


      • #4
        Hello Steve,

        I forgot the data conversion part. Thanks for catching that. As for the delimiters, the text file for this code example needs the data for the three parameters each on a separate line. It makes it a little easier than having to parse through comma-separated string. You should be good to go as long as the file looks something like,

        10
        false
        20

        Once the aParameters array is populated you can convert each element to it's proper data type within the routine in main also.

        if (vPar1 == null) vPar1 = aParameters[0]*1; // number
        if (vPar2 == null) vPar2 = eval(aParameters[1]); // boolean constant
        if (vPar3 == null) vPar3 = aParameters[2]*1; // number

        or:

        if (vPar1 == null) vPar1 = eval(aParameters[0]);
        if (vPar2 == null) vPar2 = eval(aParameters[1]);
        if (vPar3 == null) vPar3 = eval(aParameters[2]);
        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

        Comment


        • #5
          Not quite the solution I was looking for

          Jason and Steve,

          Thanks for your quick replies but your suggestions aren't quite what I am looking for. What I am attempting is to develop a solution for saving the defaults of a study just as it works for the Basic Study indicators. The defaults for the indicator are saved as part of the chart, independent of the Symbol-Interval combination that appears on the chart. If I could obtain the chart file name then I could store the defaults for that indicator on that chart in a file. The optimal solution would be for eSignal to provide a way for the parameters of any study to be saved using the set defaults and restore defaults buttons, however, my understanding is that this functionality is not available because the buttons are disabled in the Edit Studies dialog when I select my study from the drop down list.

          Comment


          • #6
            I have coded this functionallity in before, it works, but it is not very clean, and does not meet your "specification" in that the only way it could be saved as a unique file would be to figure in the chart interval, study name and/or the Symbol.

            Let me know if you are still interested and I will describe how I save and load them. Maybe you can help make it a little cleaner.

            Comment

            Working...
            X