Announcement

Collapse
No announcement yet.

setBarBgColor

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

  • setBarBgColor

    Can someone tell me why the following efs paints the last two bars with white background color instead of the bar with index -1 only?

    - Clearpicks

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("testing");
        
    setShowCursorLabel(false);
        
    setComputeOnClose();
    }

    function 
    main() {

        if ( 
    getBarState() == BARSTATE_ALLBARS ) {
        }
        
        if ( 
    getInterval() == ) {
            if ( 
    getCurrentBarIndex() == -) {
                
    debugPrintln(getValue("Hour"0, -1) + ":" getValue("Minute"0, -1));
                
    setBarBgColor(Color.white);
            }
        }


  • #2
    Hello Clearpicks,

    Without setComputeOnClose(), only bar -1 will be colored. With setComputeOnClose() colors are carried forward to bar 0 by default.

    I would recommend using getBarState() and checking for NEWBAR rather than using setComputeOnClose() for controlling code execution.
    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