Announcement

Collapse
No announcement yet.

ESF Script may need refining. Help!

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

  • ESF Script may need refining. Help!

    I am running a 21 tick chart on the "YM M3" with the attached efs file. When I do this my 2Ghz processor pegs out an 100% and almost stays there.

    Can someone setup the same chart configuration with this indicator and tell me if their processor gets overloaded? I am not sure if it is my computer or that this efs indicator is just too demanding.

    Thanks,

    DaTr8dr
    Attached Files

  • #2
    I would try adding setComputeOnClose() to preMain and see if it still works ok.

    Those drawShapeRelative are cpu intensive

    Comment


    • #3
      Hello DaTr8dr,

      The drawShape function is creating a unique identifier for each shape drawn on your chart, which generates a very large collection of shapes. This is the root cause of your CPU issue. One solution is to recycle a group of identifiers, or tag names, so that the shapes drawn on the oldest bars will be removed. Reducing the collection of shapes in the chart will solve the CPU problem.

      I've added a method to your formula that uses a global variable to count bars (vBarCntr). We use this number to create the tag names in your drawShape calls. You'll notice a new routine at the beginning of main() where we increment vBarCntr by one every time a new bar starts. Once that number reaches 150, we reset it to 0. You'll also notice, I've added the optional tag name parameter to each of your drawShape calls. Using the vBarCntr as part of the string (i.e. "action1" + vBarCntr) for the tag name is how we remove the old shapes. Actually, we are just moving a shape from an old bar to the current bar. What you end up with is a rotating collection of shapes from each of your onAction# functions that will be a max of 150 for each one.

      dots~line1.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
        Thanks to all of you that replied.

        DaTr8dr

        Comment

        Working...
        X