No announcement yet.

Automated Trading is not allowed without explicit 'Trade.setLiveTrading'

  • Filter
  • Time
  • Show
Clear All
new posts

  • Automated Trading is not allowed without explicit 'Trade.setLiveTrading'


    Getting the following error message in an automated trading EFS:

    Automated Trading is not allowed without explicit 'Trade.setLiveTrading' call.

    I do execute the function Trade.setLiveTrading(true) in the EFS.

    Not sure if this is related but I did not get this error in previous versions of eSignal.

    Thank You.

    Glen Demarco

  • #2
    Hello demarcog,
    The following MUST be in preMain: "Trade.setLiveTrading(true); // false means that no live trades will be submitted.". I don't think that "Trade.setLiveTrading(true) in the EFS" will work without having it set to true in preMain...I haven't tried it, but you can probably turn it on and off with EFS as long as it's set to true in preMain. I'm not sure if you have already been using automated trading in a previous version of eSignal before, but in case that you haven't, let me just mention some of what's need to get it to go live. You need to get eSignal to enable auto-trading status, in which case there will be a button in the lower right part of the application that you need to click on to turn it on, then you need to click on a button on the top of the chart that will activate your auto-trading script for that chart ONLY, assuming that you have it set that way in preMain. Happy coding!!


    • #3
      Hi LetUsLearn,

      Thank you for the information.

      I did have automated trading working in prior releases and currently have the function in preMain().

      debugPrintln('*** Setting Live trading to true ***');

      Which is being executed as I see the ** Set Live Trading to true *** in the Formula Output window when the EFS is loaded.

      I have also enabled automated trading and do see the EFS Icon in the lower right and can enable both EFS icons.

      So I'm at a loss to understand why I'm getting this error message.

      Thanks Again

      Last edited by demarcog; 12-11-2019, 08:00 AM.
      Glen Demarco


      • #4
        Hi Glen,
        In an effort to recreate what you’re seeing, I commented out Trade.setLiveTrading(true) in preMain and then when I reloaded my script I got the exact same error message when the script loaded up to my call to Connection.isConnected(sConnectionID)…sConnectionI D is the name of my broker as a string. My exact output window error was: “Error: Function 'isConnected': Automated Trading is not allowed without explicit 'Trade.setLiveTrading' call.”, so why you’re getting this I guess that I can’t tell you with the info that I have now. As for your debugPrintln statement, that’s just showing you that preMain loaded past your Trade.setLiveTrading(true) statement, it’s not testing that LiveTrading is set to true. If you use Connection.isLiveTrading(Trade.getCurrentConnectio nID ( )), it will return true for live trading, false for paper trading, and null if you’re not connected. Also, you can use Connection.isConnected(Trade.getCurrentConnectionI D ( )), which will return true if you’re connected or false otherwise. When I got the error message above, my script wouldn’t load, which is probably what’s happening to you. But if you can get your script to load, you might want to put a button on your chart and test the above 2 calls to see if you have a connection issue, and what the LiveTrading status is. I'm not sure how much of the auto-trading documentation that you have, but I'm attaching some of what I have, good luck!

        drawTextPixel(194, 20, " Test @URL=EFS:TestConnection",, null, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, BUTTONS_FONT, 10, 59, -6);
        function TestConnection (){
        debugPrintln(Connection.isConnected(Trade.getCurre ntConnectionID()));
        debugPrintln(Connection.isLiveTrading(Trade.getCur rentConnectionID()));
        Hold the shift button down when you click the button, or it won’t do anything.
        Attached Files


        • #5
          Hi LetUsLearn,

          That's is great idea. I do have a version of the template you attached that I include in my EFS as I needed the real time functions but commented out drawbuttons() as it cluttered up the screen.

          Here is the formula output from the buttons you referenced:

          ================= Connection: PTNQ60 ==============
          isLiveTrading: false
          isConnected: true
          BrokerID: ESGNL
          BuildVersion: 12.11.5260.1025

          Perhaps I should check in with the eSignal customer to insure that feature hasn't been changed on my account although as I recall if that were the case the EFS icon in the lower right would not be available to toggle on and off to enable/disable automated trading.

          Thank for your help I will let you know.


          Last edited by demarcog; 12-12-2019, 04:14 PM.
          Glen Demarco


          • #6

            Interestingly enough following a reboot for an unrelated reason apparently I am not longer having the problem. In the interim I also sent an email to esignal retail support asking then to please verify that I was enabled for live trading. I did not hear back from them and I'm assuming was enabled because I did see the EFS indicator in the lower right.

            Are you familiar with the major discrepancies between real time trading results and the results of the back tester that goes way beyond slippage?

            The discrepancy is profound when multiple time intervals are used when back testing. I have posted many forum items in addition to speaking with technical support which if you search on my account name you will see, all have essentially been ignored.

            It's unfortunate for people like myself who rely on the back testing results to drive their trading decisions that eSignal has ignored my repeated requests and well documented and reproducible . issue with the back testing reports showing outrageous profits for any system using multiple time intervals.

            Thank you for your help it is appreciated.


            Glen Demarco


            • #7
              Hi LetUsLearn,

              Hope all is well with you and everyone during this terrible time. I've lived in NYC for 20+ years across the street from the WTC and was here on 9/11 and this is much worse in many respects then that horrible day, let's all hope and pray for those horribly affected by this virus.

              I was wondering if you or anyone knows if the EFS-AT Example you posted which is dated 2014 is the latest?

              As you mentioned it is tedious and a maintenance issue to copy and past that code into every real time strategy and your great idea of creating a Function Library..

              I want to implement your suggestion and wanted to make sure I had the latest and see if there is any other suggestions you have regarding implementing the library.

              Thank you.

              Last edited by demarcog; 04-02-2020, 01:10 PM.
              Glen Demarco


              • #8
                Hello Glen,
                I’m not aware of any updates to “EFS-AT Example” from 2014, but I think it has all that you really need. I saved a separate copy of it as a library file where I deleted preMain(), main(), postMain(), and the 3 global variables just above preMain(). To this, I’d like to add that if there were updates to it, it’d be nice if eSignal would do a better job of letting people know about it…but I wouldn’t count on it.
                I just posted the info on the trading library that you’re asking about in a new thread on this same forum. Let me know on that thread if you have any questions…beware of the plague…and stay safe.