For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
How do I customize my own Sizer and calculate the size for the long or short position ?
-
I backtest my own strategy, and customize my own sizer like following:
class MySizer(bt.Sizer): def _getsizing(self, comminfo, cash, data, isbuy): size = cash*0.96/data.close[1] return size
the above is for the long position, but how do I customize the short position ? maybe for the using the leverage . Thanks .
-
@ramoslin02 said in How do I customize my own Sizer and calculate the size for the long or short position ?:
the above is for the long position, but how do I customize the short position ?
By checking the parameter
isbuy
which tells you if the sizing operation is for abuy
order. Else it will be asell