Announcement

Collapse
No announcement yet.

Quoting a Spread on Bid/Offer

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quoting a Spread on Bid/Offer

    Hi,
    I know that you can find the spread of two quotes based on the last price, but is it possible to do that on a bid/ask of the instrument?

    Example: I want the following quote of the following equation:
    (This is on a E-Mini S&P option)

    ES DEC 1360 Call's ASK - ES OCT 1355 Call's BID?

    So if the DEC 1360Cs Ask was 11.50, and OCT 1355 Call's BID is, 3.50, the equation would be, 11.50-3.50 and I would get the quote of 8.00 under the last column.

    Is this possible?

    Hope this made sense, if not please let me know and I can clarify.

    Thanks in advance for your help.

  • #2
    kanirajan
    To my knowledge it is not possible to do that in a Quote Window.
    However you can do that through an efs. Enclosed below is a basic example of a script that will calculate the same spread you indicated. Also enclosed is a chart showing the value returned by the script.
    For information on charting options in eSignal you may want to review this article in the eSignal KnowledgeBase
    Alex

    PHP Code:
    var xAsk null;
    var 
    xBid null;
     
    function 
    main(){
     
        if(
    xAsk==nullxAsk efsInternal("calcAsk",sym("es z6c1360"));
        if(
    xBid==nullxBid efsInternal("calcBid",sym("es v6c1355"));
        
        if(
    xAsk.getValue(0)==null||xBid.getValue(0)==null) return;
        
        var 
    vDiff xAsk.getValue(0)-xBid.getValue(0);
        
        return 
    vDiff;
    }
     
    function 
    calcAsk(_sym){
        return 
    getMostRecentAsk();
    }
     
    function 
    calcBid(_sym){
        return 
    getMostRecentBid();


    Comment


    • #3
      You do it again!!

      One more thing though.

      Is it possible to have an option where I could just change the symbols when "Edit the Study", instead of having to modify the coding everytime??


      Thanks.

      Comment


      • #4
        kanirajan
        Yes it is possible and enclosed is the simple version on how to do it. Comments on the changes made are included in the script.
        The other way (albeit unnecessary in this case) would be to use the FunctionParameter Object
        Alex

        PHP Code:
        var xAsk null;
        var 
        xBid null;

        function 
        main(Symbol1Symbol2){//parameters added to main definition

            
        if(Symbol1==nullSymbol1 "es z6c1360";//if no parameter is input use the default
            
        else Symbol1 Symbol1+"";//else use the input parameter 
            
        if(Symbol2==nullSymbol2 "es v6c1355";
            else 
        Symbol2 Symbol2+"";

            if(
        xAsk==nullxAsk efsInternal("calcAsk",sym(Symbol1));//removed symbol and added parameter
            
        if(xBid==nullxBid efsInternal("calcBid",sym(Symbol2));
            
            if(
        xAsk.getValue(0)==null||xBid.getValue(0)==null) return;
            
            var 
        vDiff xAsk.getValue(0)-xBid.getValue(0);
            
            return 
        vDiff;
        }

        function 
        calcAsk(_sym){
            return 
        getMostRecentAsk();
        }

        function 
        calcBid(_sym){
            return 
        getMostRecentBid();

        Comment


        • #5
          error on line 21. Could you
          attach compile EFS file???

          Originally posted by Alexis C. Montenegro
          kanirajan
          Yes it is possible and enclosed is the simple version on how to do it. Comments on the changes made are included in the script.
          The other way (albeit unnecessary in this case) would be to use the FunctionParameter Object
          Alex

          PHP Code:
          var xAsk null;
          var 
          xBid null;

          function 
          main(Symbol1Symbol2){//parameters added to main definition

              
          if(Symbol1==nullSymbol1 "es z6c1360";//if no parameter is input use the default
              
          else Symbol1 Symbol1+"";//else use the input parameter 
              
          if(Symbol2==nullSymbol2 "es v6c1355";
              else 
          Symbol2 Symbol2+"";

              if(
          xAsk==nullxAsk efsInternal("calcAsk",sym(Symbol1));//removed symbol and added parameter
              
          if(xBid==nullxBid efsInternal("calcBid",sym(Symbol2));
              
              if(
          xAsk.getValue(0)==null||xBid.getValue(0)==null) return;
              
              var 
          vDiff xAsk.getValue(0)-xBid.getValue(0);
              
              return 
          vDiff;
          }

          function 
          calcAsk(_sym){
              return 
          getMostRecentAsk();
          }

          function 
          calcBid(_sym){
              return 
          getMostRecentBid();

          Comment


          • #6
            sutener74
            As far as I can see the formula does not have any errors .
            To create the efs just copy the code lines that are inside the PHP box and paste them in a new EFS Editor window then save the script with a name of your choice
            Alex


            Originally posted by sutener74
            error on line 21. Could you
            attach compile EFS file???

            Comment


            • #7
              Ok this formula not have any errors. I need history bid/ask spread chart?
              but it only shows the current value

              Originally posted by Alexis C. Montenegro
              sutener74
              As far as I can see the formula does not have any errors .
              To create the efs just copy the code lines that are inside the PHP box and paste them in a new EFS Editor window then save the script with a name of your choice
              Alex
              Attached Files

              Comment


              • #8
                sutener74
                Historical bid/ask data is not available in efs
                Alex


                Originally posted by sutener74
                Ok this formula not have any errors. I need history bid/ask spread chart?
                but it only shows the current value

                Comment

                Working...
                X