{% extends "journal/base.html" %} {% load static %} {% block title %}Settings — Setup Log Pro{% endblock %} {% block content %}

Settings {% if app_version %}v{{ app_version }}{% endif %}

Trading Presets Charts Tags Commissions Database
{% if section == "presets" %}

Trading presets

{% csrf_token %}
{{ presets_form.risk_per_trade.label_tag }}
{{ presets_form.risk_per_trade }}
{{ presets_form.breakeven_threshold.label_tag }}
{{ presets_form.breakeven_threshold }}
{{ presets_form.default_stop_distance_r.label_tag }}
{{ presets_form.default_stop_distance_r }}
{{ presets_form.default_stop_distance_r.help_text }}
{{ presets_form.default_target_distance_r.label_tag }}
{{ presets_form.default_target_distance_r }}
{{ presets_form.default_target_distance_r.help_text }}
{% elif section == "charts" %}

Chart data source

Charts use Yahoo Finance by default (free, no signup, and — unlike Alpaca's free tier — complete 1-minute coverage, not just a single exchange's trades). It only keeps ~7 days of 1-minute history and ~60 days of 5/15-minute history, though data is cached permanently once imported, so this only matters if you import a trade after its window has passed. For those older trades, create a free Alpaca account (no funding required) and paste its API key/secret below — the app tries Yahoo Finance first, per symbol, at import time, and only falls back to Alpaca (up to ~1 year of history, but gappier — its free tier only sees IEX exchange trades) once Yahoo Finance no longer has the data.

{% csrf_token %}
{{ chart_form.alpaca_api_key.label_tag }}
{{ chart_form.alpaca_api_key }}
{{ chart_form.alpaca_secret_key.label_tag }}
{{ chart_form.alpaca_secret_key }}

Missing chart data

If a trade's chart data was never fetched successfully (a network hiccup, or the trade was imported before the provider had that day's data ready yet), it stays missing forever — nothing normally retries it. This checks every trade from the last 7 days for missing or daily-only chart data and retries it, trying Yahoo Finance first then Alpaca (if configured above) — same as a normal import. It's scoped to the last 7 days here as a quick check for recent fetch failures; older trades can often still be recovered too (Alpaca's free tier goes back roughly a year), just not from this button — use the same button on the Simulator page instead, where it checks whatever trades you've filtered to, with no day limit.

{% csrf_token %}

Run automatically

Runs this same check (last 7 days) on its own, without needing to click the button above.

{% csrf_token %}
{{ auto_backfill_form.auto_backfill_on_startup.label_tag }}
{{ auto_backfill_form.auto_backfill_on_startup }}
{{ auto_backfill_form.auto_backfill_daily_enabled.label_tag }}
{{ auto_backfill_form.auto_backfill_daily_enabled }}
{{ auto_backfill_form.auto_backfill_daily_time.label_tag }}
{{ auto_backfill_form.auto_backfill_daily_time }}
{{ auto_backfill_form.auto_backfill_daily_time.help_text }}

Polygon.io bulk backfill

A separate, opt-in data source from Yahoo/Alpaca above, and stronger than either: Polygon's data comes from the full consolidated tape (every market maker), not just one exchange, so it replaces a thin/undercounted bar (e.g. from Alpaca's IEX-only free tier) with a fuller one for the same minute, not just fills in bars that were missing outright. Downloads only the exact days you actually traded each symbol currently in your trades — never a wider date range, so no data is fetched for days you didn't trade that symbol. Runs in one detached background process — this can take a long time at the free tier's rate limit (5 requests/minute by default, one request per symbol/day), and keeps running even if you restart the app. Set your actual plan tier below so a trade older than your plan's history window is skipped up front instead of spending a real rate-limited request just to get an over-the-limit error back. If interrupted (e.g. the PC was shut down mid-run), clicking "Start backfill" again resumes the same job from where it left off instead of starting over. Get a free API key at polygon.io.

{% csrf_token %}
{{ polygon_form.polygon_api_key.label_tag }}
{{ polygon_form.polygon_api_key }}
{{ polygon_form.polygon_requests_per_minute.label_tag }}
{{ polygon_form.polygon_requests_per_minute }}
{{ polygon_form.polygon_requests_per_minute.help_text }}
{{ polygon_form.polygon_plan_tier.label_tag }}
{{ polygon_form.polygon_plan_tier }}
{{ polygon_form.polygon_plan_tier.help_text }}
{% comment %} "Save" listed first so it's the button an accidental Enter-key submit in one of the fields above triggers, rather than kicking off a potentially hours-long backfill - "Start backfill" already saves these same fields inline too, so a fresh key typed and started in one step still works without clicking Save first. {% endcomment %}
{{ polygon_tier_default_rpm|json_script:"polygon-tier-default-rpm" }}

Simulator

A standalone trailing rule (the "as its own system" combos on the Simulator page) defines its own 1R as the distance between your entry price and the rule's level at that moment. When that level happens to land only a cent or two from entry price by pure coincidence, dividing by such a tiny distance can turn ordinary price movement into a wildly inflated R multiple that isn't really telling you anything about the strategy. A trade whose distance is below this threshold is skipped for that combo instead.

