Announcement

Collapse
No announcement yet.

Not getting any help with global variables ???

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

  • Not getting any help with global variables ???

    I have posted two efs scripts with my attemp to use global variables to transfer data btw two charts from an indicator.

    THREAD : http://forum.esignal.com/showthread....&threadid=7143

    They dont work, please see scripts

    ratiostopgetglobal1.efs
    ratiostopputglobal1.efs

    My comments on thread
    *******************************************
    MY ATTEMP AT USING GLOBAL VARIABLES

    The put code is the same as rmClean code with the set up of transfer of two variables
    1) The Stop value
    2) The position : 1 for long, 2 for short

    In the GET code the user still has the rights to set COLOR and BARTHICKNESS.

    I know the Stop value is a Array, but I transferred it as a single value, this may not be correct. Anyway I loaded the PUT code onto a 5 min Chart, thats work fine. Loaded the GET code onto a 1 min chart, nothing was showing (??$#?$#)

    In the GET code I did not do NULL checks or data error checks to make sure the position code was 1 or 2 and not zero, or that the stop code was greater zero, because I dont have a clue on how to do that.

    So could some one please give me a hand and review my code.

    Thx

  • #2
    You should be able to get the help you need at these links below.

    Click here

    or

    Click here
    Excellent book on JavaScript for beginners

    Comment


    • #3
      Hello Digs,

      One minor problem I noticed with your ratiostopgetglobal1.efs is that you are using setGlobalValue calls in preMain, which isn't necessary. I made a few minor changes so that the current stop value will appear on initial load of the formula. Added some error checking for Stop and Position and removed setComputeOnClose(). Try the modified formula below and see if this works better for you.

      ratiostopgetglobal1.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


      • #4
        Example Chart

        5 Min Chart with "RatioStopPUT" Code
        Attached Files

        Comment


        • #5
          Example Chart

          1 min Char with "RatioStopGET" code
          Attached Files

          Comment


          • #6
            Jason,

            I have attached the "RatioStopPut" code, and I used your version of GET code in the 1 min chart.

            As you see the only data coming thru on the 1 min chart is on the last bars ( little blue line ), when more of the thick BLUE lines should be showing up in 1 min chart.

            I think that I am only putting into the global varialble the one value and not the Array of the indicator on the PUT chart. So how do you transfer an array, in the "RatioStopPut" code...

            Do you think this is the issue ?

            thx for the help !
            Attached Files

            Comment


            • #7
              Hello Digs,

              The reason you only see the most current stop value on the 1-minute chart is because you're not passing the historical stop values to the global area. This is not an easy routine as it would also require synchronization based on time stamps. The better way to go here would be a File input/output routine. You may need to enlist the assistance of one of our EFS consultants for this type of development.
              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


              • #8
                Ok that explains it, thanks for puttimg me in the correct direction.

                Cheers

                Comment


                • #9
                  These are the comments I got in a private message


                  ***********************
                  What exactly is it that you are trying to do? Are you trying to transfer all
                  of the historical stop values from the "Put" chart to the "Get" chart?? If
                  so, then the only good way to do it would be using the File routines that
                  RMclean was talking about (and which I assume he already did for you).
                  Global Variables can only be used in 'realtime' in that the global
                  variable(s) will always contain the most recent value. You cannot use Global
                  Variables to do the historical backfill on the second chart.... they just
                  are not designed to do that. With the current code that you have, however,
                  if you start both scripts in the morning, then the values will update
                  correctly on the "Get" chart as the day progresses (as long as you do not
                  refresh the chart).

                  That being said, hypothetically a series of arrays of global variables could
                  be used to hold maybe 50 or 100 of the historical values from the "Put"
                  chart and these could then be transferred to the "Get" chart. However, the
                  time synchronization logic ( from lower bar interval to higher bar
                  interval ) would be a bear to code and the memory overhead would be
                  ridiculous. If I were doing this for myself, I would use the file routines.

                  Comment


                  • #10
                    There is no reason you can't save the historical output data in the "put" chart as an array and then use that as a universal global for the "get" chart.

                    The one thing file I/O does do for you (other than being slower) is it does allow persistance between iterations of eSignal...

                    Garth
                    Garth

                    Comment

                    Working...
                    X