Announcement

Collapse
No announcement yet.

Error when referencing past data

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

  • Error when referencing past data

    From the formula below, I keep getting an error message when I try to refer to past data. Under Function diff, I am trying to subtract todays stoch from yesterdays. Can someone please let me know what I am doing wrong.

    Thanks, Steven




    function preMain() {
    setStudyTitle("Stoch MACD");
    setCursorLabelName("Stoch MACD");
    setDefaultBarFgColor(Color.black, 0);

    var fp1 = new FunctionParameter("nEMAlength", FunctionParameter.NUMBER);
    fp1.setName(" EMA Length ");
    fp1.setLowerLimit(2);
    fp1.setDefault(14);

    var fp2 = new FunctionParameter("nEMAsmoothing", FunctionParameter.NUMBER);
    fp2.setName(" EMA Smoothing ");
    fp2.setLowerLimit(1);
    fp2.setDefault(7);
    }


    function main(nEMAlength, nEMAsmoothing) {
    var dADA = ema(nEMAsmoothing,ema(nEMAlength,efsInternal("diff ")));

    return dADA;
    }

    function diff() {
    return stochK(17, 3, 1) - getValue( stochK(17, 3, 1), -1 );

    }

  • #2
    Steven:

    Try:

    PHP Code:
    function diff() {

         return 
    stochK(1731) - stochK(1731, -1);


    Chris

    Comment


    • #3
      Thanks Chris, it worked!

      Steven

      Comment

      Working...
      X