Announcement

Collapse
No announcement yet.

Transparent Line

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

  • Transparent Line

    Hi all,

    Could you tell me how to make the line transparent ?

    I just want to hide RSI line and show only background color when the line turns.

    If possible, I like the code to turn On/Off easily when it is loaded.

    Best regards,

    D4217

  • #2
    you could add an option to the INPUTS that controls what item is returned and depending on TRUE/FALSE, return the value or a text item.

    if (displayRSIVAL) {
    return vRSI.getValue(RSIStudy.RSI);
    } else {
    return ""+vRSI.getValue(RSIStudy.RSI);
    }
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thank you for your comment, Doji3333.

      But I still don't understand how to use your code into my script.

      This is a simple MA color change. (Not RSI)

      How can I wipe out MA line ?I need only back ground color.What I am doing is just draw line with back ground color.

      Regards,

      D4217




      var vMA = null;


      function preMain() {
      setPriceStudy(false);
      setStudyTitle("MA_color_change");
      setCursorLabelName("MA", 0);
      //setDefaultBarFgColor(Color.white, 0);
      setDefaultBarThickness(4,0);
      checkVersion(1,"");

      var fp1 = new FunctionParameter("MALength", FunctionParameter.NUMBER);
      fp1.setLowerLimit(1);
      fp1.setDefault(10);

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

      }

      function main(MALength,Offset) {

      if (vMA == null) vMA = new MAStudy(MALength, Offset, "Close", MAStudy.WEIGHTED);

      if (vMA.getValue(MAStudy.MA) > vMA.getValue(MAStudy.MA,-1))
      setBarBgColor(Color.green);
      if (vMA.getValue(MAStudy.MA) < vMA.getValue(MAStudy.MA,-1))
      setBarBgColor(Color.red);


      return vMA.getValue(MAStudy.MA);
      }

      Comment


      • #4
        In the script, the easiest is to comment out (//) the line:
        return vMA.getValue(MAStudy.MA);
        i.e.,
        //return vMA.getValue(MAStudy.MA);

        The "return" statement is what plots the series on the chart.

        Comment


        • #5
          Hi,

          I have moving average script. To keep my chart clutter free, I don't want to see the MA plot on the chart. I do want to see the MA value in the cursor window box.

          Is this possible?

          A Color.transparent function would be real helpful.

          Thanks for your help.

          Andy

          Comment


          • #6
            Use one of the following return statements to just output to the "Cursor Window". You can search the Forum and the "Core JavaScript 1.5" in the KnowledgeBase for more on what each does.

            PHP Code:
            var nMAVal vMA.getValue(MAStudy.MA);

            return 
            nMAVal.toFixed(2);//the 2 is the # of decimals you want 
            or
            PHP Code:
            var nMAVal vMA.getValue(MAStudy.MA);

            return 
            nMAVal+"" ;//converts nMAVal to a string 
            Wayne
            Last edited by waynecd; 01-26-2011, 11:22 AM.

            Comment

            Working...
            X