Announcement

Collapse
No announcement yet.

FunctionParameters Don't Initialize

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

  • FunctionParameters Don't Initialize

    Hi Jason,
    I have attached a study that calculates ATR. It was working fine, until suddenly the FunctionParameters didn't get initialized.
    At first, a solution was to move all Global Variables into main() and the FunctionParameters were seen again.
    I have done that in this attachment, and even that isn't working anymore.???

    This study worked. The calculations are correct.
    Load it into a chart and you will see no ATR in the study pane.
    Right click, select Edit Studies, and you will see there are no Function Parameters available for you to edit...that's why there is no ATR line plotted.

    I'm sending it "as is" for now because I have to leave and I wanted to get this in front of you. If necessary, I may be able to duplicate the problem on a very simple study, but since I don't know why it is happening, I don't know that I can duplicate it...NOTE THAT THIS HAPPENS FREQUENTLY WITH VARIOUS STUDIES AS I AM PROGRAMMING.

    Thanks, Bob
    Attached Files

  • #2
    Re: Reply to post 'FunctionParameters Don't Initialize'

    Sometimes when you change the Function Parms, you need to remove the study
    and reload it, or restart esignal, to see the changes.
    ----- Original Message -----
    From: <[email protected]>
    To: <[email protected]>
    Sent: Friday, January 30, 2004 10:49 AM
    Subject: Reply to post 'FunctionParameters Don't Initialize'


    > Hello dloomis,
    >
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    >

    Comment


    • #3
      Bob
      The first thing you need to do is to delete all instances of main() in the various comments. Even though those sections are commented out having main() in them seems to create problems in efs scripts.
      Once you do that your parameters will reappear in the Edit Studies window (see image below).
      The efs will still not work but the problem is now of a different nature
      Alex

      Comment


      • #4
        I too have been having problems with the FunctionParameter Class. It only happens in my largest script. I have not yet been able to pinpoint the exact cause. Seems to happen after I have made several search and replace updates. I save frequently. It happens even when I make no changes to anything in the FP area. I have had it happen when doing something as simple as deleting an unused variable declaration. All of a sudden all arguments return "undefined".

        I just converted my entire FP area from using an array to using variables in hopes that this might help solve the problem.

        Was:
        i = 0;
        a_FP[i] = new FunctionParameter("pClrH", FunctionParameter.COLOR);
        with(a_FP[i])
        {
        setName("High Pivot Color");
        setDefault(Color.RGB(0,255,0)); // green
        }

        Now:
        var FP01 = new FunctionParameter("pClrH", FunctionParameter.COLOR);
        FP01.setName("High Pivot Color");
        FP01.setDefault(Color.RGB(0,255,0)); // green

        A bit more of a hassle to maintain, especially in large scripts. But if it solves the problem it is worth it.

        Will also check for any reference to main() embedded in the script. What about references to preMain() or fn_UpdtLog()? Is it the word main or the () that is causing the problem with the interpreter?

        Comment


        • #5
          Gavishti

          Is it the word main or the () that is causing the problem with the interpreter?

          If I remember correctly a message from Garth explaining this issue the problem is main().
          Alex

          Comment


          • #6
            For issues related to parameters, main() in comment lines should be the only problem child.

            Note that having:

            // main

            will not cause problems having

            //main()

            will cause problems.

            That said, I have been fighting a problem that I have been assuming is a bug on my part, but which might be a bug in eSignals part. I have to investigate further to know for sure. For some reason with two different EFS scripts I have (both with very long paramter lists) loading my script will not initialize all the paramter functions...nor will reloading it. But just clicking on edit study and saying "ok" with no changes will make it all run just fine.

            scripts with smaller lists of paramters work just fine.

            Garth
            Garth

            Comment


            • #7
              OKIE-DOKIE!!!
              Alexis, whoever you may be, blessings upon your head.
              The fix you posted worked just like you said it would. Thank you.

              My study does NOT correctly calculate and draw ATR. I forgot just where I quit messing with that particular version of it, and moved on. I have since written a couple versions that will do what they should, so no problem there.

              I am new to Bulletin Board, and I wonder if I should delete the study since it doesn't work. You never know who may download it and never read the later posts??? What is the proper protocol?

              Thanks again to all.

              Bob

              Comment


              • #8
                Garth,

                Thank you for discovering the work around for this bug. I am happy to report that since making the changes several days ago I have had no further problems.

                Comment

                Working...
                X