{% csrf_token %}
{{ strategies_form.standalone_min_move_dollars.label_tag }}
{{ strategies_form.standalone_min_move_dollars }}
{{ strategies_form.standalone_min_move_dollars.help_text }}

Chart colors

Customize the trade-detail page's candlestick chart. Entry/exit are the triangle markers (shape already shows direction — up for long, down for short); Stop loss / Target are the dashed reference lines.

{% csrf_token %}
{% for field in colors_form %}
{{ field }}
{% endfor %}

Symbol watermark

Shows the trade's symbol as faint text on the chart itself.

{% csrf_token %}
{{ watermark_form.chart_symbol_watermark_placement.label_tag }} {{ watermark_form.chart_symbol_watermark_placement }}
{{ watermark_form.chart_symbol_watermark_font.label_tag }} {{ watermark_form.chart_symbol_watermark_font }}
{{ watermark_form.chart_symbol_watermark_color }}

Moving averages (MA / EMA)

Define as many SMA/EMA overlay lines as you want — each gets its own show/hide toggle on every trade's chart. "Default visible" controls whether a newly-seen indicator starts on or off there; either way it remembers the last toggle you set per trade page. The preview below uses your saved chart colors against sample data, so you can see the effect before checking a real trade.

{% for indicator in chart_indicators %}
{% csrf_token %}
{% csrf_token %}
{% empty %} No moving averages configured yet. {% endfor %}
{% csrf_token %}
{{ chart_colors|json_script:"preview-chart-colors" }} {{ chart_indicators_json|json_script:"preview-indicators" }} {% elif section == "tags" %}

Portfolios

{% for p in portfolios %}
{% csrf_token %} {{ p.name }}
{% csrf_token %}
{% empty %} No portfolios yet. {% endfor %}
{% csrf_token %}

Tags

{% for value, label, tags in tags_by_category %}

{{ label }}

{% for tag in tags %}
{% csrf_token %}
{% if tag.color %}
{% csrf_token %}
{% endif %} {{ tag.name }}
{% csrf_token %}
{% empty %} No {{ label|lower }} tags yet. {% endfor %}
{% endfor %}
{% elif section == "commissions" %}

Commissions

Set a default commission rate per share. It's applied automatically (quantity × this rate) to any newly imported trade that doesn't already carry its own commission value — existing trades are never changed retroactively, and you can always edit a trade's commission individually from its detail page.

Calculator

—
{% csrf_token %}
{{ commission_form.default_commission_per_share.label_tag }}
{{ commission_form.default_commission_per_share }}
Leave blank to not auto-apply any commission to new imports.
{% if commission_form.instance.default_commission_per_share %}
{% csrf_token %}
{% endif %}

Bulk apply to a portfolio

Sets commission = quantity × rate on every trade in the chosen portfolio, right now. This replaces whatever commission those trades already have, including any you set by hand — it does not just fill in blanks, and there's no automatic undo.

{% csrf_token %}
{% elif section == "database" %}

Database

Everything lives in one file, db.sqlite3 (currently {{ db_size_mb }} MB). These tools work directly on that file's data — take a backup before trying anything else here, and keep backups somewhere outside this folder (a cloud drive, a USB stick) since a backup stored next to the app doesn't protect you if the drive itself fails.

Backup

Downloads a complete, self-contained snapshot of the database as it is right now (safe to run while the app is in normal use — it doesn't lock anything). A copy is also kept in this folder's db_backups/ directory, listed below, so you can restore from it later without needing to find the downloaded file again.

{% csrf_token %}
{% if db_backups %}
{% for b in db_backups %} {% endfor %}
Backup Kind Size Created
{{ b.name }} {% if b.kind == "pre-restore" %}Auto (pre-restore){% else %}Manual{% endif %} {{ b.size_mb }} MB {{ b.mtime|date:"Y-m-d H:i" }}
{% csrf_token %}
{% else %}

No backups yet — click "Download backup now" to create the first one.

{% endif %}

Restore

Replaces everything currently in the database with the contents of an uploaded backup file — every trade, tag, and setting added since that backup was taken is permanently lost. The file must be a .sqlite3 backup produced by this app (it's checked before anything is touched, and rejected if it doesn't pass). A safety copy of the current database is always taken automatically right before the restore, so a restore can itself be undone by restoring that safety copy afterward — but nothing more recent than that automatic copy is ever recoverable.

{% csrf_token %}
{{ restore_form.db_file.label_tag }}
{{ restore_form.db_file }}
{{ restore_form.confirm.label_tag }}
{{ restore_form.confirm }}

Reindex & compact

Rebuilds the database's internal indexes (REINDEX) and reclaims space left behind by deleted rows (VACUUM), then runs an integrity check. Not destructive — nothing is added, removed, or changed about your trades — but it briefly locks the database (typically a few seconds; longer on a large trade history), so avoid running it while actively importing or editing. Worth running occasionally after heavy deleting or re-importing, or if the file feels larger than it should.

{% csrf_token %}
{% endif %} {% endblock %}