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

Is it possible to buy and sell for the same amount of value at the same bar with no cash in account?

  • Say I have 0 cash in my account, and I would like to buy A stock for 100 and sell B stock for 100 at the next bar. Only the sell order will be executed, and the buy order status will be 'Margin' and I will end up with 100 cash sitting in my account at the end of the next bar.

    I have to create additional bars to get both the sell and buy orders executed.

    Is there any other way to solve this?

    Thank you.

  • Yes, first sell order will be executed, then buy order. You should be confident that you are selling and buying stocks with the same value.

  • administrators

    Yes. do as @ab_trader points out. You cannot buy if you haven't got any cash. You need to sell first to inject cash into your account.

Log in to reply