Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Peixoto
    3. Posts
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    P
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 5
    • Best 0
    • Groups 0

    Posts made by Peixoto

    • RE: backtrader connects to diferent instance of TWS

      @vladisld said in backtrader connects to diferent instance of TWS:

      try to pass None for clientId ( that's what I'm using i

      I tried to pass None, same result, and after also set the Master API client ID to empty, still the same behaviour. any more sugestion?

      Thanks in advance

      posted in General Code/Help
      P
      Peixoto
    • RE: backtrader connects to diferent instance of TWS

      @vladisld no, nothing changes the cash amount, the trade tab and orders tab continues empty. sending here my connection part of my code

      store = backtrader.stores.IBStore( port=7497, host='127.0.0.1', clientId=35)

      and my tws settings
      0c63328c-c5c1-4633-8490-12ffb91f58f0-image.png

      any idea on why I am having this behavior?

      thanks in advance

      posted in General Code/Help
      P
      Peixoto
    • backtrader connects to diferent instance of TWS

      hello, I got my algo ready for final phase of tests, running non stop in a paper account in TWS for final validation.

      Now I am having an issue, so I open TWS and log into a paper account, I run my algo, my algo does some trades, I can see them happening with logs in my python script, but I don't see them appearing in the TWS window.
      I believe the tws window and my algo are running too different instances, is there any way to fix this, so when my algo does a trade I see it appear in TWS?

      I need this in case of some failure of my algo mid trade, I can manually close the trade and restart my algo.

      Best regards

      posted in General Code/Help
      P
      Peixoto
    • Recover of backtrader strategy

      Re: Failover / Recoverability of a Backtrader strategy

      Hi, I got a question, what type of system do you have to recover your strategy to the point before an internet failure/ system restart etc?

      What I mean is, if I have a position open, and backtrader restarts or another issue happens that makes my algo to reboot, how do you recover the list of trades you have open or the possible variables that are initiated that you need the values to exit a trade?
      From what I could see the system will restart new trading positions will happen but backtrader will lose track of the positions before the reboot.

      I link to a post that explained better than me, unfortunately, he got no answer.

      hope you can give a hand, and possible some code for "inspiration"

      Best Regards

      posted in Indicators/Strategies/Analyzers
      P
      Peixoto
    • feeding sizer with stop loss value

      Hi, I have my strategy that predicts an entry point for a trade, after it predicts a stop loss and a take profit to exit the trade, so far so good.
      My issue appears on the sizing and leverage part.

      My goal is to, when I hit the stop loss I should lose 1% of my bank(can ignore commissions, slippage... , will deal with that later).
      I was hoping I could take leverage and sizing to achieve this goal, but I cannot find a way to feed the custom sizer with data from my strategy.

      basically, my sizing and leverage are dependent on the stop loss, but I am having an issue sending my stop loss value to the costume sizer.

      any suggestions on how to pass my stop loss and take profit values to the sizer?

      Best Regards

      posted in General Code/Help
      P
      Peixoto
    • 1 / 1