Announcement

Collapse
No announcement yet.

Alex, Help with Range.efs

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Alex, Help with Range.efs

    Alex could you or someone change your "Range.efs" so that it will ony color the bar/candle if it is greater than X points? Leaving the other bar/candles their respective up/down colors.

    Thanks in advance.



    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Range");
    setShowCursorLabel(false);
    setColorPriceBars(true);

    var fp1 = new FunctionParameter("Change", FunctionParameter.STRING);
    fp1.setName("Change");
    fp1.addOption("Points");
    fp1.addOption("Percent");
    fp1.setDefault("Points");

    var fp2 = new FunctionParameter("Value", FunctionParameter.NUMBER);
    fp2.setLowerLimit(0);
    fp2.setDefault(10);

    }

    function main(Change,Value) {

    var vPoint = high()-low();
    var vMidPoint = (high()+low())/2;


    if (Change == "Points") {
    if (vPoint < Value){
    setPriceBarColor(Color.yellow);
    }
    else if (1==1){
    setPriceBarColor(Color.white);
    }
    }

    if (Change == "Percent") {
    if(high()<vMidPoint*(1+Value/100)&&low()>vMidPoint*(1-Value/100)){
    setPriceBarColor(Color.red);
    }
    else if (1==1){
    setPriceBarColor(Color.black);
    }
    }

    return ;
    }

  • #2
    Himalaya
    Just reverse the < and > signs in the conditions.
    For example
    if (vPoint < Value){
    becomes
    if (vPoint > Value){
    Alex

    Comment


    • #3
      Alex, Range.efs

      Alex,

      I must be doing something wrong.

      When I reversed the < > signs, it simply makes all of the bars white instead of yellow.

      I want to see up bars as lime and down bars as red and ONLY have the bars above X points be colored yellow or white.

      Comment


      • #4
        Himalaya
        Sorry, my misunderstanding also due to the fact that the original efs does not paint up or down bars but only if greater or lesser than a preset Point or Percent value.
        Anyhow add the following section

        else if (close()>close(-1)){
        setPriceBarColor(Color.lime);
        }
        else if(close()<close(-1)){
        setPriceBarColor(Color.red);
        }

        in between
        setPriceBarColor(Color.yellow);
        }
        and
        else if (1==1){
        setPriceBarColor(Color.white);

        Repeat the same for the Percent section where you will need to change the <> and the color for when the bar is greater than a Percent amount.
        Alex

        Comment


        • #5
          Alex - Range.efs

          Alex,

          Would you mind posting a link to the Range.efs

          I messed the syntax up so much trying to have the colors simply stay their normal colors for bars under X points I threw the study out and now I can't find the link to the original.

          :-(

          Comment


          • #6
            Himalaya
            Copy the formula you posted below and make the changes I suggested. It will work fine.
            As to Range.efs I don't have the link readily available. Do a Search on the Bulletin Board; type Alexis and select Match partial name in the User Name box and Range in the keyword box. Check to Show results as posts
            Alex
            Last edited by ACM; 10-07-2003, 06:56 PM.

            Comment

            Working...
            X