Announcement

Collapse
No announcement yet.

Handling multiple accounts at multiple brokers from one script

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

  • Handling multiple accounts at multiple brokers from one script

    When I test EFS scripts designed to trade multiple accounts, I first use accounts in eSignal paper trading (e.g. DEMO, DEMO2, DEMO3). Another level of testing involves testing with paper trading accounts at Interactive Brokers (e.g. DU123456). A final round of testing involves simultaneous trading using a combination of both eSignal and IB paper trading accounts, all using one chart and one EFS script.

    In the last couple of days, I noticed that eSignal was hanging up and practically freezing because simulated trades or cancels sent to IB TWS were causing a timeout error (at "line 0") in EFS. I used debug print statements to Formula Output to confirm that the timeout occurred when a trade or order cancellation was executed.

    This led me to question whether EFS was designed to handle orders to multiple brokers. Is there a known limitation or instability when multiple broker platforms (i.e. multiple connections) are accessed by the same script? Does some underlying trade handling module get confused? Obviously a chart can display orders for only one account on one connection, but the script running on a chart can access multiple connections and multiple accounts. Nevertheless, I am concerned about the timeout error, which I cannot catch using error handling in code, and the desktop client does not recover gracefully.

    In addition, I have other charts running scripts that access the same broker connections, without timeout errors, but none of those scripts handle orders in multiple connections inside one single chart. In other words, when I run a script which handles orders to one connection, unexplained timeout errors never occur.

  • #2
    I have about four months’ experience with the following dual-broker implementation. From a single chart running a single EFS-AT, I place a paper trade through ESGNL and then, once it is confirmed, I place a second paper trade through IB. The results have been as expected (based on the documentation) and I have not received any script errors. My trades are in futures markets and are slow paced -- several within a trading session. In addition, the trades sent to the two brokers are never simultaneous because of the contingent nature of their placement. The eSignal Account Manager seems to keep everything straight and proper.

    Comment


    • #3
      odgo, thanks for your feedback. Perhaps I need to separate the trade/cancel submissions by broker instead of handling multiple brokers in the same iteration or instance (i.e. tick). As a further level of precaution to avoid crashing the script, I could handle one account per iteration, although that may introduce an undesirable delay in submitting trades to multiple accounts.

      Comment


      • #4
        I do similar testing
        I just have the same program on two different charts
        On one chart I am connected to ib on other chart to esignal demo account

        I do not direct the same trade to different accounts from the same chart

        Comment


        • #5
          odgo & AdamS01,

          I have found a solution which seems consistent with both of your approaches.

          Using one chart, I submit orders for one account (and one broker) per iteration (i.e. tick) of the EFS. To clarify, for any one execution of main(), only one order for one broker and one account is submitted.

          Handling one account greatly reduced (practically eliminated) the odds of crashing. There were other order handling issues but not due to the broker connection getting hung. At this point, I feel the original issue has been addressed, but if anybody wants to add observations, that might be helpful for identifying potential pitfalls that I have yet to experience.

          Comment


          • #6
            Please Share working efs file for automated trading.

            Comment

            Working...
            X