Announcement

Collapse
No announcement yet.

How To Color Candles based on Stoch Level

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

  • How To Color Candles based on Stoch Level

    I want to be able to have candles colored based upon Stoch Level. I have found the MAPriceBars Formula that does it based upon MA so I thought it would work to start with that. Here is the code for MAPriceBars.efs, can someone tell me how to change it so that the colors are based upon Stoch Study being above 80 mor below 20. I do not know anything about efs yet other than I can edit it. Thanks in advance for any help.

    /************************************************** **************************************************
    Copyright © eSignal, a division of Interactive Data Corporation. 2006. All rights reserved.
    This sample eSignal Formula Script (EFS) may be modified and saved under a new
    filename; however, eSignal is no longer responsible for the functionality once modified.
    eSignal reserves the right to modify and overwrite this EFS file with each new release.
    ************************************************** ************************************************** */

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Stoch PriceBars");
    setCursorLabelName("sto");
    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.black);

    var fp1 = new FunctionParameter("nInputLength", FunctionParameter.NUMBER);
    fp1.setName("Length");
    fp1.setLowerLimit(1);
    fp1.setDefault(20);
    }

    function main(nInputLength) {
    var nMA = sma(nInputLength, 0);
    var vClose = close(0);

    if(nMA == null || vClose == null) return;

    if(nMA >= vClose) {
    setPriceBarColor(Color.red);
    } else if(nMA < vClose) {
    setPriceBarColor(Color.lime);
    }

    return nMA;
    }

  • #2
    Maybe this might help
    Attached Files

    Comment


    • #3
      Thanks bohmlimo, I have modified your supplied EFS to color the bars as I need. It was very easy.

      Now I one thing left that I would like to do that I need help w ith:

      I have set the EFS so that it colors the bars when Fast Stoch goes above 80 or below 20.

      Now I would like to add a dot above or below the candle on the Close of the first candle only in any series that is above or below. I have attached a sample of what I am trying to get.

      Thanks
      Attached Files

      Comment


      • #4
        Has anyone turned this indicator into a strategy?

        I gave it a shot but doesn't seem to be working, when I get the time I will fix it and post it.
        Attached Files
        Glen Demarco
        [email protected]

        Comment

        Working...
        X