Announcement

Collapse
No announcement yet.

screen refresh from efs

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

  • screen refresh from efs

    I am still having screen refresh problems due to my efs coding. Working on getCurrentBar methods etc and wonder if there is a way to put a button on the chart using efs code that I can click and the chart refreshes. (instead of typing in 200t all the time).
    Or maybe a hotkey can be set?

    Thanks in advance.

  • #2
    Hello ratherBgolfing,

    Is this issue related to the problem we discussed in this thread? You may want to post your code so we can see what the problem is. Forcing a reload or refresh is not the best solution in my opinion.
    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
      yes, same problem

      Jason,

      Thanks for reply. Yes, this is the same issue. I first thought I/you solved it by using getCurrentBarCount() but that did not do it. It did leave the last print as the last alert in the current bar, but still left false prints.

      So I resolved myself to using your original suggestion which was to wait till the bar closes and do my alerts based on LastBar conditions.

      So, my code for this, which is still not working properly, is:

      function main() {

      nState = getBarState();

      if ( nState == BARSTATE_NEWBAR && [vflag is not short and current bar conditions indicate a short] )
      { setPriceBarColor( Color.RGB(255,0,0);
      [set vflag to "short"]
      [print short entry price]
      }

      [same code for long positon]

      return null;

      } // end of main

      If I was long and get a short condition on the first tick after the last bar closes, I want to go short. Problem is if the short condition does not hold for whole current bar, then I have printed the short entry price and wrong bar color when I do not want to be short (because it does not test conditions again until the first tick of the next bar).

      As mentioned above, I also tried printing alerts during the current bar using vBar = getCurrentBarCount() to set a Tag for drawText(), but that is not removing the false prints either.

      Again, my goal is to print alerts during the current bar if and when conditions change, but erase them if the conditions do not exist at close of the bar. In a 400t bar I am getting a lot of false prints.

      Comment


      • #4
        Hello ratherBgolfing,

        Sounds like you just need to add an else statement to your alert conditions. In the else portion you would remove the text object with removeText() and repaint the price bar color to the default color.

        PHP Code:
        if ( [your alert condition] ) {
            [
        draw text]
            [
        color bar]
            ...
        etc
        } else {  // alert condition is false
            
        removeText(getCurrentBarCount());
            [
        color bar]
            ...
        etc

        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
          re-wrote the whole file

          Jason,

          Thanks. Based on your tip, I re-wrote the entire script. Works great.

          Not using removeText() function. Instead keeping track of bar color and when first tick hits from a new bar I set lastbarcolor and fire alerts.

          Thanks again.

          ratherBgolfing (but its snowing)

          Comment

          Working...
          X