Announcement

Collapse
No announcement yet.

Last bar closing price and color

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

  • Last bar closing price and color

    HI,
    I am interested in have the last bar closing price printed on my chart, is therr an EFS that does that?

    Another thing I am interested in is as long as the last bar is closing lower than previous bar I want it printed in red, once it closes higher that previous bar close I like to see it in green. and Vice versa. Is this possible ???
    pls advise
    Regards
    Guss

  • #2
    Hello Guss,

    There is a formula example that does something similar that was discussed recently in this thread.

    As for creating conditional statements, yes, this is possible. You use the close() series to reference the closing values of the bars. To color the price bars you use the setColorPriceBars() preMain() function in conjunction with setPriceBarColor() within your conditional block inside main(). Here's the basic code example.

    PHP Code:
    function preMain() {
        
    setStudyTitle("test");
        
    setPriceStudy(true);
        
    setShowCursorLabel(false);
        
        
    setColorPriceBars(true);
        
    setDefaultPriceBarColor(Color.grey);
    }



    function_main()_{
        var 
    nClose_0 close(0);
        var 
    nClose_1 close(-1);
        
        if (
    nClose_0 nClose_1) {
            
    setPriceBarColor(Color.red);
        } else {
            
    setPriceBarColor(Color.green);
        }
        
        return;

    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