Announcement

Collapse
No announcement yet.

creating my own series function

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

  • creating my own series function

    i have read thread 'main() - return value or series?', that sounds like returning a series would be a bit better than returning a single value. then i will soon make change to all my efs. and also, that sounds like part of my debt has been fixed. but one thing comes to my mind which is, how can i create my own series function, so i can return it in my efs' main().

    after writing a few efs. i am kind of like wanting to write my own series function, so i can always return a series at the end of my efs.

    my question is,
    is it possible for user to create its own series function? is there anybody who can provide some help?

    look forward to your reply

  • #2
    Hello dietcoke2000,

    Yes, you can create a custom series in your formulas. Please see efsInternal() function. This function creates a series object based on the returned results from a user-defined function within your formula. You can also create a series object from the returned data series of an external formula with efsExternal(). If you need more code examples, please try a forum search on the keyword phrase efsInternal* AND efsExternal*.
    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
      "which is better or processing friendly?"

      thank you for your reply.

      and i have been working on my own function using only efsInternal so far. i won't say i am making much progress, and i hope i will. and i believe i will have more questions on this issue later on. but belows are what i hope to resolve now,

      "which is better or processing friendly?"

      may i ask,
      supposedly, the more calculations and the more outputs in one single efs will become more time consumming to process, right?

      for price/upper chart,
      user often able to add more than one efs function in the same price/upper chart.
      1, which is more appropriate? ...
      1.1, using one efs function with one/multiple set(s) of calculation to produce more than one output in it, or
      1.2, using multiple efs functions with one set of calculation for just one output in each of them

      for lower chart ,
      each of the studies or efs functions often has their own panel space to display. and i understand that user may not directly apply one basic study onto another basic study, and i suppose that too for applying one efs function onto another one efs function or cross between basic study & efs function, right?
      2, which is more appropriate? ...
      2.1, using one efs function with one/multiple set(s) of calculation to produce more than one output in it, or
      2.2, using multiple efs functions with one set of calculation for just one output in each of them

      others,
      3, can user have more than one efsinternal function in a single efs? and,
      3.1, can i call another efsinternal function from within another efsinternal function for its own calculation in the same one efs, or i can only call any efsinternal function directly from main()?

      Comment


      • #4
        Re: "which is better or processing friendly?"

        Hello dietcoke2000,

        Originally posted by dietcoke2000
        thank you for your reply.

        and i have been working on my own function using only efsInternal so far. i won't say i am making much progress, and i hope i will. and i believe i will have more questions on this issue later on. but belows are what i hope to resolve now,

        "which is better or processing friendly?"

        may i ask,
        supposedly, the more calculations and the more outputs in one single efs will become more time consumming to process, right?
        Correct.

        for price/upper chart,
        user often able to add more than one efs function in the same price/upper chart.
        1, which is more appropriate? ...
        1.1, using one efs function with one/multiple set(s) of calculation to produce more than one output in it, or
        1.2, using multiple efs functions with one set of calculation for just one output in each of them
        There is no right or wrong answer here. At this point you need to start writing some code and try these two scenarios to see which one your prefer.

        for lower chart ,
        each of the studies or efs functions often has their own panel space to display. and i understand that user may not directly apply one basic study onto another basic study, and i suppose that too for applying one efs function onto another one efs function or cross between basic study & efs function, right?
        2, which is more appropriate? ...
        2.1, using one efs function with one/multiple set(s) of calculation to produce more than one output in it, or
        2.2, using multiple efs functions with one set of calculation for just one output in each of them
        The Basic studies from the Basic Studies menu can be merged together. If that is what you meant by "basic study onto another basic study." After applying the studies to the chart, hold down the "Shift" key and click and drag one of the studies onto the other.

        For applying an EFS function onto another EFS function, you can perform study on study calculations. Look at the code examples in the EFS KB for the corresponding Built-In Studies. Each of the Basic studies form the Basic Studies menu has a corresponding EFS series function that can be used in EFS.

        Regarding 2.1 vs. 2.2, again, this is going to be your personal preference.

        others,
        3, can user have more than one efsinternal function in a single efs? and,
        3.1, can i call another efsinternal function from within another efsinternal function for its own calculation in the same one efs, or i can only call any efsinternal function directly from main()?
        3 - Yes.
        3.1 - Yes, you can have nested efsInternal() routines. efsInternal() may be used outside of main().
        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
          thank you for your reply.

          what i was saying about applying 'basic study onto another basic study', which i really mean was applying 'a basic study to another basic study', like sma of another sma, sma of volume to achieve average volume, not just merging the study panels.

          i know there is a efs for volume+ma, but i just want to know whether i can do it without the efs way.

          and i supposed the only way to create 'apply study to study', like volume+ma, is to do it in efs, right? and i cannot just drag&drop a sma to the volume panel to create volume+sma, or drage&drop a sma to another sma to create sma of another sma, right?

          Comment


          • #6
            Hello dietcoke2000,

            To perform study-of-study formulas, you need to use EFS. The drag and drop merging of study panes only creates an overlay of the merged studies. It does not change the source for the calculations.
            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


            • #7
              now i am trying to add efsExternal() into my efs. part of it require the name of the ext. efs file. and i added a little validation routine in the new efs, which is as belows.

              var fName = "customOsc.efs";
              var fEfs = new File (fName);
              if (fEfs.exists()) debugPrintln('customOsc file exist '+ fEfs.exists());
              else debugPrintln('customOsc file not found '+fEfs.exists());

              unfortunately, my little routine always returns false. and i tried relocating the file to various diff. dir. or changing the 'formula root' dir., still no change.

              and hoping someone can lend me a hand.

              thanks.

              Comment


              • #8
                Hello dietcoke2000,

                You need to change the Formula Output Root in the EFS Settings to point to "...\eSignal\Formulas", not the Formula Root. Then place your customOsc.efs at \eSignal\Formulas\ and your code should return true. You can also specify a file by its path within the formulas folder in your fname string if need be. Please let me know if this helps.
                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


                • #9
                  Jason, thanks for the tip. it worked, even i am still not so sure why i have to route the 'formula output root' to a efs import dir. anyway it is working now.

                  and now, i am trying to create a 'day of week' series, kind of like what day() or getDay() do. and i have read thru some articles in efs centre+forum about day(), getDay(), .getDay() & more, but i am still not prefectly understand their differences, as well as how exactly they all should be use.

                  1, what is the diff. between the functions, getValue('time'), getValue('rawtime') & rawtime() & the date method, .getTime()?

                  2, do functions, day() & getDay(), and the date method, .getTime(), all work the same way? or just a shortcut to one or another?

                  3, is there a 'day of week' series function? like day() & getDay() which is able to create/return a series object with certain type of value.
                  3.1, or, what function i should use to create a 'day of week' series?

                  Comment


                  • #10
                    dietcoke2000
                    With regards to the 'day of the week' function you may want to look at the example that I posted in this thread.
                    To create a series out of the values returned by that function simply call it from main() using the efsInternal() function. Once you have done that you can access its values using the .getValue() method (ie like you would do with a built-in study)
                    Alex


                    Originally posted by dietcoke2000
                    Jason, thanks for the tip. it worked, even i am still not so sure why i have to route the 'formula output root' to a efs import dir. anyway it is working now.

                    and now, i am trying to create a 'day of week' series, kind of like what day() or getDay() do. and i have read thru some articles in efs centre+forum about day(), getDay(), .getDay() & more, but i am still not prefectly understand their differences, as well as how exactly they all should be use.

                    1, what is the diff. between the functions, getValue('time'), getValue('rawtime') & rawtime() & the date method, .getTime()?

                    2, do functions, day() & getDay(), and the date method, .getTime(), all work the same way? or just a shortcut to one or another?

                    3, is there a 'day of week' series function? like day() & getDay() which is able to create/return a series object with certain type of value.
                    3.1, or, what function i should use to create a 'day of week' series?

                    Comment

                    Working...
                    X