Announcement

Collapse
No announcement yet.

Bar or Histo display?

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

  • Bar or Histo display?

    How do you display a condition, say price above or under an MA or a cross, in the form of a BAR or HISTO?
    Attached Files

  • #2
    Re: Bar or Histo display?

    Angus F
    In the image you posted that band looks like a separate indicator pane in which the formula is only painting the background
    To replicate that effect just set your conditions and paint the background accordingly using setBarBgColor()
    Alex


    Originally posted by Angus F
    How do you display a condition, say price above or under an MA or a cross, in the form of a BAR or HISTO?

    Comment


    • #3
      Re: Re: Bar or Histo display?

      Alexis,

      That was perfect.
      Thank you so much.

      Angus.


      Originally posted by Alexis C. Montenegro
      Angus F
      In the image you posted that band looks like a separate indicator pane in which the formula is only painting the background
      To replicate that effect just set your conditions and paint the background accordingly using setBarBgColor()
      Alex

      Comment


      • #4
        Re: Re: Re: Bar or Histo display?

        Angus
        You are welcome
        Alex


        Originally posted by Angus F
        Alexis,

        That was perfect.
        Thank you so much.

        Angus.

        Comment


        • #5
          Code

          Alexis,

          I actually ended up doing it slightly differently, but thanks again for putting me on the right track.



          PHP Code:
          /**********************************
          EMA Cross diplayed in histo-bar form
          ***********************************/


          function preMain() {
              
          setPriceStudy(false);
              
          setStudyTitle("EMA Cross-Histo");
              
          setCursorLabelName("ema-histo");
              
          setColorPriceBars(false);

              var 
          fp1 = new FunctionParameter("fInputLength"FunctionParameter.NUMBER);
                  
          fp1.setName("Fast-Length");
                  
          fp1.setLowerLimit(1);
                  
          fp1.setDefault(5);
                  
              var 
          fp2 = new FunctionParameter("sInputLength"FunctionParameter.NUMBER);
                  
          fp2.setName("Slow-Length");
                  
          fp2.setLowerLimit(1);
                  
          fp2.setDefault(10);   
          }

          function 
          main(fInputLengthsInputLength) {
              var 
          nMA1 ema(fInputLength0);
              var 
          nMA2 ema(sInputLength0);

              if(
          nMA1 == null || nMA2 == null) return;

              if(
          nMA1 <= nMA2) {
                  
          //setBarFgColor(Color.red);
                  //setBarBgColor(Color.red);
                  
          drawShapeRelative(05Shape.DIAMONDnullColor.redShape.RELATIVETOBOTTOM);
              } else if(
          nMA1 nMA2) {
                  
          //setBarFgColor(Color.lime);
                  //setBarBgColor(Color.lime);
                  
          drawShapeRelative(05Shape.DIAMONDnullColor.limeShape.RELATIVETOBOTTOM);
              }

              return;
          // nMA1; return nMA2;

          Attached Files

          Comment

          Working...
          X