Announcement

Collapse
No announcement yet.

Indicator does not Refresh

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

  • Indicator does not Refresh

    I have written an indicator for coloring the price bars. It works fine until I type in a new symbol. When the new symbol's data displays, the indicator is not visible, instead the default red/green bars are shown.

    If I reload the indicator, it does not show. But, I know it is reloading, because I have tried changing the screen name, and the screen name is revised when the indicator reloads, but not the price bar coloring.

    If I go to Edit Studies and click Apply, the indicator shows.

    If the session is active, sometimes the indicator shows after 30 secs.

    How do I get the the indicator to continue to show when I change the symbol?

    I have included the code, below.

    Thanks for any help. Gnossos

    **********************************

    var hL=0;
    var lH=0;
    var upsw=0;
    var SwLine=0;

    function preMain() {
    setStudyTitle("NoiseBar");
    setCursorLabelName("NoiseBar",0);
    setPriceStudy(true);
    }

    function main() {
    if(hL==0) hL=low(); //set initial values for hL and lH
    if(lH==0) lH=high();

    if(upsw==1) {
    if(low()>hL) hL=low();

    if(high()<hL) { //swing turns to down
    upsw=0;
    lH=high();
    }

    }

    if(upsw==0) {
    if(high()<lH) lH=high();

    if(low()>lH) { //swing turns to up
    upsw=1;
    hL=low();
    }

    }

    if(upsw==1) {

    setPriceBarColor(Color.lime);
    if(low()<hL) setPriceBarColor(Color.grey);
    }

    if(upsw==0) {

    setPriceBarColor(Color.red);
    if(high()>lH) setPriceBarColor(Color.grey);
    }
    }

  • #2
    Re: Indicator does not Refresh

    perrydolia
    Whenever you use setPriceBarColor() in a script you also need to use the following statements in preMain()
    setColorPriceBars(true)
    setDefaultPriceBarColor(your_color)

    For more information see this article in the EFS KnowledgeBase
    Alex


    Originally posted by perrydolia
    I have written an indicator for coloring the price bars. It works fine until I type in a new symbol. When the new symbol's data displays, the indicator is not visible, instead the default red/green bars are shown.

    If I reload the indicator, it does not show. But, I know it is reloading, because I have tried changing the screen name, and the screen name is revised when the indicator reloads, but not the price bar coloring.

    If I go to Edit Studies and click Apply, the indicator shows.

    If the session is active, sometimes the indicator shows after 30 secs.

    How do I get the the indicator to continue to show when I change the symbol?

    I have included the code, below.

    Thanks for any help. Gnossos

    **********************************

    var hL=0;
    var lH=0;
    var upsw=0;
    var SwLine=0;

    function preMain() {
    setStudyTitle("NoiseBar");
    setCursorLabelName("NoiseBar",0);
    setPriceStudy(true);
    }

    function main() {
    if(hL==0) hL=low(); //set initial values for hL and lH
    if(lH==0) lH=high();

    if(upsw==1) {
    if(low()>hL) hL=low();

    if(high()<hL) { //swing turns to down
    upsw=0;
    lH=high();
    }

    }

    if(upsw==0) {
    if(high()<lH) lH=high();

    if(low()>lH) { //swing turns to up
    upsw=1;
    hL=low();
    }

    }

    if(upsw==1) {

    setPriceBarColor(Color.lime);
    if(low()<hL) setPriceBarColor(Color.grey);
    }

    if(upsw==0) {

    setPriceBarColor(Color.red);
    if(high()>lH) setPriceBarColor(Color.grey);
    }
    }

    Comment


    • #3
      Thank You

      Alex,

      Thank you. I am sure that will fix the problem.

      I will read the article.

      Thanks for the assistance.

      Gnossos

      Comment


      • #4
        Re: Thank You

        perrydolia
        You are welcome
        Alex


        Originally posted by perrydolia
        Alex,

        Thank you. I am sure that will fix the problem.

        I will read the article.

        Thanks for the assistance.

        Gnossos

        Comment

        Working...
        X