Back

How to place StopLoss and ProfitTaking orders without getting BuyingPower error

Hi All,

This question has been asked a few times on the forums but I'm still struggling to find a good solution.

https://www.quantconnect.com/forum/discussion/1493/need-help-for-stop-loss-order-error/p1

I'm trading Crypto pairs and I set some amount in USD and then set BTC to 0.

1. Place MarketOrder for BTC and wait for successful order to return.
2. Place a LimitOrder for profit order and a MarketOrder for StopLoss

I always get a insufficient buying power on the 2nd sell order I place. The only way I can avoid this is to SetCash on the BTC with enough funds to cover the additional sell.  Once I do this everything works fine.  However, in live trading I don't want to hold extra BTC (or any other pair) to cover the order.  Am I missing something?

I use some OneCancelsTheOther code I modified off of the forums to close out the sell orders and that all works fine as long as I can place both sell orders.

Thanks for you help.

Update Backtest







0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Here is a simple example of the issue.

0


Hi Kctrader,

The problem is, cash type account does now allow short selling. Once we buy 3.31 BTC, we are allowed to place selling orders summing up to no more than 3.31 BTC, otherwise we are attempting to short selling. This is also why when you put enough BTC to cover the second selling order, everything works fine.

Since you are using cash account and don't want to hold extra BTC, it is impossible to place two selling orders with the same quantity as the buying order. I would suggest using other strategies for Stop Loss and Profit Taking.

Hope it helps.

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed