Announcement

Collapse
No announcement yet.

How do you calculate the Coppock Curve in Esignal ?

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

  • How do you calculate the Coppock Curve in Esignal ?





    Code in metastock pro software

    /* CCT Coppock Curve
    **
    ** Originally developed by Steve Karnish
    ** http://www.cedarcreektrading.com
    **
    ** AFL translation by Peter Gialames
    **
    ** Set scaling: Automatic
    ** Grid: Middle, Level 0
    */

    graph0=(ROC(CLOSE,14 )*10 + ROC(CLOSE,11)*10 +
    ROC(Ref(CLOSE,-1),14)*9 + ROC(Ref(CLOSE,-1),11)*9 +
    ROC(Ref(CLOSE,-2),14)*8 + ROC(Ref(CLOSE,-2),11)*8 +
    ROC(Ref(CLOSE,-3),14)*7 + ROC(Ref(CLOSE,-3),11)*7 +
    ROC(Ref(CLOSE,-4),14)*6 + ROC(Ref(CLOSE,-4),11)*6 +
    ROC(Ref(CLOSE,-5),14)*5 + ROC(Ref(CLOSE,-5),11)*5 +
    ROC(Ref(CLOSE,-6),14)*4 + ROC(Ref(CLOSE,-6),11)*4 +
    ROC(Ref(CLOSE,-7),14)*3 + ROC(Ref(CLOSE,-7),11)*3 +
    ROC(Ref(CLOSE,-8),14)*2 + ROC(Ref(CLOSE,-8),11)*2 +
    ROC(Ref(CLOSE,-9),14) + ROC(Ref(CLOSE,-9),11))/2;
    Last edited by Digs; 12-11-2005, 01:02 AM.

  • #2
    By modifing Alex' code from MAofROC located



    /************************************************** *******
    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 vROC = null;
    var vMAofROC = null;

    function preMain() {
    setStudyTitle("MAofROC");
    setCursorLabelName("ROC", 0);
    setDefaultBarFgColor(Color.blue, 0);
    setCursorLabelName("MAofROC", 1);
    setDefaultBarFgColor(Color.red, 1);
    checkVersion(2,"http://share.esignal.com/ContentRoot/ACM%20Test/Formulas/MAofROC.efs"); //Comment this line out if modifying the code

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

    var fp2 = new FunctionParameter("ROCSource", FunctionParameter.STRING);
    fp2.setName("ROCSource");
    fp2.addOption("Close");
    fp2.addOption("High");
    fp2.addOption("Low");
    fp2.addOption("Open");
    fp2.addOption("HL/2");
    fp2.addOption("HLC/3");
    fp2.addOption("OHLC/4");
    fp2.setDefault("Close"); //Edit this value to set a new default

    var fp3 = new FunctionParameter("MALength", FunctionParameter.NUMBER);
    fp3.setLowerLimit(1);
    fp3.setDefault(5); //Edit this value to set a new default

    var fp4 = new FunctionParameter("MAType", FunctionParameter.STRING);
    fp4.setName("MAType");
    fp4.addOption("MAStudy.SIMPLE");
    fp4.addOption("MAStudy.EXPONENTIAL");
    fp4.addOption("MAStudy.WEIGHTED");
    fp4.addOption("MAStudy.VOLUMEWEIGHTED");
    fp4.setDefault("MAStudy.SIMPLE"); //Edit this value to set a new default
    }

    function main(){//ROCLength, ROCSource, MALength, MAType) { dont use the fps

    if (vROC11 == null) vROC11 = new ROCStudy(11, close() );//set to 11
    if (vROC14 == null) vROC14 = new ROCStudy(14, close() );//set to 14
    if (vMAofROC11 == null) vMAofROC11 = new MAStudy(10, 0, vROC11, MAStudy.MA, MAStudy.SIMPLE);//ma of roc11
    if (vMAofROC14 == null) vMAofROC14 = new MAStudy(10, 0, vROC14, MAStudy.MA, MAStudy.SIMPLE);//ma of roc14
    avg = (vMAofROC14 + vMAofROC11) / 2;//avg the two

    /******************************************
    Insert your code following this text block
    Use vROC.getValue(ROCStudy.ROC) and
    vMAofROC.getValue(MAStudy.MA) for your code
    *******************************************/



    return (avg);//plot them
    }

    Comment

    Working...
    X