stratester.com

Actions · action block

Buy a fixed dollar amount

The buy $ action spends the same dollar amount every time it fills, which makes position sizes easy to compare across a run.

How the engine evaluates it

The requested amount is the fixed dollar figure. Every buy then passes the risk guards: no buy while a position is open unless stacking is on, the optional per-trade dollar cap, the optional cap on the share of equity invested, and finally the cash you actually have. A buy worth less than one cent is skipped.

The amount includes the fee: buy $1000 takes $1,000 of cash and buys BTC with what is left after the fee. At market it fills at the close plus slippage, or at a wick-triggered level, like every action.

By default the action buys at market. limit X% instead places a buy limit at close × (1 − X/100), to buy a dip: it fills on the first candle whose low reaches it, at the lower of that candle's open and the limit, with no slippage. stop X% places a buy stop at close × (1 + X/100), to buy a breakout: it fills on the first candle whose high reaches it, at the higher of the open and the stop, plus slippage.

A limit or stop order is placed at the close of the candle where the rule fired and works on the next N candles (expires N, 12 by default); if none reaches its price, it lapses with no trade. Working orders are checked at the start of each candle, before that candle's rules, in rule order. Each rule has at most one working order, so the rule firing again while its order works places nothing. The size is worked out when the order fills, from the cash or position at that moment, and if there is nothing to trade the order is used up without a trade.

Every fill pays the fee set on the bot, a percent of the fill's value charged in dollars (0.1% for new bots; bots created before fees existed keep 0%). Market and stop fills also pay the bot's slippage, which moves the fill price against you; limit fills get none.

Formula
spend = min(amount, max per trade, room under max invested, cash)
notional = spend / (1 + fee)
fee paid = spend − notional
BTC bought = notional / fill price

Botscript syntax

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

buy $1000
buy $250
buy $1000 limit 1%
buy $500 stop 2% expires 6

Settings

SettingValuesDefaultNotes
Amountany dollar amount$1,000Capped by the cash available when the buy fills.
Ordermarket, limit, stopmarketLimit and stop orders wait for a price; see above.
Offset0.01 – 50%1%Distance of the order price from the close of the candle where the rule fired.
Expires1 – 1,000 candles12How many candles a limit or stop order works for.

How traders use it

  • Dollar-cost averaging: buy $200 on a schedule-like condition such as day monday and hour 0..0 with stacking on.
  • Fixed-size entries for strategies you want to compare fairly.

Example bot

botscript
bot "Weekly DCA"

guard stacking on

when day monday and hour 0..0
then buy $200
  • Buys $200 of BTC on every Monday candle that opens at 00:00 UTC, adding to the position each week (stacking on).
  • On daily candles that is once a week.

Pitfalls

  • With a fixed amount the bot eventually runs out of cash; buys then shrink to what is left and finally stop.
  • The fee comes out of the amount, so buy $1000 at a 0.1% fee buys about $999 of BTC.

Buy $: frequently asked questions

What if I don't have enough cash?

The buy is reduced to the cash available, and skipped if that is under one cent.

Do the risk guards still apply?

Yes, the per-trade cap and the max invested share are applied first, when the buy fills.

Is the fee on top of the amount?

No. The amount is the cash that leaves the account, fee included.

Can I dollar-cost average?

Yes, with stacking on and a recurring condition such as a weekday and hour.

Is the amount in USD?

In USDT, which tracks the US dollar.

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.