Announcement

Collapse
No announcement yet.

Math.round Question

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

  • Math.round Question

    I am trying to return a .25 increment (to the nearest .25 tick price) on a Math.round function of another study. I know that the standard function rounds only to a .50 increment, as follows:

    nShort = Math.round(nClose - nStudy);

    I've tried to set the .25 throughout the formula to no avail.

    Can anyone help with a seemingly simple fix?

    Thanks much,
    Jody

  • #2
    Re: Math.round Question

    Jody
    See the rounding function Steve Hare provided in this post
    Alex


    Originally posted by turbotrade
    I am trying to return a .25 increment (to the nearest .25 tick price) on a Math.round function of another study. I know that the standard function rounds only to a .50 increment, as follows:

    nShort = Math.round(nClose - nStudy);

    I've tried to set the .25 throughout the formula to no avail.

    Can anyone help with a seemingly simple fix?

    Thanks much,
    Jody

    Comment


    • #3
      Alex,

      Thanks so much to both you and Steve. That was easy...I made the following change after adding the Rnd function at the bottom of my efs from Steve's sample code :

      nShort = Rnd.NT(nClose - nStudy,4);

      BTW, can you tell me what tmp1, div1 means? Is this older efs code?

      Jody

      Comment


      • #4
        Jody
        Those are just user defined names for the parameters being passed to that function ie the number to round and the fractional value used for the rounding
        Alex


        Originally posted by turbotrade
        Alex,

        Thanks so much to both you and Steve. That was easy...I made the following change after adding the Rnd function at the bottom of my efs from Steve's sample code :

        nShort = Rnd.NT(nClose - nStudy,4);

        BTW, can you tell me what tmp1, div1 means? Is this older efs code?

        Jody

        Comment


        • #5
          Ok, yes, I see now.

          Thanks again.

          Comment

          Working...
          X