Announcement

Collapse
No announcement yet.

Lowest Low Value

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

  • Lowest Low Value

    For some reason I get a null for lowestlow value. Can you please tell what I am doing wrong? It was working before! Also is there any thing different between "lowest" and "llv"? I read the documentations however I did not find any difference between the two.




    function preMain()
    {
    setPriceStudy(true);

    }


    function main()
    {


    var blnNewBarTrigger = getBarState();
    var i=getOldestBarIndex();
    i=-i;
    var vLowestLow

    if ((blnNewBarTrigger == BARSTATE_NEWBAR))
    {


    debugPrintln("Oldest Bar Index = " + i);


    vLowestLow = llv(i, low());


    debugPrintln("vLowestLow = " + llv(i, low()));

    }


    }
    Tony Gof

  • #2
    Re: Lowest Low Value

    Tony
    As far as I know in order to return a value the lowest() and llv() functions (which are the same btw) require at least a number of bars that is twice that of the length parameter
    This is also true of the Donchian Study ie upperDonchian() and lowerDonchian() which are the same as highest(), hhv(), lowest() or llv() but provide some additional features. To verify this load the Donchian Study in Basic Studies and you will see that it will not plot unless the length is half or less than the total number of bars loaded in the chart.
    Alex


    Originally posted by Behzadgof
    For some reason I get a null for lowestlow value. Can you please tell what I am doing wrong? It was working before! Also is there any thing different between "lowest" and "llv"? I read the documentations however I did not find any difference between the two.




    function preMain()
    {
    setPriceStudy(true);

    }


    function main()
    {


    var blnNewBarTrigger = getBarState();
    var i=getOldestBarIndex();
    i=-i;
    var vLowestLow

    if ((blnNewBarTrigger == BARSTATE_NEWBAR))
    {


    debugPrintln("Oldest Bar Index = " + i);


    vLowestLow = llv(i, low());


    debugPrintln("vLowestLow = " + llv(i, low()));

    }


    }

    Comment


    • #3
      LowestLow

      that is true, by reducing the number it will work. But why is that? Is that an esignal limitations? I have been going crazy over this on why my code does not work. If so then I have to write my own function to do that I guess.


      Thanks
      Tony Gof

      Comment


      • #4
        Re: LowestLow

        Tony
        That is more than likely due to some internal error checking that makes sure that there are enough bars to prime the study and that is simply set to twice the length. I often do the same thing with some of the functions in my libraries.
        Anyhow it is very easy to write a function to do what you are trying to accomplish
        Alex


        Originally posted by Behzadgof
        that is true, by reducing the number it will work. But why is that? Is that an esignal limitations? I have been going crazy over this on why my code does not work. If so then I have to write my own function to do that I guess.


        Thanks

        Comment


        • #5
          Lowest low

          Thanks; I modified it a little so it is working fine now.
          Is there an easy way to find the index of the lowest low?


          function preMain()
          {
          setPriceStudy(true);

          }

          var blnNewBarTrigger;

          var vOldestBarIndex=0;



          function main()
          {
          blnNewBarTrigger = getBarState();

          if ((blnNewBarTrigger == BARSTATE_NEWBAR))
          {
          var vLowestLow=0;

          vOldestBarIndex=-getOldestBarIndex();
          vOldestBarIndex =vOldestBarIndex/2;

          vOldestBarIndex= RoundNumbers(vOldestBarIndex,1);

          debugPrintln("Oldest Bar Index = " + vOldestBarIndex);

          vLowestLow = llv(vOldestBarIndex, low());

          debugPrintln("*************vLowestLow = " + vLowestLow );

          }

          }

          function RoundNumbers(vNum,Percision)
          {

          var vNumber = vNum;
          var vPercision = Percision;
          vNumber=Math.round(vNumber*vPercision) /vPercision;
          return vNumber;
          }
          Tony Gof

          Comment


          • #6
            Tony
            See this post for an example of how you can retrieve the bar index
            Alex


            Originally posted by Behzadgof
            Thanks; I modified it a little so it is working fine now.
            Is there an easy way to find the index of the lowest low?


            function preMain()
            {
            setPriceStudy(true);

            }

            var blnNewBarTrigger;

            var vOldestBarIndex=0;



            function main()
            {
            blnNewBarTrigger = getBarState();

            if ((blnNewBarTrigger == BARSTATE_NEWBAR))
            {
            var vLowestLow=0;

            vOldestBarIndex=-getOldestBarIndex();
            vOldestBarIndex =vOldestBarIndex/2;

            vOldestBarIndex= RoundNumbers(vOldestBarIndex,1);

            debugPrintln("Oldest Bar Index = " + vOldestBarIndex);

            vLowestLow = llv(vOldestBarIndex, low());

            debugPrintln("*************vLowestLow = " + vLowestLow );

            }

            }

            function RoundNumbers(vNum,Percision)
            {

            var vNumber = vNum;
            var vPercision = Percision;
            vNumber=Math.round(vNumber*vPercision) /vPercision;
            return vNumber;
            }

            Comment


            • #7
              INdex of the lowest bar

              I thought there might be a function tht would return the index.


              Thanks for your help
              Tony Gof

              Comment


              • #8
                Tony
                You are most welcome
                Alex


                Originally posted by Behzadgof
                I thought there might be a function tht would return the index.


                Thanks for your help

                Comment

                Working...
                X