Announcement

Collapse
No announcement yet.

Need way to know if "refresed"

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

  • Need way to know if "refresed"

    I discovered that if text is drawn only once, then it is lost if the chart is refreshed. Is there a way to know inside an efs when a chart is "refreshed" This to avoid having to redraw the text continuiously

    The KB says that premain is executed on refresh but I tested for that and it is not.

    This is the code I use to draw the text and lines. The lines stay on refrest but the text does not.

    THIS IS INSIDE bInit block.
    if (Symbol1 == "$TICK") {
    addBand(HighBand,PS_SOLID,2,Color.red,"High Band");
    drawTextAbsolute(-10,(HighBand)," "+HighBand+" ",null,null,Text.VCENTER,null,12,"hightext"+counte r++);
    addBand(LowBand,PS_SOLID,2,Color.green,"Low Band");
    drawTextAbsolute(-12,(LowBand)," "+LowBand+" ",null,null,Text.VCENTER,null,12,"lowtext"+counter );
    addBand(0,PS_SOLID,1,Color.black,"Zero Band");
    }
    Last edited by jgr; 08-21-2009, 11:26 AM.

  • #2
    OK, here is the solution for redraws. I just started doing it with some advanced graphics projects.

    You have to "control state". In other words, when you create a trigger or event, you change state for certain action, objects/arrays and possibly graphics.

    So, the smartest ways to handle graphics redraws is to create a State (in an array of objects) that determine if and when to draw, redraw or clear these items.

    In the one piece of code I have now, it checks for events/triggers or others once per bar or every 10 seconds. It fires orders completely automatically and identified the nearest available trade trigger.

    The smartest this for you is to make it redraw ONCE PER BAR as a minimum and when triggers confirm. When they void or whatever, you need to change the state and then CLEAR the items from your screen.

    Have you checked out the removeText, removeLine, removeShape and other features in EFS to clear graphic items on the charts?

    Basically, you have to build what you need in efs and think about how you want to address your needs. If you could create an array of "trade events" and then manipulate that data/graphics as needed, then you could accomplish your goals.

    I'm going to post an example of a timer in another thread. You might choose to use these if needed in your project.

    Sorry I can't write up an example real quick. It would just take too long.

    Hope this helps
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment

    Working...
    X