Announcement

Collapse
No announcement yet.

something wrong with my codes?

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

  • something wrong with my codes?

    I try to write some codes as follows:

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("LL");
    setCursorLabelName("LL");
    setDefaultBarFgColor(Color.blue);
    setPlotType(PLOTTYPE_LINE);

    }

    var LL = 0;


    function main(){

    LL = (volume() + volume(-1)) / ((hhv(2,high()) - llv(2, low())) * 100);

    }
    return getSeries(LL);
    }


    However, when I add this on my chart, from cursor window, it shows "LL <none>".

    Any suggestion is appreciated.

    Thx in advance

  • #2
    Re: something wrong with my codes?

    proptrader
    LL is not a series but a value so you cannot call it using the getSeries() function. Replace your current return statement ie
    return getSeries(LL);
    with
    return (LL);
    and it should work.
    If for whatever reason you instead need to create a series of that equation then you need to calculate it in a separate function or efs and then call that function or efs from your main function using either the efsInternal() or efsExternal() functions. For the description, syntax and examples of the use of these functions see the links to the corresponding articles in the EFS KnowledgeBase. You can also find more examples on the use of the efsInternal() and efsExternal() function in this thread. If you search the forums you will also find many more examples.
    Alex


    Originally posted by proptrader
    I try to write some codes as follows:

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("LL");
    setCursorLabelName("LL");
    setDefaultBarFgColor(Color.blue);
    setPlotType(PLOTTYPE_LINE);

    }

    var LL = 0;


    function main(){

    LL = (volume() + volume(-1)) / ((hhv(2,high()) - llv(2, low())) * 100);

    }
    return getSeries(LL);
    }


    However, when I add this on my chart, from cursor window, it shows "LL <none>".

    Any suggestion is appreciated.

    Thx in advance

    Comment


    • #3
      It works, thx

      Thx, it works, and that efsinternal() function is really handy.

      Comment


      • #4
        Re: It works, thx

        proptrader
        You are most welcome
        Alex


        Originally posted by proptrader
        Thx, it works, and that efsinternal() function is really handy.

        Comment

        Working...
        X