Automated Trading Without Coding Skills: Split a Strategy into Four Building Blocks of Stock Selection, Entry, Exit and Position Control

TL;DR: You can do automated trading even if you are not good at coding by splitting a strategy into four blocks (stock selection, entry, exit and position control); each block is small and easy to understand, so they can be handled separately and recombined repeatedly.

Key ideas

  • Splitting a single trading program into four parts (stock selection, exit logic, entry logic and position control) makes each piece small and easy to understand, so the amount of code you must write yourself shrinks.
  • Stock selection can use the built-in selection module to tick price-volume and chip (institutional/shareholder flow) conditions; the speaker says this covers 80% of what you would imagine for stock selection, and screening for limit-up next-day trades needs no code at all.
  • The position control program only needs a per-order amount and runs on three variables: the entry condition, the exit condition and the order size; write it once and copy it into strategies with different logic.
  • Entry and exit conditions are each written as a function returning True or False, so they can be swapped and combined like building blocks; people who cannot code can ask someone to write them, and the position management program does not need to change.
  • After backtesting 6 months, a strategy built from simple blocks currently looks like it has positive expectancy; continuing to fine-tune the selection, entry and exit blocks and accumulating multiple sets makes it easier to find a fixed profit pattern.
量化交易科學園區 - 江加宏Length 16:04Quant Trading Science Park
Episodes
  1. Mon, Nov 28Custom SwingHighBar: Finding Perfect Peaks with Rising Left Side and Falling Right Side
  2. Sat, Dec 31Automatically Detecting an M-Top with XScript: Swing Highs, Neckline and Multiple Filter Conditions
  3. Thu, Mar 16Detecting Volume-Price Divergence with Code: Comparing Price and Volume at Two Swing Highs
  4. Wed, Mar 29Recreating the Day-Trading Three Lines and a Short Alert for Breakouts That Fall Back, Using XS
  5. Tue, Apr 11RSI Bearish Divergence Algorithm and Tolerant Sampling: Syncing Price Highs with Indicator Highs
  6. Thu, Apr 20Measuring Bullish Strength from a Single Candlestick
  7. Fri, Apr 28Manual Entry, Automatic Exit: Using XQ Semi-Automated Trading to Free Up Office Workers
  8. Sun, May 14Automated Trading Without Coding Skills: Split a Strategy into Four Building Blocks of Stock Selection, Entry, Exit and Position Control
  9. Mon, Jun 5Is a High-Volume Long Upper Shadow a Reversal or a Bullish Shakeout? A 3-Year Backtest
  10. Sat, Jun 17Picking Stocks at the Second-Wave Breakout: Big Prior Rally, Low-Volume Consolidation, Then a High-Volume Long Red Candle
  11. Wed, Sep 23Disposition stocks no longer pull back under the new rules: buy those that close strong on day 1 and sell on day 5
  12. Wed, Oct 7A Live Trading Strategy Under the New Disposition Stock Rules: Buy on Day 1, Sell on the Last Day, and Use Stop-Losses
  13. Wed, Oct 21Foreign Capital Rotates Into Defensive Stocks, and a Review of Live Disposition Stock Trades
  14. Wed, Oct 28SDT Shared Variables: Fixed Memory That Saves Resources and Lets Instruments in the Same Strategy Pass Data to Each Other
  15. Wed, Nov 4Disposition Stock Strategy Flips From Bull to Bear: Why It Is Paused When the Market Weakens
  16. Wed, Nov 18Auditing Online Course Strategies with AI: Out-of-Sample Backtesting and Building Your Own XQ Minute-Bar Database
  17. Wed, Nov 25Options Long Straddle Backtest: Trading It Every Day Loses Over the Long Run, With Chances to Profit Only in High-Volatility Periods
▶ Watch the original on YouTube
Ask AI about this episode

Copy the prompt, paste it into an AI service, and add the question. The AI reads the notes on this site and links to the page and the video timestamps.

Or open directly:ChatGPTClaudeGrokPerplexity

Section summaries

  1. 2:05Limit-Up Next-Day Trading and the Stock Selection Module

    Using the limit-up next-day trade (a stock hits limit-up today and is shorted the next day) as the example, the speaker does not write his own stock selection code but uses the built-in selection module to tick price-volume and chip conditions, saying this covers 80% of what you would imagine for stock selection. The demo filters out stocks with volume under 1000 lots, limits the price to between 10 and 150, and requires a limit-up yesterday, without writing a single line of code.

    ▶ Watch from here
  2. 5:05The Three Variables of the Position Management Program

    Position management only needs a per-order amount and runs on three variables: the entry condition, the exit condition and the order size. With no position and the entry condition met, it shorts; with a position and the exit condition met, it covers. Write it once and it can be copied and reused repeatedly.

    ▶ Watch from here
  3. 7:35Writing and Calling the Entry Condition Function

    The entry condition is written as a separate function that returns True or False to say whether it holds, and you note the function name so it can be called. The demo uses whether the stock can be traded intraday (day-trade eligible) as the entry condition; others, such as the closing price being above the 5-day moving average, can be added below it.

    ▶ Watch from here
  4. 9:15The Exit Condition Function and Block-Style Combination

    The exit function must also return a logical value. The demo includes exiting at a specified time, and keeping the current price no more than 1.08 times the reference price (a gain of no more than 8%) as protection against limit-up; multiple conditions can be chained with or. Entry and exit functions work like building blocks that can be written by someone else and recombined repeatedly. For example, you can write another entry condition that shorts only when the closing price is below the opening price, and to use it you just change the function name being called in position management.

    ▶ Watch from here
  5. 14:056-Month Backtest Results and Further Optimization

    Backtesting limit-up stock selection over the most recent 6 months, with at most one entry per day, the result currently looks like positive expectancy. Going forward, you can refine the selection, entry and exit blocks, accumulate multiple sets of entry, exit and selection strategies, and combine them yourself to find a fixed pattern that profits easily.

    ▶ Watch from here

This page summarizes the video; it is not an official transcript. Original video: Automated Trading Without Coding Skills: Split a Strategy into Four Building Blocks of Stock Selection, Entry, Exit and Position Control (量化交易科學園區 - 江加宏), copyright belongs to the original creator.