Announcement

Collapse
No announcement yet.

Get second Symbols last days close

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

  • Get second Symbols last days close

    How can I get a second Symbols (not current Symbol) previous days daily close in main funcition?

    I try e.g. for SPY (being not current symbol):

    var indexclose = close(-1, 1, sym ("SPY"),inv ("D"));

    This just gives me the previous days daily close for the current symbol and not for SPY.

    Can anybody help? Thanks!

  • #2
    Returns the close price at the specified bar index.



    Parameters



    barIndex
    bar index of series to retrieve

    sym()
    optional. specify a symbol to use

    inv()
    optional. specify a bar interval to use




    Usage



    function main() {



    ...

    ...

    //retrieve the value for the current price bar

    myVar = close(0);

    //retrieve the value for the previous price bar

    myVar = close(-1);

    //retrieve the value for a specific symbol

    myVar = close(0, sym("IBM") );

    //retrieve the value for a specific symbol/interval

    myVar = close(0, sym("IBM,5") );

    //retrieve the value for a specific bar interval

    myVar = close(0, inv("15") );

    Comment


    • #3
      Thank you, that helps

      Comment

      Working...
      X