Follow the example
Choose a step to follow the example. Opening a request lets you review it; it does not submit a job or change your account.
Read this pair's entry and exit
Inspect the exact pair, indicator windows, position guard and allocation below. Weekly accumulation has a purchase cadence and no invented sale rule.
- Entry
- Saved rule: Price > SMA(200, Day) AND RSI(14, Day) < 40 AND position value = 0
- Exit
- Saved rule: RSI(14, Day) >= 60 OR Price <= SMA(200, Day) AND position value > 0
- Allocation
- Saved rule: 95% of buying power per entry; sell 100% of held units on exit
- Pair
- Saved rule: BTC-USD
The full saved condition/action book with fractional units and an explicit Cryptocurrency target.
Choose the lines to compare
Completed 2024 backtest
This saved algorithm completed a Day backtest from 2024-01-01 through 2024-12-31, with $10000.00 starting capital. The chart includes all 744 exported history points. Compare the strategy with SPY and BTC buy and hold. Each benchmark invests the full $10000.00 starting balance over the same 2024 period. SPY follows its trading sessions; BTC includes weekends. This algorithm follows its own allocation and entry/exit rules, with 0.7% of traded notional charged on each fill. Explore cash and position values to see how capital was deployed.
The exact stored history shown here, with its source's period, comparisons and limits. Opening the walkthrough does not rerun it.
Preview this strategy in Aurora
Review the provided strategy request without changing its pair or sizing. Ask for a draft preview before any saved candidate or paid test.
An inspectable candidate. New dates or a changed rule define another experiment, not the published result.
The algorithm
Buy an RSI pullback within a 200-day uptrend; exit on RSI recovery or a trend break.
This example trades BTC-USD as a spot Cryptocurrency asset. The saved rules were read back and verified with automated trading off.
Scroll sideways to compare all columns. Select a heading to sort.
| Entry | Price > SMA(200, Day) AND RSI(14, Day) < 40 AND position value = 0 |
| Exit | RSI(14, Day) >= 60 OR Price <= SMA(200, Day) AND position value > 0 |
| Allocation | 95% of buying power per entry; sell 100% of held units on exit |
| Pair | BTC-USD |
| Execution | Market; fractional units enabled |
| Starting capital | $10,000; no additional deposits |
No matching rows. Clear the filter to see all records.
Create the same strategy
Ask Aurora to build the rules above, review the preview, then save the draft with automated trading off. Confirm the Cryptocurrency pair, allocation and entry and exit conditions in the saved rules.
In the native Strategies editor, use Buy and Sell actions with the same Cryptocurrency pair. Add the indicator and position-value conditions shown above. The weekly accumulation example uses a single Buy rule with a seven-day DaysSinceOrder condition.
Create, test and iterate in Aurora
Start this worked example in the NexusTrade app. Review the filled-in request, open it in Aurora, then send it when ready. Continue in the same conversation through these steps.
Create the exact strategy
Ask: "Review BTC trend pullback. Entry: Price > SMA(200, Day) AND RSI(14, Day) < 40 AND position value = 0. Exit: RSI(14, Day) >= 60 OR Price <= SMA(200, Day) AND position value > 0. Show the resolved rules and selectors before saving." The request includes this example's complete draft.
Run the 2024 development comparison
Ask: "Backtest the saved rules from January 1 through December 31, 2024, daily, starting with $10,000. Keep the displayed fees and capture detailed events." Compare the strategy with SPY and BTC buy and hold. Use SPY as the backtest baseline and a separate BTC buy-and-hold backtest with matching dates and starting capital.
Explain what happened
Ask: "Explain one entry signal and its Filled orders using the recorded indicator values, comparisons, allocation, prices, quantity and fees. Then follow the largest drawdown through trades, cash and holdings."
Create one variant, then test unseen dates
Ask: "Change only the entry allocation from 95% to 75% of buying power. Show the rule diff and compare both candidates on the 2024 development period with every other setting fixed." After choosing, freeze the rules and select another test period you have not inspected. The displayed 2024 results already make 2024 a viewed development period. Keep any later revisions in a new research cycle.
Create and backtest with Python
Python SDK 1.42.0. Save the runner below as run_btc_trend_pullback.py.
Install and download
python3 -m pip install nexustrade==1.42.0
export NEXUSTRADE_API_KEY="YOUR_API_KEY"
curl --fail --output btc_trend_pullback.py https://nexustrade.io/seo/strategy-examples/btc-trend-pullback.py
Create, test and inspect
from btc_trend_pullback import create_btc_trend_pullback, backtest_btc_trend_pullback
book = create_btc_trend_pullback()
completed = backtest_btc_trend_pullback()
print(completed["result"])
Run
python3 run_btc_trend_pullback.py
Python strategy and backtest functions
View complete Python SDK functions
The backtest function submits the 2024 test with SPY as its benchmark, records events and waits for the result. Use a new request key when changing rules, dates or fees.
import nexustrade as nt
def create_btc_trend_pullback():
asset = nt.crypto_asset("BTC-USD")
return nt.portfolio(
"Public SEO crypto example - BTC trend pullback",
[
nt.strategy(
"Enter BTC trend pullback",
(((nt.Price(asset) > nt.SMA(asset, 200, "Day")) & (nt.RSI(asset, 14, "Day") < nt.Value(40))) & (nt.PositionValue(asset) == nt.Value(0))),
nt.buy(asset, 95, "percent of buying power")
),
nt.strategy(
"Exit BTC trend pullback",
(((nt.RSI(asset, 14, "Day") >= nt.Value(60)) | (nt.Price(asset) <= nt.SMA(asset, 200, "Day"))) & (nt.PositionValue(asset) > nt.Value(0))),
nt.sell(asset, 100, "percent of current positions")
),
],
initial_value=10000,
supports_crypto=True,
supports_fractional_shares=True,
alerts_enabled=False,
dividend_policy='cash',
)
def backtest_btc_trend_pullback(client=None):
client = client or nt.NexusTradeClient.from_environment()
operation = client.create_backtest(
nt.backtest(
create_btc_trend_pullback(),
start_date="2024-01-01", end_date="2024-12-31",
interval="Day", baseline_symbol="SPY",
initial_value=10000, generate_events=True,
dividend_policy="cash",
fee_config={"Stock": {"type": "percent", "amount": 0.1},
"Cryptocurrency": {"type": "percent", "amount": 0.7},
"Option": {"type": "dollars", "amount": 0.65}},
),
idempotency_key="explore-btc-trend-pullback-2024-spy-v1",
)
return client.wait_for_backtest(operation["id"])
# Build locally: book = create_btc_trend_pullback()
# Run and inspect: completed = backtest_btc_trend_pullback(); print(completed["result"])
Create and backtest with TypeScript
TypeScript SDK 1.42.0. Save the runner below as run-btc-trend-pullback.ts.
Install and download
npm install nexustrade@1.42.0
npm install --save-dev tsx
export NEXUSTRADE_API_KEY="YOUR_API_KEY"
curl --fail --output btc-trend-pullback.ts https://nexustrade.io/seo/strategy-examples/btc-trend-pullback.ts
Create, test and inspect
import { createBtcTrendPullback, backtestBtcTrendPullback } from "./btc-trend-pullback";
async function main() {
const book = createBtcTrendPullback();
const completed = await backtestBtcTrendPullback();
console.log(completed.result);
}
main().catch((error: unknown) => {
console.error(error);
process.exitCode = 1;
});
Run
npx tsx run-btc-trend-pullback.ts
TypeScript strategy and backtest functions
View complete TypeScript SDK functions
The same rules, dates and fees are used in both SDKs. The backtest function keeps its request key across retries.
import * as nt from "nexustrade";
export function createBtcTrendPullback() {
const asset = nt.cryptoAsset("BTC-USD");
return nt.portfolio(
"Public SEO crypto example - BTC trend pullback",
[
nt.strategy(
"Enter BTC trend pullback",
nt.and(
nt.and(
nt.gt(nt.Price(asset), nt.SMA(asset, 200, "Day")),
nt.lt(nt.RSI(asset, 14, "Day"), nt.Value(40))
),
nt.eq(nt.PositionValue(asset), nt.Value(0))
),
nt.buy(asset, 95, "percent of buying power")
),
nt.strategy(
"Exit BTC trend pullback",
nt.and(
nt.or(
nt.gte(nt.RSI(asset, 14, "Day"), nt.Value(60)),
nt.lte(nt.Price(asset), nt.SMA(asset, 200, "Day"))
),
nt.gt(nt.PositionValue(asset), nt.Value(0))
),
nt.sell(asset, 100, "percent of current positions")
),
],
{ initialValue: 10000, supportsCrypto: true, supportsFractionalShares: true, alertsEnabled: false, dividendPolicy: "cash" }
);
}
export async function backtestBtcTrendPullback(client = new nt.NexusTradeClient()) {
const operation = await client.createBacktest(
nt.backtest(createBtcTrendPullback(), {
startDate: "2024-01-01", endDate: "2024-12-31",
interval: "Day", baselineSymbol: "SPY",
initialValue: 10000, generateEvents: true,
dividendPolicy: "cash",
feeConfig: {
Stock: { type: "percent", amount: 0.1 },
Cryptocurrency: { type: "percent", amount: 0.7 },
Option: { type: "dollars", amount: 0.65 },
},
}),
{ idempotencyKey: "explore-btc-trend-pullback-2024-spy-v1" }
);
if (typeof operation.id !== "string") throw new Error("Missing backtest ID");
return client.waitForBacktest(operation.id);
}
// Build locally: const book = createBtcTrendPullback();
// Run and inspect: const completed = await backtestBtcTrendPullback(); console.log(completed.result);
Completed 2024 backtest
This saved algorithm completed a Day backtest from 2024-01-01 through 2024-12-31, with $10000.00 starting capital. The chart includes all 744 exported history points.
Compare the strategy with SPY and BTC buy and hold. Each benchmark invests the full $10000.00 starting balance over the same 2024 period. SPY follows its trading sessions; BTC includes weekends. This algorithm follows its own allocation and entry/exit rules, with 0.7% of traded notional charged on each fill. Explore cash and position values to see how capital was deployed.
Scroll sideways to compare all columns. Select a heading to sort.
| Status | COMPLETE |
| Backtest return | -6.43% |
| Reported maximum drawdown | 20.62% |
| SPY buy-and-hold return | 25.30% |
| BTC buy-and-hold return | 119.27% |
| Total recorded trading fees | $2011.18 |
| Engine closed-trade count | 31 |
| Starting capital | $10000.00 |
| Ending portfolio value | $9357.49 |
| Ending cash | $438.95 |
| Ending position value | $8918.53 |
No matching rows. Clear the filter to see all records.
Inspect the recorded trades
Follow the Filled events by pair, side and time. Compare the submitted price, filled price, fractional quantity and fee. This table shows up to eight orders from the captured excerpt (47 Filled events); the download includes the entire excerpt.
For a percentage fee, multiply the traded notional by 0.007. To follow a position, start with a purchase and inspect subsequent sale quantities, remaining holdings and cash flows. For the weekly accumulation example, follow each purchase and the resulting position value.
Scroll sideways to compare all columns. Select a heading to sort.
| 2024-01-12T21:00:00.000Z | BTC-USD | Buy | 0.21733968539544338 | $43710.38 | $43710.38 | $66.50 |
| 2024-01-26T21:00:00.000Z | BTC-USD | Sell | 0.21581830759767529 | $41979.10 | $41979.10 | $63.42 |
| 2024-01-27T14:30:00.000Z | BTC-USD | Sell | 0.001521377797768092 | $41771.50 | $41771.50 | $0.44 |
| 2024-03-15T13:30:00.000Z | BTC-USD | Buy | 0.1337200380577867 | $67442.34 | $67442.34 | $63.13 |
| 2024-03-25T20:00:00.000Z | BTC-USD | Sell | 0.1327839977913822 | $71160.50 | $71160.50 | $66.14 |
| 2024-03-26T13:30:00.000Z | BTC-USD | Sell | 0.0009360402664045087 | $70730.99 | $70730.99 | $0.46 |
| 2024-04-02T13:30:00.000Z | BTC-USD | Buy | 0.14444388277913411 | $64849.37 | $64849.37 | $65.57 |
| 2024-04-07T13:30:00.000Z | BTC-USD | Sell | 0.14343277559968018 | $69402.56 | $69402.56 | $69.68 |
No matching rows. Clear the filter to see all records.
Understand this entry with Aurora
At 2024-12-18T21:00:00.000Z, the recorded rule was: BTC-USD last price > 200 Day BTC-USD SMA and 14 Day BTC-USD RSI < Constant 40 and Position market value (BTC-USD) = Constant 0. Its overall result was true. Read the individual comparisons below, then ask Aurora to explain how they led to the action.
The signal requested 95 percent of buying power at a submitted price of 100,844.8672. 1 captured Filled order shares this timestamp; Aurora receives those fields with the signal.
Scroll sideways to compare all columns. Select a heading to sort.
| BTC-USD price > BTC-USD 200 day SMA | 100,844.8672 | > | 69,711.9228 | True |
| BTC-USD 14 day RSI < constant | 39.8636 | < | 40 | True |
| BTC-USD position value = constant | 0 | = | 0 | True |
No matching rows. Clear the filter to see all records.
Inspect the original signal record
View captured signal JSON
{
"eventType": "BuySignal",
"event": {
"eventType": "BuySignal",
"timestamp": "2024-12-18T21:00:00.000Z",
"signals": [
{
"conditionName": "BTC-USD last price > 200 Day BTC-USD SMA and 14 Day BTC-USD RSI < Constant 40 and Position market value (BTC-USD) = Constant 0",
"audit": {
"type": "minimal",
"results": {
"0.0.1": {
"isTrue": true,
"lhsValue": 39.86359799892766,
"rhsValue": 40,
"lhsError": null,
"rhsError": null,
"comparison": "lessThan"
},
"0.0.0": {
"isTrue": true,
"lhsValue": 100844.8671875,
"rhsValue": 69711.92284665516,
"lhsError": null,
"rhsError": null,
"comparison": "greaterThan"
},
"0.1": {
"isTrue": true,
"lhsValue": 0,
"rhsValue": 0,
"lhsError": null,
"rhsError": null,
"comparison": "equal"
}
},
"failuresOnly": false
},
"isTrue": true,
"actionName": "Buy",
"actionMetadata": {
"buyOrSell": {
"targetAsset": {
"name": "BTC-USD",
"symbol": "BTC-USD",
"type": "Cryptocurrency",
"underlyingSymbol": null,
"optionType": null,
"expirationDate": null,
"strikePrice": null,
"multiplier": null
},
"allocation": {
"type": "percent of buying power",
"amount": 95
},
"price": 100844.8671875,
"orderType": "Market Order"
}
},
"orderExecution": {
"type": "Market"
}
}
]
},
"timestamp": 1734555600000
}Explore a drawdown period
The largest decline between exported snapshots was 19.30%, from $10511.34 at 2024-06-13T13:30:00.000Z to $8482.89 at 2024-10-23T20:00:00.000Z. The reported maximum drawdown is 20.62%. Explore the trades and holdings around those dates.
Scroll sideways to compare all columns. Select a heading to sort.
| 2024-06-13T13:30:00.000Z | $10511.34 | $453.37 | $10057.97 |
| 2024-10-23T20:00:00.000Z | $8482.89 | $370.19 | $8112.69 |
No matching rows. Clear the filter to see all records.
Download and explore the result
Download the exact strategy inputs, completed receipt, full history, fee settings and captured events. Detailed events remain available in the product for 3 days; this saved example stays readable.
Test another version
Change one rule or choose a different date range, then compare the resulting curve and trade events with this saved experiment. Explore which trades, fees and periods explain the difference.