Announcement

Collapse
No announcement yet.

Referncing bars

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

  • Referncing bars

    Hi,

    Is there a way to reference bars in EFS? For example I would like to use the high of a down bar as a reference point for generating an alert/graph drawing if the subsequent bar goes above that previous down bar's high.

    Actually, the time interval can be either fixed or variable, it doesn't matter, the important part is the code structure for generating this type of graph drawing/alert.

    Thanks
    Eyal

  • #2
    Hello TraderEyal,

    You can use the data access functions to look at the bar values of the current or past bars.

    high(0) returns the high of the current bar.
    close(0) returns the close, or last trade of the current bar.

    high(-1) returns the high of the previous bar, or bar index of -1.
    close(-1) returns the close of the previous bar.

    Adding combinations of these to an if() statement creates a conditional statement to detect the condition you specify. For example,

    if (high(0) > high(-1)) {
    // The code inside this block will execute on each trade where
    // the current bars high is greater than the previous bar's high.
    // Place alert code in here.
    }
    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
      Eyal

      Also, to expand on Jason's input, the way to tell if you have a down bar is to test close(0) with close(-1). ie

      if (close()<close(-1)) then you have a down bar

      Comment

      Working...
      X