Announcement

Collapse
No announcement yet.

ADX Defining PDI/NDI

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

  • ADX Defining PDI/NDI

    Hi
    I am trying to setup an ADX indicator that changes colors when the NDI/PDI get out of line by more than 10. I am not sure where and how to define the PDI/NDI variables. If someone could take a look and tell me what I am missing that would be great.

    Thanks,
    chris
    Attached Files

  • #2
    chris
    The attached revision will paint the ADX line in green if PDI-NDI >10 and red if PDI-NDI<-10. Compare it to the one you posted to see the differences.
    It is unclear to me if you want to also plot the PDI and NDI. If not then replace the return line with return vADX.getValue(ADXDMStudy.ADX);
    Hope this helps
    Alex

    Attached Files

    Comment


    • #3
      Thats perfect.

      Thank you, Alex.

      chris

      Comment


      • #4
        PDI-NDI

        Alex:

        The script you wrote (pasted below) seems to work well for me, however I have been trying to convert it to a "paintbar" with no success. I have tried by copying and pasting from other "paintbar" formulas burt seem to be missing a key variable. Could you help? Thanks Alex, your work is tremendous!

        /************************************************** *******
        Alexis C. Montenegro © July 2003
        Use and/or modify this code freely. If you redistribute it
        please include this and/or any other comment blocks and a
        description of any changes you make.
        ************************************************** ********/

        var vADX = null

        function preMain() {
        setStudyTitle("PDI-NDI");
        setCursorLabelName("PDI-NDI", 0);
        //setCursorLabelName("+DI", 1);
        //setCursorLabelName("-DI", 2);
        setDefaultBarFgColor(Color.blue, 0); //
        //setDefaultBarFgColor(Color.blue, 1); //+DI color
        //setDefaultBarFgColor(Color.red, 2); //-DI color
        setDefaultBarThickness(2,0); //ADX Line thickness
        //setDefaultBarThickness(1,1); //+DI Line thickness
        //setDefaultBarThickness(1,2); //-DI Line thickness

        var fp1 = new FunctionParameter("DILength", FunctionParameter.NUMBER);
        fp1.setLowerLimit(1);
        fp1.setDefault(8); //Edit this value to set a new default

        var fp2 = new FunctionParameter("ADXLength", FunctionParameter.NUMBER);
        fp2.setLowerLimit(1);
        fp2.setDefault(8); //Edit this value to set a new default

        }

        function main(DILength, ADXLength) {

        if (vADX == null) vADX = new ADXDMStudy(DILength, ADXLength);

        /************************************************** ****************
        Insert your code following this text block
        Use vADX.getValue(ADXDMStudy.ADX) and vADX.getValue(ADXDMStudy.PDI)
        and vADX.getValue(ADXDMStudy.NDI) for your code
        ************************************************** *****************/

        addBand(0,PS_SOLID,2,Color.black,4);



        return vADX.getValue(ADXDMStudy.PDI)-vADX.getValue(ADXDMStudy.NDI);

        }

        Comment


        • #5
          jones24261
          Use as an example the conditions in the efs I attached to a prior post and replace the setBarFgColor() command with setPriceBarColor(). For the syntax required by this command see this article in the EFS KnowledgeBase. Also listed in that same page are two other commands that you will need to add to preMain which are setDefaultPriceBarColor() and setPriceBarColor(). Follow the corresponding links for the required syntax
          Alex

          Comment

          Working...
          X