stratester.com

Portfolio · condition block

Holding or flat (position state)

The position block asks one question: does the bot hold any Bitcoin right now? holding is true while a position is open; flat is true when it is not.

How the engine evaluates it

holding is true when the bot's BTC quantity is above zero (ignoring dust far below a satoshi). flat is the opposite.

The state reflects trades made earlier on the same candle, because rules run top to bottom and update the portfolio as they go.

Botscript syntax

In the Lab you pick this block from the Portfolio group and fill in its fields. In the code view the same condition is written like this:

holding
flat
not holding

Settings

SettingValuesDefaultNotes
Stateholding, flatflatnot holding is the same as flat.

How traders use it

  • Exits that only make sense in a trade: rsi(14) > 70 and holding.
  • Entries only from flat when stacking is on: flat and ….
  • Readable intent in long rule lists.

Example bot

botscript
bot "Flat Entries Only"

guard stacking on

when flat and rsi(14) < 30
then buy 50%

when holding and rsi(14) > 70
then sell 100%
  • Stacking is on for other rules, but this entry only fires when nothing is held.
  • The exit only checks RSI while a position is open.

Pitfalls

  • Without stacking, buys are already skipped while holding, so flat on an entry changes nothing.
  • Sell rules are harmless when flat (there is nothing to sell), so holding is mostly about clarity.

Holding / flat: frequently asked questions

Do I need flat on every buy rule?

No. By default a bot holds one position at a time and ignores buys while holding. flat matters when stacking is on.

Is a tiny leftover position counted as holding?

Amounts far below one satoshi are treated as zero. A real partial position counts as holding.

Does it see a buy made by a rule above on the same candle?

Yes. Rules run in order and each fill updates the portfolio before the next rule is checked.

Can bots go short?

No. Bots are long-only: they hold BTC or cash.

Simulated results are hypothetical. They include only the fee and slippage you set on the bot, not every real-world cost or market condition, and past performance does not guarantee future results. Nothing here is financial advice.