Announcement

Collapse
No announcement yet.

parameters

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

  • parameters

    hi all,

    I wrote a script which uses drawtextpixel to change the parameters of the main function. (like MA periods etc). so that I can change the MA periods by clicking the mouse. But when I reload the chart even with the same symbol and interval the parameters are reset. Is there a way to solve this problem?

    Thanks in advance

  • #2
    Hello balligil,

    You could use setGlobalValue() and getGlobalValue() to store your settings. These "universal" globals will remain in memory between reloads of the individual formula. They will be removed if you shut down eSignal or use the removeGlobalValue() function. You will need to check for the "universal" globals on the initial load (or reload) of the formula. If the getGlobalValue() call returns null then force the formula to use your defaults from within the formula. 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
      thank you for the reply. But what I do is this:

      var per

      var fp1 = new FunctionParameter("MAPeriods",FunctionParameter.NU MBER);
      fp1.setDefault(20);

      function main(MAPeriods){
      per=MAPeriods;

      drawTextPixel(...@URL=EFS:IncPer...)
      where IncPer increases period by 1

      drawTextPixel( ... @URL=EFS:changeper...)
      where changeper uses askForInput to edit MA periods.
      }

      So I can increase per and do my calculations without editing function parameters but while reloading it resets back to the value in formula parameters window. Am I doing something silly here?

      thanks

      Comment


      • #4
        Hello Balligil,

        After putting together a formula to test this idea I realized that there is another piece to this puzzle. We need to use reloadEFS() in addition to the globalValue functions. In the example formula below, I set up a simple moving average study with one user-defined input for the MA periods. You will see three buttons drawn on the chart. The top two will increase/decrease the MA periods by 1 and the "EDIT" button calls askForInput(). The current number of Periods will appear in the cursor label (i.e. MA 10). As you change the periods, the cursor label will update to reflect the current number. If you right-click and reload the formula, the number of periods will not reset back to the formula's default of 10. Let me know if you have any questions.

        Edit_Buttons.efs

        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
          I tried to use the "Edit_Buttons.efs" for my Renko Charting.

          I am allmost finished and it works fine. The only problem is I always have to reload the study manually.

          Please have a look at my Renko with button.efs.

          Thank you!
          Attached Files

          Comment


          • #6
            Hello helmutw,

            I believe you just need to reset the bInitialized variable to false inside IncPos() and IncNeg() just after bButtons is reset to false. This needs to be reset before the reload occurs so that the formulas initialization routine can execute, which will allow the new setting to take affect. Try that and let me know if you're still having trouble.
            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


            • #7
              Hello Jason!

              That´s it, now it´s working.

              Thanks for your help!

              Comment


              • #8
                You are 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