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 to make a run to both long and short?



  • Hi all,
    According to the quick guide, there are actually just open the order by using self.buy(), then close the trade by using self.sell(). However, I would like to make a strategy for both long and short order to match every signal that defined in __init__ function. So how to create this process? For example, I have the buy order existed, then self.sell() to close this trade then I want to open immediately other sell order. Then when have a buy signal, I will close the sell order by using self.buy() and other buy order right after.

    Other question is asking for the buy_bracket as well as sell_bracket. What exactly the meaning of stopprice and limitprice. Is it the take profit target and stoploss threshold?

    Thank all~


  • administrators

    If you issued 2 sell in a row you would go short. But you probably want to use the size parameter of the methods or use close to close a position and then either sell or buy to go to the other side. Or use a Sizer or ...

    @Nguyễn-Sơn said in How to make a run to both long and short?:

    Other question is asking for the buy_bracket as well as sell_bracket. What exactly the meaning of stopprice and limitprice. Is it the take profit target and stoploss threshold?

    The signature indicates that one of the brackets is a Stop order and the other one a Limit order. The prices correspond to those. But yes, they do correspond to those concepts.


Log in to reply
 

});