MI Newsletter Trader 1.0.1-beta — October 15, 2026 Gmail → Google Apps Script → Alpaca This download contains working order-submission code for Free or Pro, Paper or Live. It starts paused. It is a beta template you run privately in your own Google account; MI does not receive your broker keys or operate your account. VERIFICATION The earlier private Free paper workflow read its Gmail test source and filled five $5,000 paper buys on October 15. Alpaca order IDs, quantities and prices matched Google's report. That was a present-price replay of October 8 signals, not historical performance. This generalized v1 package passed 48 automated tests with mocked Google/broker services across Free/Pro and Paper/Live, including shorts, covers, reversals, partial fills and interrupted requests. Saving it in the real Apps Script editor verified that Google recognizes the public functions. The generalized package has not been run through a fresh subscriber's authorization, a real Pro rotation or a live-money order cycle. Paper results do not establish live execution quality. FILES Code.gs — paste its complete contents over the starter code. appsscript.json — Google settings, including Gmail read-only, external requests and trigger management. README.txt — these instructions. Core.js, Runner.gs, test.cjs — inspectable source and mocked tests. fixtures/free-delta.json — dated historical parser fixture. Do not send it as a current newsletter or trade it. SETUP 1. Receive MI Free or Pro in Gmail. Free is Friday; Pro is daily. The script requires the new mi.newsletter.delta.v1 JSON footer. Welcome emails and older issues cannot substitute. 2. Use a dedicated, initially empty Alpaca account for this strategy and mode. Start with Paper to learn the process. Existing manually held positions are not imported. Do not share an account or this project with another trading automation. 3. Create a new private Apps Script project under the same Google account as Gmail. Use one project per account/tier/mode. 4. Paste Code.gs. Show the manifest in Project Settings and replace appsscript.json with the included file. Save. Verify Gmail API v1 under Services; add it if absent, reviewing Google's terms yourself. 5. Add the properties below in Project Settings → Script Properties. Values are text. Keep keys out of the code, chat, screenshots and public copies. 6. Select checkConnections and Run. Review the requested permissions yourself. This function only reads Gmail and the selected broker. Copy the returned accountId into EXPECTED_ACCOUNT_ID. 7. Run installSchedule. This creates a timer and leaves trading PAUSED. Free: Friday around 09:45 Eastern. Pro: daily around 09:45 Eastern. Google timing is approximately ±15 minutes. No exact opening-auction execution is promised. 8. Run previewLatestIssue. It reads the latest delivered issue with the new footer and shows the account, entries, owned exits, sizing references and limits without submitting orders. Wait for the next newly generated issue if the footer is absent. Current empty/review-only issues correctly show no actions. Preview is not a guarantee that later quotes, cash or borrow will be available. 9. Review the preview. Paper: run enablePaperTrading. Live: set LIVE_CONFIRMATION to I ACCEPT LIVE TRADING and run enableLiveTrading. Enabling submits no immediate order; the next scheduled run can submit real orders in Live. Do not run runScheduled manually unless you intend an immediate eligible trading cycle. 10. Review Executions and run showStatus to inspect the account, latest receipt and open orders. Set Google's trigger failure notifications to immediately in the trigger settings. No notification email is sent by the code itself. Run pauseTrading to remove this package's timers and stop future submissions. Pausing does not cancel accepted orders or sell holdings. SCRIPT PROPERTIES MI_TIER: free or pro. ALPACA_MODE: paper or live. ALPACA_PAPER_KEY + ALPACA_PAPER_SECRET: only for Paper. ALPACA_LIVE_KEY + ALPACA_LIVE_SECRET: only for Live. EXPECTED_ACCOUNT_ID: the exact accountId from checkConnections. This is not the account's display name. CAPITAL_PERCENT: your chosen percentage of total dedicated account equity used as strategy capital; greater than 0, at most 100. Required; no financial default is silently selected. MAX_ENTRY_PERCENT: your maximum new-entry percentage of total account equity. Required. The script pauses instead of scaling an oversized model signal. MAX_ORDER_DOLLARS: your maximum amount for a new order. Required; at least $1. Exit orders close owned positions and are not capped by this entry setting. MAX_GROSS_PERCENT: your maximum planned absolute long-plus-short exposure as a percentage of account equity. Free: no more than 100. Pro: no more than 200, with margin required above 100. This is a pre-trade estimate, not a guaranteed account exposure ceiling. ALLOW_SHORTS: false for Free. Pro needs true to execute short-entry signals and a margin-enabled account with available borrow. If shorts are disabled/unavailable, a short-containing issue pauses for review rather than silently omitting that leg. CASH_BUFFER_DOLLARS: your cash reserve; 0 if you choose no reserve. LIVE_CONFIRMATION: only for Live activation; exact value I ACCEPT LIVE TRADING. SIZING EXAMPLE, NOT A RECOMMENDATION A $100,000 dedicated paper account, CAPITAL_PERCENT=100 and a 0.05 model-equity entry reference produce a $5,000 intended entry. MAX_ENTRY_PERCENT and MAX_ORDER_DOLLARS must allow that amount or the run pauses. Choose your own limits for your account; do not copy a $100,000 paper setup into a smaller live account unchanged. WHAT THE CODE DOES It reads only the selected tier's dated newsletter, verifies Gmail's DKIM/DMARC evidence and the sender/subject, parses the explicit v1 JSON, ignores holdings and historical trades, and rejects ambiguous/corrected messages or unknown contracts. It stores a journal before each submission and uses stable account/tier/action client IDs. It closes only the exact tracked position episode. Exits must fill before entry sizing and submission. Existing positions are not topped up or rebalanced. Long entries use dollar-notional market day orders in fractionable, active US equities. Pro shorts use whole-share market day orders, rounding down using a fresh IEX ask plus a 3% sizing/buying-power allowance; IEX is not the consolidated NBBO. Shorts require broker permission and easy-to-borrow availability. Covers use the tracked quantity. Market prices can move, and notional/whole-share execution, short availability, costs and account limits can differ from the model. This version does not borrow cash for long entries. A Pro signal can therefore stop under your cash, gross-exposure or short restrictions; it does not promise exact replication of Pro research. Only new submissions between 09:30 and 10:45 Eastern on the signal's effective market session are permitted. Missing current mail is retried until the cutoff. Market holidays are checked against the broker clock; eligible future-session actions can wait for their intended open. Closed-market review issues contain no equity orders. No historical backfill is permitted. RECOVERY A rejected/canceled/expired order, unexpected holdings, corporate-action quantity change, missing permission, stale data or uncertain submission pauses the script. Inspect both Google Executions and Alpaca before proceeding. Partial fills remain real positions even when the final order fails. The script never automatically resends an ambiguous POST. reconcileAndResume can resume a same-session run only when its known orders are found and holdings reconcile; it may subsequently submit remaining orders. Missing ambiguous orders, expired runs and manual account changes require manual reconciliation. Do not delete the journal, reset the project or create a replacement automation to bypass this check. To change normal sizing limits after a completed run: pauseTrading, edit properties, installSchedule, previewLatestIssue, then enable the selected mode again. Mode, strategy and account changes require a separate project and dedicated account. Keep the existing project's journal for any remaining positions. Do not mix the new package into the older private Paper Two experiment. Data is saved in private Script Properties, in checksum-verified chunks. Editors of the project can read the credentials and state. Keep the project private. Google authorization, API availability and quotas apply; this is not a guaranteed always-on service. The journal retains owned episodes, the current run, recent deduplication records and the latest detailed receipt. The finite property quota can pause a large account; there is no silent ledger truncation. OFFICIAL REFERENCES https://docs.alpaca.markets/us/docs/authentication https://docs.alpaca.markets/us/docs/orders-at-alpaca https://docs.alpaca.markets/us/docs/fractional-trading https://developers.google.com/apps-script/guides/triggers/installable https://developers.google.com/apps-script/reference/script/clock-trigger-builder https://developers.google.com/apps-script/guides/services/quotas Research signals are not brokerage fills. Trading can lose money; short losses can exceed the initial proceeds. The user selects, owns and operates the automation. No return or execution outcome is promised.