Announcement

Collapse
No announcement yet.

sma - no properties

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

  • sma - no properties

    Hi

    I have written this very simple efs but get the error myStudy1 has no properies!

    I want to plot the 55 sma and the 55 sma + 0.0055

    HELP!

    Much appreciated

    Paul

    ===================

    var bInit = false;
    var myStudy1 = null;
    var myStudy2 = null;


    function preMain() {

    setPriceStudy(true);

    }

    function main () {

    var myVar1;
    var myVar2;

    if (bInit == false) {
    myStudy1 = sma(55,(high+low)/2);
    myStudy2 = sma(55,(high+low)/2+0.0055);
    bInit = true;
    }
    myVar1 = myStudy1.getValue(0);
    myVar2 = myStudy2.getValue(0);

    return new Array(myVar1,myVar2);

    }

  • #2
    Paul
    (high()+Low())/2 and (high+low)/2+0.0055 are not series but single values and cannot therefore be used as a source for the built-in studies.
    With regards to (high+low)/2 you can replace that with hl2() which returns a series and can be used as a source. As far as (high+low)/2+0.0055 is concerned you will need to calculate that equation in a separate function which you then call into main using efsInternal(). This will in turn create the series that you can then use as a source to the built-in sma() function.
    You can find several examples on how to use efsInternal() and efsExternal() in this thread
    Alex

    Comment


    • #3
      Alex

      Thanks again for your help all looks a bit confusing at first but i'll print it all out and read it

      ))

      Comment

      Working...
      X