Announcement

Collapse
No announcement yet.

Buttons to change the variables in EFS

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

  • Buttons to change the variables in EFS

    Hello,
    i found the edit_buttons.efs with programed buttons in the indichart to change the variable of an MA.
    I tried to implement this in the ITL.efs but do not get it done.
    In edit_buttons.efs the variable "study" is used and some other stuff i don't understand and i don't know why and how to implement this in a given formula. Isn't it enough to change the variable (x for example) that is given over to the main function (function main(x) and put the code for checking if a button is clicked and change x value in the main too?

    Perhaps someone could write it for the ITL.efs or any other example so i grasp it better?
    I want to be able to provide any efs with these buttons or better with a slidebar (but i didn't find a comand). In Amibroker i find it very useful to do so, as one can find the correct figures faster.

    Regards Robert

  • #2
    Hello Robert,

    Please post the current version of the ITL.efs you're trying to modify and I'll take a look.
    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
      Hi Jason,
      first i made a mistake, i was trying to change the Gravity.efs not ITL.efs.

      Goes like this:
      /************************************************** *****************
      Description : This Indicator plots Gravity oscillator
      Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002
      ************************************************** ******************/


      function preMain() {

      setStudyTitle("Center of Gravity Oscillator");
      setPriceStudy(false);
      setDefaultBarFgColor(Color.red, 1);
      setDefaultBarFgColor(Color.blue, 0);
      setComputeOnClose();
      }
      var cg_1 = 0;

      function main(Length) {
      if(Length == null)
      Length = 10;

      var count = 0;
      var num = 0;
      var cg;
      var temp;
      var denom = 0;
      var vHigh = getValue("high", 0, -Length);
      var vLow = getValue("low", 0, -Length);


      if(vHigh == null || vLow == null) {
      return;
      }

      for(count = 0; count < Length - 1; count++) {
      num += (1 + count) * ((vHigh[count] + vLow[count])/2);
      denom += (vHigh[count] + vLow[count])/2;
      }

      if(denom != 0)
      cg = - num/denom;

      temp = cg_1;
      if (getBarState() == BARSTATE_NEWBAR)
      cg_1 = cg;

      return new Array(cg,temp);

      }

      Regards
      Robert

      Comment


      • #4
        Hello Robert,

        The attached formula should do what you need. Compare this code to Edit_Buttons.efs to see how the Gravity.efs study was incorporated.
        Attached Files
        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 Jason,

          this is a great help for me.

          Regards
          Robert

          Comment

          Working...
          X