Strategy TOML Reference

This is the complete reference for the Botmarley strategy TOML format. Every field, type, and valid value is documented here.

Structure Overview

[meta]
name = "Strategy Name"
description = "Optional description"
max_open_positions = 5

[[actions]]
type = "open_long"
amount = "100 USDC"
average_price = false

  [[actions.triggers]]
  indicator = "rsi_14"
  operator = "<"
  target = "30"
  timeframe = "1h"

A strategy consists of:

  1. [meta] — metadata and global settings
  2. [[actions]] — one or more trading actions, each with triggers

[meta] Section

FieldTypeRequiredDefaultDescription
nameStringYesStrategy name (1–255 characters, must be unique)
descriptionStringNo""Human-readable description
max_open_positionsIntegerNoUnlimitedMaximum concurrent open positions (must be >= 1)
[meta]
name = "BTC_DCA_Conservative"
description = "RSI oversold entry with DCA on dips, trailing stop exit"
max_open_positions = 3

[[actions]] Section

Each action defines what to do and when (via triggers).

FieldTypeRequiredDefaultDescription
typeStringYesAction type: open_long, buy, or sell
amountStringYesTrade amount (see format below)
average_priceBooleanNofalseEnable DCA averaging (open_long and buy only)

Action Types

TypePurposeNotes
open_longOpen a new long positionInitial entry
buyAdditional buy within positionDCA / averaging
sellExit position (full or partial)Close trade

Amount Format

Currency amount:

amount = "100 USDC"
amount = "50.5 BTC"
amount = "200 USD"

Percentage:

amount = "50%"      # 50% of position
amount = "100%"     # Full exit

Warning

Negative amounts are rejected. Percentage must be between 0 and 100.


Triggers

Each action requires at least one trigger. All triggers within an action use AND logic — all must be true simultaneously for the action to execute.

Three Trigger Categories

  1. Technical Indicator — compare indicator values
  2. Price Change — react to price movements
  3. Next Candle — delay execution

Technical Indicator Triggers

Compare a technical indicator against a target value or another indicator.

[[actions.triggers]]
indicator = "rsi_14"
operator = "<"
target = "30"
timeframe = "1h"
max_count = 5
FieldTypeRequiredDescription
indicatorStringYesIndicator name with period (e.g., rsi_14, ema_20)
operatorStringYesComparison: >, <, =, cross_above, cross_below
targetStringYesNumeric value or another indicator
timeframeStringNoEvaluation timeframe (1m, 5m, 15m, 1h, 4h, 1d)
max_countIntegerNoMaximum times this trigger fires per position

Operators

OperatorMeaning
>Indicator is greater than target
<Indicator is less than target
=Indicator equals target
cross_aboveIndicator crosses above target (was below, now above)
cross_belowIndicator crosses below target (was above, now below)

Target Values

Numeric:

target = "30"       # RSI value
target = "67500.0"  # Price level

Another indicator:

target = "sma_50"   # Compare EMA to SMA
target = "bb_upper" # Compare to Bollinger upper band

Price Change Triggers

React to price movements relative to position entry or market-wide.

pos_price_change

Fires when position P&L reaches a threshold.

[[actions.triggers]]
type = "pos_price_change"
value = "+3%"       # Take profit at +3%
max_count = 1

pos_price_change_follow

Trailing trigger — tracks the peak price since entry, fires on retracement.

[[actions.triggers]]
type = "pos_price_change_follow"
value = "+3.0%"
tolerance = "-0.2%"

price_change

Market-wide price change (not position-relative).

[[actions.triggers]]
type = "price_change"
value = "-5%"
timeframe = "1h"

trailing_stop

Follows price up, triggers on drawdown from peak.

[[actions.triggers]]
type = "trailing_stop"
value = "-3%"

Price Change Fields

FieldTypeRequiredDescription
typeStringYesTrigger type (see variants above)
valueStringYesPercentage threshold (e.g., "+3%", "-5%")
toleranceStringNoRetrace tolerance (pos_price_change_follow only)
timeframeStringNoFor price_change and consecutive_candles
max_countIntegerNoMaximum fires per position

Next Candle Trigger

Delays action execution until the next candle closes.

[[actions.triggers]]
type = "next_candle"
timeframe = "1h"
FieldTypeRequiredDescription
typeStringYesMust be "next_candle"
timeframeStringNoCandle timeframe to wait for
max_countIntegerNoMaximum fires per position

Indicators Reference

FormatNameNotes
rsi_{period}Relative Strength Indexe.g., rsi_14
sma_{period}Simple Moving Averagee.g., sma_50
ema_{period}Exponential Moving Averagee.g., ema_20
bb_lower, bb_upper, bb_midBollinger BandsBand component
macd_line, macd_signal, macd_histMACDComponent
stoch_rsi_{period}Stochastic RSIe.g., stoch_rsi_14
roc_{period}Rate of Changee.g., roc_10
atr_{period}Average True Rangee.g., atr_14
obvOn Balance VolumeNo parameters
obv_sma_{period}OBV with SMAe.g., obv_sma_20
vol_sma_{period}Volume SMAe.g., vol_sma_20
ttm_trendTTM TrendAlternative: ttmtrend
priceCurrent PriceSpecial: market price

Period range: 1–200 (inclusive). Values outside this range cause a validation error.


Valid Timeframes

ValueMeaning
1m1 minute
5m5 minutes
15m15 minutes
1h1 hour
4h4 hours
1d1 day

Complete Example

[meta]
name = "Multi_Timeframe_DCA_v1"
description = "RSI oversold entry on 1h, DCA on dips, trailing stop exit"
max_open_positions = 3

# ENTRY: RSI < 30 on 1h timeframe
[[actions]]
type = "open_long"
amount = "100 USDC"
average_price = false

  [[actions.triggers]]
  indicator = "rsi_14"
  operator = "<"
  target = "30"
  timeframe = "1h"

# DCA: Buy more on -2% drop
[[actions]]
type = "buy"
amount = "100 USDC"
average_price = true

  [[actions.triggers]]
  type = "pos_price_change"
  value = "-2%"
  max_count = 1

# DCA: Buy more on -4% drop
[[actions]]
type = "buy"
amount = "200 USDC"
average_price = true

  [[actions.triggers]]
  type = "pos_price_change"
  value = "-4%"
  max_count = 1

# TAKE PROFIT: +3% from average entry
[[actions]]
type = "sell"
amount = "100%"

  [[actions.triggers]]
  type = "pos_price_change"
  value = "3%"

# STOP LOSS: -5% from average entry
[[actions]]
type = "sell"
amount = "100%"

  [[actions.triggers]]
  type = "pos_price_change"
  value = "-5%"

Validation Errors

ErrorCause
REQUIREDMissing required field
INVALID_ACTION_TYPEType not open_long, buy, or sell
INVALID_AMOUNT_FORMATDoesn't match "NUMBER CURRENCY" or "NUMBER%"
INVALID_OPERATORUnknown operator
INVALID_INDICATORUnknown indicator format
INVALID_PERIODNon-numeric period
INVALID_PERIOD_RANGEPeriod outside 1–200
INVALID_BAND_TYPEBollinger band not lower/upper/mid
INVALID_MACD_COMPONENTMACD component not line/signal/hist
INVALID_TIMEFRAMETimeframe not in valid list