Announcement

Collapse
No announcement yet.

Using sym() to change symbol processed by EFS

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

  • Using sym() to change symbol processed by EFS

    Hi all,

    I have written a comprehensive optimisation routine, that can optimise a set of variable settings for the symbol loaded for various proprietary measures.

    One of the functions I have been requesting for some time, is the ability to automatically load symbols in a pre defined watch list so that optimisation can occur on each of these symbols automatically, without me having to load each symbol individually. The original idea I had was for a function called symbol(name, number of bars to load)

    I am now aware of the new series function, one of which is sym(). has anyone got any experience of using this function to effectively deliver the above?

    I want to load the historic daily values (open, high, low and close) for a particular symbol, and then process this data within an efs formula before moving onto the next day (just as you would with the loaded symbol by using open(), high(), low() and close())

    a simple example would be useful, simply to help me get me head around how this works.

    many thanks in advance

  • #2
    reply

    Hello tj.dale,

    The first limitation you need to be aware of is the symbol limit of 7. Once your formula tries to access data for an eighth symbol, a formula exception will be thrown and the formula execution will be stopped.

    Irrespective, the data available to access for historical bars is tied to the time template settings. EFS does not have the ability to programmatically change the chart symbol or time template. These actions require manual interaction from the user.

    The sym() function will not deliver the action you are describing on its own. The sym() function is used with EFS2 built-in studies that tells the EFS2 engine to base its calculations from the specified symbol/interval. If you do a search on "sym*" you should come across several code examples using this function.

    To reference historical data, you specify the bar index, which is relative to the bar being processed by the formula. For example, to reference the close from 10 bars ago on IBM, when the chart symbol is set to something else you would use close(-10, sym("IBM")). If the chart interval is set to something other than daily, you would include the “,D” in the symbol string as follows, close(-10, sym(“IMB,D”)).
    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
      asdf

      Hi guys,

      You might be able to do what you need to do (although within the confines of the 7 symbol limit), by using efsExternal or efsInternal, and passing sym() as a parameter.

      For instance:

      PHP Code:
      var vSymbols = { "IDC""IBM", ... };
      function 
      main() {
        for (
      0vSymbols.length; ++i) {
           
      efsInternal("_calc"sym(vSymbols[i]));
        }
      }
      function 
      _calc(symSeries) {
        ... 
      your own calculations ...
        ... use 
      high(0symSeries)), ...
        ... 
      close(-1symSeries)), etc...
        ... 
      ema(20symSeriesetc ...

      In this way, your main EFS becomes a 'driver' of the efsInternal (or an external EFS).

      Comment


      • #4
        Many thanks all. I understand, I shall now see what I can come up with.

        Comment

        Working...
        X