Announcement

Collapse
No announcement yet.

ADX >30 coloured in Yellow, ADX(30)< 30 red

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

  • ADX >30 coloured in Yellow, ADX(30)< 30 red

    Hi, what`s wrong in the formular? I want to display the ADX as a Histogram in a second chart under the price chart. No, it displays it red/yellow in the price bars.
    Thanks

    //{{EFSWizard_Description
    //
    // This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description


    //{{EFSWizard_Declarations
    var vADXDM = new ADXDMStudy(14);
    var vLastAlert = -1;
    //}}EFSWizard_Declarations


    function preMain() {
    //{{EFSWizard_Code_PreMain_setPriceBarColor
    setColorPriceBars(true);
    //}}EFSWizard_Code_PreMain_setPriceBarColor
    /**
    * This function is called only once, before any of the bars are loaded.
    * Place any study or EFS configuration commands here.
    */
    //{{EFSWizard_PreMain
    setPriceStudy(false);
    setStudyTitle("ADXrot/gelb");
    setCursorLabelName("ADX", 0);
    setCursorLabelName("vADXDM", 1);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarFgColor(Color.red, 0);
    setDefaultBarFgColor(Color.cyan, 1);
    setDefaultBarThickness(4, 0);
    setDefaultBarThickness(4, 1);
    setPlotType(PLOTTYPE_HISTOGRAM, 0);
    setPlotType(PLOTTYPE_HISTOGRAM, 1);
    //}}EFSWizard_PreMain

    }

    function main() {
    /**
    * The main() function is called once per bar on all previous bars, once per
    * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
    * in your preMain(), it is also called on every tick.
    */

    //{{EFSWizard_Expressions
    //{{EFSWizard_Expression_1
    if (
    vADXDM.getValue(ADXDMStudy.ADX) < 30
    ) onAction1()
    //}}EFSWizard_Expression_1

    //{{EFSWizard_Expression_2
    else if (
    vADXDM.getValue(ADXDMStudy.PDI) >= 30
    ) onAction2();
    //}}EFSWizard_Expression_2

    //}}EFSWizard_Expressions


    //{{EFSWizard_Return
    return new Array(
    null,
    vADXDM.getValue(ADXDMStudy.ADX)
    );
    //}}EFSWizard_Return

    }

    function postMain() {
    /**
    * The postMain() function is called only once, when the EFS is no longer used for
    * the current symbol (ie, symbol change, chart closing, or application shutdown).
    */
    }

    //{{EFSWizard_Actions
    //{{EFSWizard_Action_1
    function onAction1() {
    setPriceBarColor(Color.RGB(255,0,0));
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //{{EFSWizard_Action_2
    function onAction2() {
    setPriceBarColor(Color.RGB(255,255,0));
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2

    //}}EFSWizard_Actions

  • #2
    Bugeleisen
    That is because you have selected to paint the price bars ie. setPriceBarColor onstead of the plot ie setBarFgColor
    Alex

    Comment

    Working...
    X