Skip to Content
Core WorkflowsCreating Strategies

Creating strategies

Describe what the strategy should do; Lona handles the implementation details.

Define the strategy

When you start a chat, the Lona agent uses its tools to turn an idea into explicit trading rules:

  1. Describe the concept in natural language.
  2. Answer questions about indicators, entries, exits, and risk.
  3. Review Lona’s summary.
  4. Continue the conversation until the rules are correct.

Lona saves the latest structured rules in the Canvas under Identified rules.

What to tell Lona

Strategy concept

Describe the approach or market behavior you want to test:

  • Trend following
  • Mean reversion
  • Breakouts
  • Momentum
  • Volatility

Indicators

Name the indicator and its settings, such as a 20-period SMA, 14-period RSI, MACD (12, 26, 9), or Bollinger Bands with two standard deviations.

Entry conditions

State exactly when to open a position:

  • Buy when price crosses above a moving average.
  • Enter long when RSI crosses back above 30.
  • Buy when the fast average crosses above the slow average.

Exit conditions

State exactly when to close a position:

  • Sell when price crosses below a moving average.
  • Exit when RSI reaches 70.
  • Close when the fast average crosses below the slow average.

Optional details

You can also describe stop losses, take profits, position sizing, multiple-condition logic, trading sessions, and other risk rules.

Important: Strategies are market-agnostic. Do not specify a timeframe while defining the rules; choose the symbols, frequency, and date range when configuring a backtest. The same strategy can then be tested on compatible data sets.

A clear example

Create a moving-average crossover strategy using a 10-period fast average and a 30-period slow average. Enter long when the fast average crosses above the slow average. Exit when it crosses below. Risk no more than 10% of the portfolio on one position.

This works because it specifies the indicators, periods, entry, exit, and risk rule without prescribing code.

Avoid ambiguity

Instead of:

Use RSI to buy low and sell high.

Specify the period, thresholds, and triggers:

Use a 14-period RSI. Enter long when RSI rises above 30 after being oversold. Exit when RSI falls below 70 after being overbought.

Also avoid descriptions such as “write a pandas script.” Explain the trading behavior and let Lona generate the Backtrader implementation.

Strategy types

Lona can help with:

  • Moving-average and channel trend following
  • RSI, Bollinger Band, and statistical mean reversion
  • MACD, rate-of-change, and relative-strength momentum
  • ATR and other volatility-based rules
  • Multi-indicator strategies with AND/OR conditions

Common indicators

IndicatorTypical use
SMA/EMATrend direction, crossovers, support/resistance
RSIOverbought/oversold conditions and momentum
MACDTrend strength and crossovers
Bollinger BandsVolatility, breakouts, and reversals
ATRVolatility-aware stops or sizing
StochasticMomentum and reversals
VolumeBreakout confirmation

Start with one or two indicators. Add complexity only after a simple version behaves as expected.

From rules to a strategy

Once the rules are clear, Lona automatically writes them to Identified rules, generates executable Backtrader code, and checks that the code can run. After generation, use Code to review it, Run Backtest to test it on your chosen data, or Optimize to sweep numeric parameters.

Continue to Requirements & Code Generation to learn how Lona structures the rules and code.

Conversation tips

  • Be conversational and explicit: entry → exit → risk → special conditions.
  • Use examples to remove ambiguity.
  • Ask Lona for indicator suggestions when you are unsure.
  • Start with a small rule set and iterate.
  • Configure markets, data sources, frequency, and dates when running the backtest.
  • Describe behavior instead of code syntax or library names.

If Lona misunderstands, rephrase the rule, break it into smaller parts, and give a concrete example of the expected signal.

Next steps

Read Requirements & Code Generation, then Execution & Backtesting.

Last updated on