Announcement

Collapse
No announcement yet.

Custom Data Series Creation For Use In Internal Functions

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

  • Custom Data Series Creation For Use In Internal Functions

    I've read alot of posts regarding creation of a custom data series using efsinternal or efsexternal however, I have a question regarding creation of that series where I actually want to create a series that would be of different length than the number of bars on a chart.

    It appears using the efsexternal/efsinternal functions a series is created where a value is obtained and placed in the series object for every bar on the chart(I could be wrong). What If I want to create a series that does not do this but only stores a value in the series when a certain condition is present?
    Can this be accomplished?

    In EFSExternal/Internal, would returning nil just store a nil at that position within the series or would it not cause that position to be filled and thus subsequent calls to the custom function would fill in that position.

    For example

    Let's say we have a chart with 100 bars on it. a call to efsinternal/external customer function would return a series with 100 elements in it. I however want to filter some elements and in some cases it would return only 60 or so elements. Then I would pass that to other prebuilt esignal functions.



    Is this possible? Or do I need to write my own array handlers and higher level functions like MACD, SMA, RSI, CCI to use a custom data series in this Manner?

    Any suggestions would be appreciated.

    I.E.

  • #2
    Hello philli4093,

    I think the best option for you to keep things simple is to have your custom series always return a 1 or 0. Return 1 when your condition is true and 0 when false. Within your formulas that reference this series just check for the value with the xSeriesObject.getValue(nIndex) method to control formula execution based on that condition. Having valid data in each element of the series will allow you to pass the series as a source to other series functions. Hope 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


    • #3
      Thanks Jason,

      That would work for a certain kind of function, however for what I am trying to accomplish it would not. What I am wanting to do is create my own moving average based on a filtered set of data that would be place in a series object then passed to esignal functions like ma, macd, cci, etc--hence you can see my problem. I've brainstormed ways of doing this so I can take advantage of the internal esignal functions, but have come up with nothing.

      A bit of explanation of how a series is comprised might shed some light--is a series simple an array of a specific type so I could simply add values to an array of type series? this way I could accomplish this, but not do it usng efsinternal/external, but rather build it iteratively on each new bar.

      Or is there a way to do this?

      Really my goal is to not have to write my own higher level functions like macd, cci, rsi that I would pass this series to. Anyhelp would be greatly appreciated.

      Comment


      • #4
        Hello philli4093,

        A series object is an enhanced array with specific functionality designed for advanced charting. It is not part of core JavaScript. In order to use a series object as the source for another built-in series function it will require that a number exists for each element of the series. The size of the series is determined by the number of bars loaded by chart for the base interval of the series. You cannot manipulate the size of the series or insert values like a regular javascript array.

        The only way to create a custom series is through efsInternal() or efsExternal(). There isn't a constructor for the series object outside of these two methods. If your series object can contain a valid number for each element (or bar interval) then you should be able to use it a a source for the other built-ins. If not, then you will have to code your own higher level functions to accept your custom array as the source.
        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
          Jason,

          Thanks. this is exactly what I thought just wanted to see if there might be some hidden methods to make my own series that is compatible with internal functions. I'll approach from a different perspective.

          Thanks

          Comment


          • #6
            You're most welcome.
            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

            Working...
            X