Announcement

Collapse
No announcement yet.

This code does seam to update on every bar.

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

  • This code does seam to update on every bar.

    Place it on the $VOLD symbol...

    Why does this not update on every bar...
    #######################

    function preMain() {
    setPriceStudy(true);
    setShowTitleParameters( false );
    setShowCursorLabel(false);
    setStudyTitle("VoldCode");
    }

    function main() {
    if(getCurrentBarIndex() != 0) {
    drawLineRelative(30 * -1,0, 2, 0, PS_SOLID,1, Color.black, "Zero");
    }

    if((getHour()*100)+getMinute() >= 930 && (getHour()*100)+getMinute() < 935) onAction1()

    return null;
    }

    function postMain() {
    }
    function onAction1() {
    setBarBgColor(Color.RGB(255,255,183));
    }

  • #2
    what does not update??

    I have commented your code below. I believe you are talking about the "line drawing" not working. But it makes sense if you look at the code.. You are telling it to draw only for bars != 0. 0 is always the most current bar - so this is probably your problem.

    B

    function preMain() {
    setPriceStudy(true);
    setShowTitleParameters( false );
    setShowCursorLabel(false);
    setStudyTitle("VoldCode");
    }

    function main() {

    // This code is placed within a condition - getCurrentBarIndex() != 0. This mean it will run on every bar BUT the most current bar. The most current bar is the bar that is currently forming in real-time.
    if(getCurrentBarIndex() != 0) {
    drawLineRelative(30 * -1,0, 2, 0, PS_SOLID,1, Color.black, "Zero");
    }

    // this code should work from 930 to 935
    if((getHour()*100)+getMinute() >= 930 && (getHour()*100)+getMinute() < 935) onAction1()

    return null;
    }

    function postMain() {
    }
    function onAction1() {
    setBarBgColor(Color.RGB(255,255,183));
    }
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment

    Working...
    X