Announcement

Collapse
No announcement yet.

DDE output of prior bar data

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

  • DDE output of prior bar data

    I have written a very simple EFS to get the value of the CCI indicator, using Alexis' EFS. It works great, but I want to access the CCI values from one and two bars prior. How do I do that?

    Below is my EFS code.

    Thanks for any help.

    John

    /************************************************** *******
    Alexis C. Montenegro © April 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 vCCI = null;
    var dde1 = new DDEOutput("CCIvalue1"); //This is for DDE output to Excel file

    function preMain() {
    setStudyTitle("CCI for DDE"); //Sets the title in the formulas pullout on charts
    setCursorLabelName("CCI for DDE", 0); //Sets name in cursor window
    }

    function main() {

    if (vCCI == null) vCCI = new CCIStudy(14, "HLC/3");


    /********************************************
    Insert your code following this text block
    Use vCCI.getValue(CCIStudy.CCI) for your code
    *********************************************/



    dde1.set(vCCI.getValue(CCIStudy.CCI)); // Assign current CCI value to the DDE
    // HOW DO I GET THE CCI VALUE FROM ONE BAR PRIOR???

    return vCCI.getValue(CCIStudy.CCI);
    }

  • #2
    John
    vCCI.getValue(CCIStudy.CCI,-1) gets you the value of the CCI at the prior bar, vCCI.getValue(CCIStudy.CCI,-2) that of two bars ago, etc
    Alex

    Comment


    • #3
      Ahh... I got it... the "getValue() function allows for a bar index input. So I changed it to:
      getValue(CCIstudy.cci, -1) for the cci value of the prior bar.

      JOHN

      Comment

      Working...
      X