Price action systems rely purely on candles — no indicators, no moving averages — just clean data from price itself. In this article, you’ll learn how to build a price action trading bot in Profectus.AI using a pattern detecting high probability price reversals.
What is the exact price action pattern?
The pattern is a three-candle star pattern that marks a potential trend reversal —
A Morning Star signals a reversal from bearish to bullish.
An Evening Star signals a reversal from bullish to bearish.
These patterns are most powerful when combined with zones of high liquidity or supply and demand areas, acting as the final confirmation for entering trades.
Defining the Pattern Logically
To automate the pattern, we translate the visual pattern into non-discretionary logic — meaning no human interpretation, only clear rules.
Morning Star Rules (Bullish reversal)
# | Condition | Description |
1 |
| The most recent candle closes above the “average” of the third last candle. |
2 |
| The second last candle closes below the fourth candle. |
3 |
| The fourth candle closes below the sixth candle. |
4 |
| The most recent candle is bullish. |
Evening Star Rules (Bearish reversal)
# | Condition | Description |
1 |
| The most recent candle closes below the midpoint of the third last candle. |
2 |
| Second last candle closes higher than the third. |
3 |
| Third candle closes higher than the fourth. |
4 |
| The most recent candle is bearish. |
5 |
| Second last candle is bullish. |
6 |
| Third last candle is bullish. |
Once all these rules align, the pattern is confirmed —
Morning Star → Buy Signal
Evening Star → Sell Signal
Building It in Profectus.AI
Let’s now turn this logic into a fully working system.
Start with “Run per Candle” — this ensures your bot checks the pattern at each candle close.
Add Trade Rule Blocks to encode each of the pattern’s conditions.
Use Candle ID references (0, 1, 2, etc.) for historical candles.
Connect them with green connectors to ensure all conditions must be true.
Once all conditions are true → connect to a Buy Now or Sell Now block, depending on the pattern.
Define a simple stop loss — for example, the low of candle
[2]for a Morning Star or the high of candle[2]for an Evening Star.Add a management style (like trailing stop or breakeven trail) to protect profits.
Optional but recommended: Use a Draw on Chart block to visualize when a pattern is detected — it’s great for debugging and confirming that your pattern logic works correctly in visual mode.
Example Visualization
You’ll see yellow-highlighted candles on the chart marking the last candle of the pattern — the one that triggers the entry. As soon as the candle [1] fulfills all the conditions, a trade is triggered on candle [0]. If you see no trades triggering, check with your Draw on Chart block to confirm which condition fails — red or black arrows can help pinpoint where logic stops.
Make It Your Own
Once you’ve built the Script pattern:
Add filters (e.g. RSI or EMA trend direction).
Adjust timeframes (daily for clean setups, 1H for more trades).
Combine with management templates to dynamically control exits.
Every pattern-based bot can become its own system when combined with management and timing logic.
