Portfolio balance changes even with unfilled orders

Hi there, I am a newbie so please be gentle :slight_smile:
I am following one of the strategies that Alpaca sent me an email about (A Simple Mean Reversion Stock Trading Script in C#) just using Paper/Test account and I am noticing that my Portfolio Balance is changing even after cancelling an order. Is there some fee or balance lag that I am not aware of?

Here is what my script does (basically. It runs once every minute during market periods.

  1. Gets current portfolio balance (amongst other things) and logs its value
  2. Checks for the presence of a previous order (ID stored locally) and if one exists and is not filled, tries to cancel it
  3. Gets Last 20 bars for a symbol
  4. Performs mean rev logic as per article mentioned above which may result in a buy or sell order
  5. If order, submit order and store Order ID locally
  6. Finish

What I am noticing, is that in Step 1 the Portfolio Balance is changing compared to the previous 1 minute (up, down and by different amounts) even if the order in Step 2 is not filled. I even check later on and that order ID is definitely in ‘canceled’ status. Can anyone explain what may be happening?

I can provide actual data if needed.

Thanks so much in advance all :slight_smile:
Travis