Announcement

Collapse
No announcement yet.

Generic Broker Functions

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

  • Generic Broker Functions

    I'm starting to play with the GBF functions for the supported brokers and for the paper trader account. A recent post on this forum helped me get started with the papertrader account and so far I've got it working (but still testing).

    I need to know if there are specific issues for each unique broker or are the GBF function standardized to the point that a single call/parameter should work for the supported brokers??

    I also need to know if there are any tricks to passing the number of contracts/shares? I noticed in the papertrader code, you have to pass + values to the buyMarket function and - values to the sellMarket function. Is it the same with LIVE BROKERS?

    I've got my code setup for testing with the IB plug-in and would really appreciate some simple guidance as I progress.

    I hope to have it working and tested before the beginning of next week (if possible). That's why I have these questions as I want to integrate support for any working brokers (with EFS order execution support).

    Thank guys.
    Brad Matheny
    eSignal Solution Provider since 2000

  • #2
    Sorry, did I post this in the wrong forum section??

    I have a serious question about the paper trader functions..

    I've setup my code to fire orders into the papertrader and it worked ONCE when I first turned it on. Then I went into the paper trader settings and turned off the confirmations for new orders and efs orders.

    As soon as I did that, no order are being fired into the papertrader account manager. I've just turned the confirmations back on to test my theory, but I've changed nothing in regard to firing the orders..

    Does anyone know if this is a known issue??


    Here is the code I'm using for entering LONG and SHORT...

    if (GBFOption == "GBFPT" ) {
    buyMarket(getSymbol(), vDefEntryContracts, "Account Manager", "473851", SB_DAY);
    vTotalActiveContracts = vDefEntryContracts;
    }


    if (GBFOption == "GBFPT" ) {
    sellMarket(getSymbol(), vDefEntryContracts, "Account Manager", "473851", SB_DAY);
    vTotalActiveContracts = -vDefEntryContracts;
    }

    Here is the code I'm using to exit LONG or SHORT.

    if ((GBFOption == "GBFPT" ) && (vTotalActiveContracts != 0)) {
    sellMarket(getSymbol(), vTotalActiveContracts, "Account Manager", "473851", SB_DAY);
    }
    vTotalActiveContracts = 0;


    if ((GBFOption == "GBFPT" ) && (vTotalActiveContracts != 0)) {
    buyMarket(getSymbol(), Math.abd(vTotalActiveContracts), "Account Manager", "473851", SB_DAY);
    }
    vTotalActiveContracts = 0;
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      -

      Hi Brad,

      Originally posted by Doji3333
      I'm starting to play with the GBF functions for the supported brokers and for the paper trader account. A recent post on this forum helped me get started with the papertrader account and so far I've got it working (but still testing).

      I need to know if there are specific issues for each unique broker or are the GBF function standardized to the point that a single call/parameter should work for the supported brokers??
      First, please be aware of the following post, Generic Broker Update.

      GBF are intended to be standardized.


      I also need to know if there are any tricks to passing the number of contracts/shares? I noticed in the papertrader code, you have to pass + values to the buyMarket function and - values to the sellMarket function. Is it the same with LIVE BROKERS?
      You should only need to pass positive numbers. Please refer to KB examples, Generic Broker Functions.
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        -

        Hi Brad,

        Originally posted by Doji3333
        Sorry, did I post this in the wrong forum section??

        I have a serious question about the paper trader functions..

        I've setup my code to fire orders into the papertrader and it worked ONCE when I first turned it on. Then I went into the paper trader settings and turned off the confirmations for new orders and efs orders.

        As soon as I did that, no order are being fired into the papertrader account manager. I've just turned the confirmations back on to test my theory, but I've changed nothing in regard to firing the orders..

        Does anyone know if this is a known issue??


        Here is the code I'm using for entering LONG and SHORT...

        if (GBFOption == "GBFPT" ) {
        buyMarket(getSymbol(), vDefEntryContracts, "Account Manager", "473851", SB_DAY);
        vTotalActiveContracts = vDefEntryContracts;
        }


        if (GBFOption == "GBFPT" ) {
        sellMarket(getSymbol(), vDefEntryContracts, "Account Manager", "473851", SB_DAY);
        vTotalActiveContracts = -vDefEntryContracts;
        }

        Here is the code I'm using to exit LONG or SHORT.

        if ((GBFOption == "GBFPT" ) && (vTotalActiveContracts != 0)) {
        sellMarket(getSymbol(), vTotalActiveContracts, "Account Manager", "473851", SB_DAY);
        }
        vTotalActiveContracts = 0;


        if ((GBFOption == "GBFPT" ) && (vTotalActiveContracts != 0)) {
        buyMarket(getSymbol(), Math.abd(vTotalActiveContracts), "Account Manager", "473851", SB_DAY);
        }
        vTotalActiveContracts = 0;
        The only code error I see is your Math.abd should be Math.abs.

        Other than that paper trade orders and simulated orders to IB are both working fine on my end.

        Keep in mind that if you need to have eSignal Paper Broker set as your default broker in order for the trades to be sent to the Paper Broker's Account Manager. If you have an Account Manager open for IB you will not see the eSignal Paper Broker trades in that window. Each broker under the Trade menu has its own account manager. Make sure you have the right window open that corresponds to your default broker.
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment


        • #5
          Thanks Jason,

          What about the "Confirmation" options? When I removed "confirmation of EFS and manual orders", as the defaults, it seemed to quit firing orders to the Account Manager?

          Ever heard of this issue?

          I'm going to test tomorrow. I have it setup for esignal's IB and PT broker options and my MTS solution. If it tests out well in the next few days... lookout!!

          After 20+ years of research into trading, I'll be SO HAPPY. Weeeeee.
          Brad Matheny
          eSignal Solution Provider since 2000

          Comment


          • #6
            Also, are you providing any options order support with your broker connections?
            Brad Matheny
            eSignal Solution Provider since 2000

            Comment


            • #7
              Hi Brad,

              They should work with and without confirmations. I tested this with both IB and Paper broker. If you orders are not firing, it may be related to code logic.

              Yes, we should be supporting options as well.
              Jason K.
              Project Manager
              eSignal - an Interactive Data company

              EFS KnowledgeBase
              JavaScript for EFS Video Series
              EFS Beginner Tutorial Series
              EFS Glossary
              Custom EFS Development Policy

              New User Orientation

              Comment


              • #8
                I have another dumb question about these functions.

                I'm trying to help a client by developing a papertrading model for him. It's firing trades with buyMarket and sellMarket. But my question is why do I get an "order rejected" message in the account manager when I try to reverse positions.

                I'm using buyMarket to initiate LONGS
                sellMarket to close LONGS
                sellShortMarket to initiate SHORTS
                and buyMarket to close SHORTS

                I don't see any reference to buyCoverMarket?? Is there one?

                What I need to know if proper efs structure for GBF (papertrader)to overcome this "order rejected" message in the account manager?

                I'm thinking I'm missing something simple??
                Brad Matheny
                eSignal Solution Provider since 2000

                Comment


                • #9
                  Well, I've tried everything I can. Now I need to hear from someone at esignal about this...

                  It appears every time it's short and I try to reverse to long, then it tells me "order rejected, Please close an existing opposite-side position first".

                  I've even broken the code down to try to CLOSE first, then initiate a new position - but no luck.

                  Any help would be appreciated?

                  B
                  Brad Matheny
                  eSignal Solution Provider since 2000

                  Comment


                  • #10
                    Hi Brad,

                    Are you using the eSignal Paper Broker as the default broker for this? Or are you using a simulated account through one of the broker plug-ins?

                    If using a plug-in, please provide the build numbers for eSig, the plug-in and broker software (if applicable).

                    Please also post a working code sample that reproduces this.
                    Jason K.
                    Project Manager
                    eSignal - an Interactive Data company

                    EFS KnowledgeBase
                    JavaScript for EFS Video Series
                    EFS Beginner Tutorial Series
                    EFS Glossary
                    Custom EFS Development Policy

                    New User Orientation

                    Comment


                    • #11
                      im having some issues getting my program to send orders as well, when i turn confirmations off, no orders are sent.

                      Doji, i find that in order to close a short, i have to use the closePosition(getSymbol()) function, i had to figure that out through trial and error since i couldnt find much help on the topic either. if you need, heres a program i wrote, it works, it sends orders and esignal papertrade account accepts it, but its the only program ive gotten it to work in. (to operate the script, double click on the chart above the current price to enter long, double click below the current price to sell one long position, and do so again to enter short if your net position is zero)

                      PHP Code:
                      var LastEntry 0;

                      function 
                      preMain() {
                          
                      setPriceStudy(true);
                          
                      setColorPriceBars(false);
                          
                      setStudyTitle("mouse");
                          
                      setCursorLabelName("Side",0)
                          
                      setPlotType(PLOTTYPE_LINE0)
                          
                      setPlotType(PLOTTYPE_LINE1)
                          
                      setDefaultBarThickness(20);
                          
                      setDefaultBarThickness(21);
                          
                      setDefaultBarFgColor(Color.RGB(0,0,255), 0);
                          
                      setDefaultBarFgColor(Color.RGB(255,0,0), 1);
                      }
                      function 
                      main() {
                      drawLineRelative(1close(), 40close(), PS_SOLID2Color.RGB(255,0,255), 1)
                      drawLineRelative(1100010PS_SOLID1Color.RGB(255,0,255), 2)
                      return 
                      String(LastEntry)
                      }
                      function 
                      onLButtonDblClkbarIndexyValuexy) {
                         
                          if (     
                      barIndex >= && yValue close() && LastEntry ==  1) {
                              
                      buyMarket(getSymbol(), 100000)
                              
                      LastEntry 1
                          
                      }else if (barIndex >= && yValue close() && LastEntry ==  0) {
                              
                      buyMarket(getSymbol(), 100000)
                              
                      LastEntry 1
                          
                      }else if (barIndex >= && yValue close() && LastEntry == -1) {
                              
                      closePosition(getSymbol())
                              
                      LastEntry 0
                          
                      }else if (     barIndex >= && yValue close() && LastEntry ==  1) {
                              
                      sellMarket(getSymbol(), 100000)
                              
                      LastEntry 0
                          
                      }else if (barIndex >= && yValue close() && LastEntry ==  0) {
                              
                      sellShortMarket(getSymbol(), 100000)
                              
                      LastEntry = -1
                          
                      }else if (barIndex >= && yValue close() && LastEntry == -1) {
                              
                      sellShortMarket(getSymbol(), 100000)
                              
                      LastEntry = -1
                          

                          


                      Last edited by kalzenith; 10-01-2009, 07:38 PM.

                      Comment


                      • #12
                        Searching the forum for this problem, and come up with this old thread. Did you guys ever resolve the issue of reversing a position? I believe if a closeposition is executed, then a buy market follows, the close is still being processed when the buy order arrives, hence the buy order is rejected. How do I get them to take thier place in the queue so the buy order is actioned immediatly after the previous order is actually closed?

                        Or is there another way? Having to close on one bar, and wait for the next bar to appear so as to kill time while the close is processed, sure plays havoc with your entry price.

                        Comments anyone?

                        Cheers

                        Merv

                        Comment

                        Working...
                        X