Announcement

Collapse
No announcement yet.

bar color not loading / reloading

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

  • bar color not loading / reloading

    Hi

    when i start esignal this efs does not take effect, nothing happens when i reload it, but if i remove it from a chart and then re-add it it works -

    what do i need to do to make it active when i open esignal?

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Color Bars");


    var fp1 = new FunctionParameter("nFLen", FunctionParameter.NUMBER);
    fp1.setName("FastEMA length");
    fp1.setDefault(20);

    var fp2 = new FunctionParameter("nSLen", FunctionParameter.NUMBER);
    fp2.setName("SlowEMA length");
    fp2.setDefault(200);
    }

    function main(nFLen, nSLen) {
    var xStudyFast = ema(nFLen, ohlc4());
    var xStudySlow = ema(nSLen, ohlc4());

    //Long
    if (close(0) > xStudyFast && xStudyFast < xStudySlow) {
    setPriceBarColor(Color.RGB(163,192,0));

    }
    if (close(0) > xStudySlow && xStudyFast < xStudySlow) {
    setPriceBarColor(Color.RGB(0,192,0));
    }

    if (close(0) > xStudyFast && xStudyFast > xStudySlow) {
    setPriceBarColor(Color.RGB(0,128,0));
    }


    //Short
    if (close(0) < xStudyFast && xStudyFast > xStudySlow) {
    setPriceBarColor(Color.RGB(255,160,255));

    }

    if (close(0) < xStudySlow && xStudyFast > xStudySlow) {
    setPriceBarColor(Color.RGB(255,87,192));
    }

    if (close(0) < xStudyFast && xStudyFast < xStudySlow) {
    setPriceBarColor(Color.red);
    }

    return;
    Last edited by missionyam; 01-08-2009, 06:09 AM.

  • #2
    Re: bar color not loading / reloading

    missionyam
    As is the formula is giving a syntax error which is caused by a missing closing curly bracket } after the return statement
    I suppose that is just a typo since you indicate that the formula is working at your end although - assuming I understood you correctly - it is not coloring the price bars.
    If that is the case then the reason is that in the preMain() function you omitted to add the following statements
    PHP Code:
    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.your_default_color); 
    which are required when using the setPriceBarColor() function (for reference see this article in the EFS KnowledgeBase)
    Alex


    Originally posted by missionyam
    Hi

    when i start esignal this efs does not take effect, nothing happens when i reload it, but if i remove it from a chart and then re-add it it works -

    what do i need to do to make it active when i open esignal?

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Color Bars");


    var fp1 = new FunctionParameter("nFLen", FunctionParameter.NUMBER);
    fp1.setName("FastEMA length");
    fp1.setDefault(20);

    var fp2 = new FunctionParameter("nSLen", FunctionParameter.NUMBER);
    fp2.setName("SlowEMA length");
    fp2.setDefault(200);
    }

    function main(nFLen, nSLen) {
    var xStudyFast = ema(nFLen, ohlc4());
    var xStudySlow = ema(nSLen, ohlc4());

    //Long
    if (close(0) > xStudyFast && xStudyFast < xStudySlow) {
    setPriceBarColor(Color.RGB(163,192,0));

    }
    if (close(0) > xStudySlow && xStudyFast < xStudySlow) {
    setPriceBarColor(Color.RGB(0,192,0));
    }

    if (close(0) > xStudyFast && xStudyFast > xStudySlow) {
    setPriceBarColor(Color.RGB(0,128,0));
    }


    //Short
    if (close(0) < xStudyFast && xStudyFast > xStudySlow) {
    setPriceBarColor(Color.RGB(255,160,255));

    }

    if (close(0) < xStudySlow && xStudyFast > xStudySlow) {
    setPriceBarColor(Color.RGB(255,87,192));
    }

    if (close(0) < xStudyFast && xStudyFast < xStudySlow) {
    setPriceBarColor(Color.red);
    }

    return;

    Comment


    • #3
      perfect, that fixed it, thankyou

      Comment


      • #4
        missionyam
        You are most welcome
        Alex


        Originally posted by missionyam
        perfect, that fixed it, thankyou

        Comment

        Working...
        X