Announcement

Collapse
No announcement yet.

Can a Series be saved with setGlobalValue()?

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

  • Can a Series be saved with setGlobalValue()?

    All the examples of setGlobalValue() and getGlobalValue() show simple single value variables.

    Can a pass a series from one study to another such as?

    test1 = ema(10,"IBM,30");
    setGlobalValue("PassedSeries",test1);


    now in another study, can I do something like this?

    getGlobalValue("PassedSeries",xseries);
    var temp = xseries.getValue(-4);

    jgr

  • #2
    Yup, this should be possible. Just remember that passing the series ON EVERY TICK can be very time consuming. You might want to set it up to pass the series every "n seconds".
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      The point of doing this would be to save execution time. Sounds like what you are saying is that this is not passed by reference ie as a pointer to the array but as a definition so it would be duplicating the caluculations in each study.

      From my old days as an assembly language programmer, seams it would take a lot fewer cpu cycles to access a value in an existing array by passing its pointer than to maintain a duplicate array in another subroutine. But then, I am guessing about how this thing is architected.

      jgr

      Comment


      • #4
        As I understand it, the SERIES you create in your efs is local to the individual chart you are running the EFS on. Thus, if you decide to share this series with other charts, you need to use setGlobalValue() to make it available to other charts - thus populating the series/array in global memory each time you call setGlobalValue().

        In other words, this is not like a pointer to an array in C or other languages.

        One solution that may help would be to create the efs to pass the series only at the end of a bar. Thus, reducing the redundancy of updating the series every tick.

        Hope this helps?
        Brad Matheny
        eSignal Solution Provider since 2000

        Comment

        Working...
        X