Announcement

Collapse
No announcement yet.

Defining Newbars

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

  • Defining Newbars

    I am looking to define when newbars are created.

    Is there a way of over-riding the creation of newbars in or out of an efs that are available to users. Also forcing a newbar.

    It would also be useful to know how to customise existing indicators to work with such a regime.

    Regards,

    A

  • #2
    Re: Defining Newbars

    Hello Alvinsboy,

    Originally posted by alvinsboy
    I am looking to define when newbars are created.
    The getBarState() function is used in EFS to detect when a new bar is created. You would look for the BARSTATE_NEWBAR state, which occurs on the opening trade of the new bar. If you want to learn more about this, please review the following tutorial that explains in depth the various bar states and well as how our bar indexes update.

    Beginner Tutorial 4: Understanding Bar State and Bar Indexing

    Is there a way of over-riding the creation of newbars in or out of an efs that are available to users. Also forcing a newbar.

    It would also be useful to know how to customise existing indicators to work with such a regime.

    Regards,

    A
    EFS does not have the ability to control the creation of new bars or force a new bar. The bars are controlled strictly by the trade data for the symbol, interval and time template settings in the Advanced Chart.
    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
      Jason,

      After looking at the Tutorial, we know that the first bar has the state BARSTATE_ALLBARS, and the subsequent bars have the state BARSTATE_NEWBAR.

      If my formula requires the price of the first n bars in order to calculate the n+1 th value. And once the n+1 th value is known, the n+2 th is calculated based on the n+1 th value.

      My question is how can I specify the calculation to start at the n+1 th bar by using the bar states. Wouldn't I need to able to access the n+1 bar specifically in addition to using the bar states?

      William

      Comment


      • #4
        wwong112,

        You could use a counter variable on every new bar that incremented itself by one every new bar, or the efs built in function getCurrentBarCount().


        PHP Code:
        if(getBarState()==BARSTATE_NEWBAR){
         
        //My question is how can I specify the calculation to start at the n+1 th bar by using the bar states
         
        if(yourBarValue<getCurrentBarCount()){ 
          
        //the answer to your question is to check the number of bars processed 
          // you can start your calculation here
         
        }

        here is getCurrentBarCount() defined in the Knowledgebase.

        Comment


        • #5
          Thanks for the reply Jason,

          To reiterate, I want control over when a new bar is created by applying my criteria to tick data.

          If the creation of newbars is 'buried' in the trade symbol data, how does a tick chart produce newbars at the tick number limit ?

          Surely, NEWBAR is at least inserted in the eSignal data stream, otherwise a new bar would be created by the echange data every say 5min, instead of waiting for the tick limit. I assume eSignal change the data stream to remove the say a 5min NEWBAR to the tick limit NEWBAR say 190 ticks,

          Anyway, please confirm there is nothing I can do as a user to have control over the creation of a newbar.

          I understand the information included in the tutorial you referenced, thanks.

          Regards,

          A
          Last edited by alvinsboy; 11-15-2006, 02:54 AM.

          Comment


          • #6
            Hello Alvinsboy,

            If you want to create bars in a chart that are based on a certain number of ticks you can just specify that interval. Try entering 10T for the chart interval. This will create bars where each bar contains 10 ticks. BARSTATE_NEWBAR is not part of the data feed. It is an EFS constant that is returned by getBarState() when the first tick of a bar occurs. For a 10T chart, the first tick that occurs for a new bar is the event that getBarState() recognizes and returns BARSTATE_NEWBAR. If you want 190T bars, use that interval. Again, only the first tick out of each 190 will trigger the newbar state.

            EFS formula code does not have the ability to specify or change the chart's interval. Changing the chart interval is a manual operation. Please review this article from our eSignal KnowledgeBase to learn more about the available chart interval types.
            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

            Working...
            X