Announcement

Collapse
No announcement yet.

What's wron with my code ?

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

  • What's wron with my code ?

    var bInit = false;
    var xIBS = null;

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("IBS");
    setPlotType(PLOTTYPE_SQUAREWAVE ,0);
    }

    function main( ) {

    if(bInit==false){
    xIBS = (close()-low()) /(high()-low());
    bInit = true;
    }



    return xIBS.getValue(0);
    }

    // Code END

    It Says
    My EFS Studies\IBS.efs, line 32: Failed to call 'xIBS.getValue': function is not defined.
    Last edited by indus383; 04-24-2013, 11:16 PM.

  • #2
    there are guys here who would probably code this more eloquently but this works ...

    var bInit = false;
    var xIBS = null;

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("IBS");
    setPlotType(PLOTTYPE_SQUAREWAVE ,0);
    }

    function main( )
    {

    if ( getBarState() == BARSTATE_ALLBARS )
    {
    bInit = false;
    return null;
    }

    if ( bInit== false )
    {
    xIBS = getSeries(efsInternal("getStudySeries"));
    bInit = true;
    }

    return xIBS.getValue(0);
    }

    function getStudySeries(){
    return (close()-low()) /(high()-low());
    }
    Paul Williams
    Strategy & Applications
    www.futurenets.co.uk

    Comment


    • #3
      Thank you, that solved the issue

      Originally posted by futurenets View Post
      there are guys here who would probably code this more eloquently but this works ...

      var bInit = false;
      var xIBS = null;

      function preMain() {
      setPriceStudy(false);
      setStudyTitle("IBS");
      setPlotType(PLOTTYPE_SQUAREWAVE ,0);
      }

      function main( )
      {

      if ( getBarState() == BARSTATE_ALLBARS )
      {
      bInit = false;
      return null;
      }

      if ( bInit== false )
      {
      xIBS = getSeries(efsInternal("getStudySeries"));
      bInit = true;
      }

      return xIBS.getValue(0);
      }

      function getStudySeries(){
      return (close()-low()) /(high()-low());
      }

      Comment


      • #4
        Lose the series code and return this:

        return (close(0)-low(0)) /(high(0)-low(0));

        Comment

        Working...
        X