Skip to content
Lokin
Paper trading
Sign in

AAPL and MSFT Keep Trending

byYaroslav Petrashko @yaroslavv1

TrendStocks

Enter a fixed-dollar long position at each upward SMA crossover close and exit it at the close five trading sessions later on AAPL, MSFT

0 net votes (0 up, 0 down)
Paper· creator · active
0.0%
Since Oct 6, 2026 · 25 trading days
Growth of $100 in the creator's own paper run of v1 (deposits and withdrawals don't count).

Holdings

No holdings right now: the run is all in cash.

The backtest result, the creator's paper run, and your own paper runs are separate sources and are never combined into one return.

About this agent

Trades AAPL, MSFT with one rule: enter a fixed-dollar long position at each upward SMA crossover close and exit it at the close five trading days later.. Positions are checked every day, with equal money in up to 2 names. Over the test period from 2019 to 2024 it returned +1%, with a worst drop of -1%. Simulated results with trading costs included; not a prediction.

The plan

Version 1 always runs exactly this plan. A change of any kind is published as a new version.

Buy rule
Enter a fixed-dollar long position at each upward SMA crossover close and exit it at the close five trading days later.
Show the exact rule

The calculation below is saved with this version and used when it runs.

Settings: end = 2024-09-25, start = 2019-09-26, notional = 10000 · uses 50 days of history

def signal(bars, params):
    start = params['start']
    end = params['end']
    notional = params['notional']
    state = bars.state.setdefault('active', {})
    result = {}
    if bars.phase != 'close':
        return result
    if bars.date < start or bars.date > end:
        return result
    for ticker in bars.symbols:
        hist = bars.history[ticker]
        due = state.setdefault(ticker, [])
        if bars.date in due:
            due[:] = [d for d in due if d != bars.date]
        if len(hist.close) >= 51:
            fast_now = hist.indicator('sma', 15, ago=0)
            slow_now = hist.indicator('sma', 50, ago=0)
            fast_prev = hist.indicator('sma', 15, ago=1)
            slow_prev = hist.indicator('sma', 50, ago=1)
            if fast_now is not None and slow_now is not None and fast_prev is not None and slow_prev is not None:
                if fast_prev <= slow_prev and fast_now > slow_now:
                    exit_date = bars.anchor('event', 5)
                    if exit_date is not None and exit_date <= end:
                        due.append(exit_date)
        price = bars.prices.get(ticker)
        if due and bars.equity > 0 and price is not None and price > 0:
            result[ticker] = len(due) * notional / bars.equity
        else:
            result[ticker] = 0
    return result
Stocks and ETFs
AAPL, MSFT
Position sizes
Buying only · equal money in each · up to 2 at a time · at most 100% in one · checked every day
Orders and costs
Orders fill at the next day's open · costs 0.10% of each trade
Test period
Sep 26, 2019 to Sep 25, 2024

Backtest at a glance

Return
+1.3%
Worst drop
-1.0%
Closed trades
22

See the full backtest result