Python code in strategy builder

Have you used Python screen in Tradetron ? if yes, how to write code there ,should we start Python from beginning like importing numpy ,pandas … or we can directly start writing blocks ???
any refrence or sample will be really helpful…thanks in advance

2 Likes

When you say Python code, there are actually 2 ways of looking at this.

  1. The native TT python code: This code is inserted directly in your strategy template in the python block. This is access to insert code directly into TT strategy is only with the TT quant team and is a paid service. Although it is called python, it is not the same as the regular python code. the syntax and functions are specific to what the TT engine understands and hence, this access is not public to users.
  2. The Third-party python code: As you are aware, TT based on your logic/conditions, generates corresponding signals and then the OMS takes the signals and places the orders. Third-party python code is where you keep the signal generation at your end(local to your Machine or your private VPS) and send only those signals to TT. And TT will do only the Order management.
    The signals are sent as a post request to TT. The third-party signals process is absolutely similar to integrating any third-party tool, for example, Amibroker or Tradingview
    Please follow Step 5 from the below link to generate an API link to your strategy.
    https://blog.tradetron.tech/node/32
    The only difference would be that you use the Request library in python to use a post function
    https://pypi.org/project/requests/
    https://www.w3schools.com/python/ref_requests_post.asp
    FAQ:
  3. No, your written python code cannot be directly inserted into TT.
  4. Yes you will have to get a data subscription to run python as a third-party tool locally.
  5. No, native python code insertion is not available under any subscription.
  6. Yes if you generate the signals locally you will have to keep your computer on. or use a VPS
    If you run a Third-party code, then TT does not get to know what is the logic behind signal generation, it only checks the signal values.
    Regards,