Announcement

Collapse
No announcement yet.

getCurrentBarIndex syntax

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

  • getCurrentBarIndex syntax

    What am I missing? Document says:

    getCurrentBarIndex() – Returns the index of the bar currently being computed.
    getNewestBarIndex([symbol]) – Returns the index of the most recent bar.

    var nbi1;
    var nbi2;
    nbi1 == getCurrentBarIndex();
    nbi2 == getNewestBarIndex();

    both of these statments result in "undefined" variables when displaying for debug.
    Can someone show me an example of how to correctly use these functions?
    Thank you.

  • #2
    doh!

    function main(){

    var nbi1;
    var nbi2;
    nbi1 = getCurrentBarIndex();
    nbi2 = getNewestBarIndex();

    debugPrintln(nbi1+" "+nbi2);
    }

    Comment

    Working...
    X