Announcement

Collapse
No announcement yet.

Bond price conversion

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

  • Bond price conversion

    For US Bond futures price, how can I change the price into fraction of 32 ticks. For example, the price from the chart is 11421, how do I change it to 114 21/32 or 114.656 in order to use it in the EFS study.

  • #2
    markcchn
    getValue("Close",0,-1); should return the value in decimals.
    See the enclosed script as an example
    Alex

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("decimal");
        
    setShowCursorLabel(false);

    }
    function 
    main() {

    var 
    vValue getValue("Close",0,-1);

    drawTextRelative(5,close(),vValue,Color.white,Color.blue,Text.VCENTER|Text.BOLD,"Arial",11,"Rate");

    return ;

    Comment


    • #3
      Thank you for your help. Instead of having just one price at the end, can I do it on each bar for the O/H/L/C prices ?

      Comment


      • #4
        markcchn
        Not sure I understand the question.
        If you want to see the values in decimals in the Cursor Window then here is a way to do it.
        Alex

        PHP Code:
        function preMain() {
            
        setPriceStudy(true);
            
        setStudyTitle("decimal");
            
        setCursorLabelName("Open",0);
            
        setCursorLabelName("High",1);
            
        setCursorLabelName("Low",2);
            
        setCursorLabelName("Close",3);

        }
        function 
        main(Rate) {

        var 
        Op open();
        var 
        Hi high();
        var 
        Lo low();
        var 
        Cl close();

        return new Array(
        Op+"",Hi+"",Lo+"",Cl+"")

        Comment


        • #5
          This is exactly what I want. Thank you for your help.

          Comment


          • #6
            Hi Alex,

            How do you convert the bond price back into fraction of 32 ticks for displaying after performing some efs calculation? Thanks.

            Comment


            • #7
              Hi Alex
              Thanks ... I found your old post and the solution is:
              sDisplayPrice = formatPriceNumber( close() );

              Original link: http://forum.esignal.com/showthread....highlight=bond

              Comment

              Working...
              X