stratester.com

Portfolio · condition block

Equity level

The equity block compares the bot's total balance, cash plus the value of the open position at the current close, with a dollar amount.

How the engine evaluates it

Equity is cash + quantity × close on the current candle, after any trades made by earlier rules on that candle.

The comparison is strict and the block is a state.

Formula
equity = cash + BTC held × close

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:

equity > $12000
equity < $8000

Settings

SettingValuesDefaultNotes
Comparison>, <>—
Amountany dollar amount$12,000—

How traders use it

  • Lock in a target: equity > $15000 with sell 100%.
  • Stop trading below a floor: add equity > $7000 to every entry rule.

Example bot

botscript
bot "Stop At Target"

when equity > $15000 or equity < $7000
then sell 100%

when price crosses above sma(50) and equity < $15000 and equity > $7000
then buy 100%
  • Sells everything once equity passes $15,000 (target) or falls below $7,000 (floor).
  • Only enters while equity is between the two limits.

Pitfalls

  • Dollar levels depend on the starting balance. Change one and you must change the other.
  • For limits relative to the peak, use the drawdown block instead.

Equity level: frequently asked questions

Is open profit included?

Yes. Equity marks the position at the current close.

Is it the same as the result at the end of a run?

At the last candle, yes: final equity is cash plus the position at the last close.

How do I set a relative limit?

Use the drawdown block, which measures the fall from the run's peak in percent.

Does it include trades made on the same candle?

Yes, rules above have already updated cash and position.

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.