Original Summary: ℹ️ Info
This program evaluates rolling-target permutations across designated timeframes to calculate optimal return-on-investment parameters using the Daily Basics ruleset.
Calculations & Variable Dictionary
System Trading Rules:
- Required files: Upload daily CSV files for TQQQ, TECL, and SPXL. Each file should include Date, Open, Close, Volume, High, Low, lowFirst, and GapUp.
- GapUp: GapUp is read from the CSV. If it is blank or missing, it is calculated as Open / previous Close inside that same stock file.
- Buy Rule: When there is cash available, the engine compares that date's TQQQ, TECL, and SPXL GapUp values and selects the stock with the lowest GapUp. The existing xBuy trigger is then applied to that selected stock only.
- Sell Rule: The engine sells only the currently held stock. If TQQQ was bought, sell calculations use TQQQ data. If TECL was bought, sell calculations use TECL data. If SPXL was bought, sell calculations use SPXL data.
- Rule 1 (Same Day Sell): Valid for the day stocks are bought. If High < Target, no sale. Else if Close >= Target, sale executed. Else if lowFirst == 2, sale executed. Else, no sale.
- Rule 2 (Next Days Sell): Valid for subsequent holding days. If High >= Target, sale executed.
- Rule 3: Skip to the next day if a sell order is executed. No purchase is allowed on the same day a sale occurs.
- Strict Quarterly Requirement: If a quarter fails to meet the `Quarterly minSales Threshold`, all trades made during that quarter are reverted. If the portfolio was holding stocks at the beginning of the skipped quarter, those stocks are administratively sold at the skipped quarter's final closing price.
- Gap Liquidation Rule: If the user selects disjointed years (e.g., 2018 and 2022), the engine forces a liquidation of all held assets at the end of the year to prevent "time-travel" phantom gains.