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

Oanda setcommision and size



  • Hi ! Hoping everyone is keeping safe in these times.

    Need some help with forex oanda commision. I cannot fully understand the docs.
    The commission is in the spread, but under a million shares traded, the commision is $50. Lets say $5 per trade for easy calculation.
    Margin for my country is 5% and so I believe leverage is 20x.

    Can I ask how do you set cerebro broker is this case?

    #This code cannot work... meaning no orders executed, beleive commtype=bt.CommInfo.COMM_FIXED is the issue?
    cerebro.broker.setcommission(leverage=20, mult=1.0, stocklike=False, automargin=0.05, commtype=bt.CommInfoBase.COMM_FIXED, commission=5.0)
    

    a few more questions

    1. whats the difference between mult and leverage?
    2. how do you set the size to buy. Should size include the 20x leverage?
      as objective is to trade live on oanda, hence hoping to get this right
    amount_to_invest = (0.5 * self.broker.cash)
    self.size_to_exe = math.floor(amount_to_invest / self.data0.close)
    

    Thanks a million!


Log in to reply
 

});