Announcement

Collapse
No announcement yet.

order of evaluation

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

  • order of evaluation

    If I have 3 indicators in a chart, loaded in the order

    ind1
    ind2
    ind3

    is there a way to guarantee that ind1 and ind2 are evaluated before ind3? I want to pass ind3 globals set in ind1 and ind2.

    Thanks.

  • #2
    Hello cashcarewins,

    I'm not totally clear on what you're trying to accomplish. Is each indicator in a separate EFS file? Please post a code example to help illustrate what you're trying to do.
    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
      Yes, 3 separate efs files

      ind1.efs

      main()
      {
      setGobalValue("x", 1);
      }

      ind2.efs
      main()
      {
      setGobalValue("y", 2);
      }

      ind3.efs
      main()
      {
      if (getGlobalValue("x") > getGlobalValue("y")
      {
      Alert.addToList("BuyBO", "BuyBO Setup " + 0, Color.navy, Color.navy);

      }
      }

      So ind1 and ind2 must be evauated before ind3. I want to ensure this if possible, either in the same chart or a different chart. In c++ you could use a semaphore for this.

      The answer may be different depending on whether all 3 indicators are in the same chart or different charts.

      Thanks.

      Comment


      • #4
        Hello cashcarewins,

        The main problem with the setGlobalValue/getGlobalValue method in EFS 1 is that there was no simply way to synchronize the historical data or control which happened first for that matter. Using EFS2, however, you can accomplish this without using setGlobalValue/getGlobalValue. You would use the efs() function. The efs() function brings in the data from the other EFS files and creates a series object within your main study. The series object will be synchronized by the EFS2 engine for you. It also won't matter which formula executes first. Each study using efs() will use it's own instance of the formula being called through the efs() function. ind1.efs and ind2.esf would not need to be running in any chart either. All your parameters, if there are any, can be controlled by your main formula, ind3.efs. Your code might look something like below.

        ind1.efs
        PHP Code:
        main() {
            return 
        x;

        ind2.efs
        PHP Code:
        main() {
            return 
        y;

        ind3.efs
        PHP Code:
        main() {
            var 
        efs("ind1.efs"0);
            var 
        efs("ind2.efs"0);
            if (
        x.getValue(0) > y.getValue(0)) {
                
        Alert.addToList("BuyBO""BuyBO Setup " 0Color.navyColor.navy);
            }

        If ind1.efs and ind2.efs need to be based on a different interval or symbol, all you need to do is pass the symbol/interval combination as the last parameter in the efs() calls. (i.e. efs("ind1.efs", sym("IBM, 5")) ).
        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