Announcement

Collapse
No announcement yet.

main() runs once per bar?

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

  • main() runs once per bar?

    I must be missing something, I read that main() executes once per bar when its loading, but when i put code in there, it only executes once.

    function main() {

    Alert.addToList(getSymbol(), "Once per bar??", Color.blue, Color.white); // <-- I only get one Alert

    return 100; // <-- But this does plot for every period

    }


    Attached Files

  • #2
    kztd
    main() executes once per bar when it is loading. The reason you get only one alert is because the Alert.xxx functions execute only on bar index 0 (or bar index -1 if setComputeOnClose() is used)
    Alex

    Comment

    Working...
    X