For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Forex trading leverage settings in backtrader

  • Hi, @backtrader @ab_trader , I am trying to backtest a forex trading strategy on backtrader, I read the Docs and it seems that the go-to method is I would like to trade forex with a 200 leverage, however, when I set or there was no change to my backtest results. The only notable change happened when I set, but @ab_trader you specified in that mult is usually not 1/margin, so how should I set it up?
    Ialso see in that "margin=2000 # Margin is needed for futures-like instruments", does that mean I don't need to designate a margin for forex? So it is only "mult" then?

  • administrators

    It would seem you are simply changing settings at random. My personal advice is that you really read what those things mean. A quick summary:

    • leverage: allows you to buy more of an asset than you have in cash
    • multiplier: multiplies the winnings/losses of an asset, but it won't let you buy more of the asset.
    • margin: it is for futures, which regardless of the notional value have a real value which is the margin and it is what your account has to have in order to keep you trading and to avoid your broker getting you out of the market.

    @bernardlin said in Forex trading leverage settings in backtrader:

    when I set or there was no change to my backtest results

    As expected. If you don't buy/sell more it doesn't matter how much leverage you use. But we don't know what you are doing, it's only a guess.

  • @backtrader

    Ah, many thanks! I will look again at the difference between the terms in depth!

    A new question just hit me, to further build up on this question. It seems that your reply implies that backtrader takes the asset class by default as shares or futures which are denominated in USD. What if I am trading forex pairs? I guess it works the same way for currency pairs like EURUSD as the price is denominated also in USD. But what if I am trading USDCHF, USDJPY or USDCHN? These pairs are denominated in other currencies other than USD, yet my base currency is still USD. This seems to pose an issue, do you have any suggestions how I can solve this? Much gratitude for your help!

Log in to reply