Announcement

Collapse
No announcement yet.

How many decimal places in a futures symbol?

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

  • How many decimal places in a futures symbol?

    Hi All,

    I am sure there is an easy way to tell the number of decimal places that a symbol's price returns. (ie Russel is 1, ES is 2, 6E is 4), but I cant seem to find a simple solution.

    Thanks for any help you can give.

    Jerry
    "Make it a great day"
    [email protected]

  • #2
    Hi Jerry,

    Thanks for the post. I'm a little unsure of what you are searching for. Are you looking for an EFS that will return the amount of decimals based on the instrument or some documentation that outlines the minimum tick increment for various contracts? Please let me know.

    Comment


    • #3
      Hi,

      I need and efs to tell how many decimal places the current symbol is traded in.

      But now that you mention it tell the tick increment for a symbol could be very helpful.

      Jerry
      "Make it a great day"
      [email protected]

      Comment


      • #4
        I found a way to do it by putting closing price for each bar in a string, then parsing and evaluating the string, but is there a better way to tell than having to evaluated each time a bar forms?

        Jerry
        "Make it a great day"
        [email protected]

        Comment


        • #5
          Problem Solved

          The following function called at the begining of the main solves the problem.

          var Decimals = 2;

          function main();

          if (nBarState == BARSTATE_ALLBARS){ // call this to set the Decimal value prior to setting the treshold Value
          Decimals = decimals()+1;
          }

          function decimals (){
          var Cls2Str = null;
          var i=0;
          var len = 0;
          for (i=0; i < 4; i++) {
          Cls2Str = (close(i)*1).toString()
          decArray = (Cls2Str).split(".");
          if (decArray[1] != null){
          if(decArray[1].length>len && decArray[1].length<5) len=decArray[1].length;
          }
          }
          if (len>4) len=4;

          return len;
          }


          So far I have not found a Future, equity or currency that trades in more than 4 decimal places, but esignal will return as many as 18 places, therefor I truncate to 4 .

          Hope this helps. I has solve my problem of switching symbols in all three types.

          Jerry
          "Make it a great day"
          [email protected]

          Comment

          Working...
          X