Skip to main content

The Core Logic of Building Trading Systems on Profectus.AI

Building Your First Trading System from Scratch— The Core Logic and Components to build your own strategies from scratch

Before you start placing blocks and writing rules, it’s important to understand how a trading system’s logic flows inside Profectus.
Think of your trading system as a decision tree:

  • The trading system starts at the top of a tree and works its way downwards

  • At each block, it makes a decision — either Yes or No — and then follows the connected path

  • You can build one or multiple trees that run at the same time, each with its own purpose (buying, selling, managing trades, etc.)

How Blocks Work

Each block is like a self-contained instruction:

  • It waits for a trigger (when to run)

  • It checks a condition (true or false)

  • It performs an action (place trade, modify stop loss, etc.)

  • Then it passes control to the next block connected to it

Outputs:

  • One output point: Always “Yes” — if the logic inside is true, the next block runs

  • Two output points: Left = “Yes” path, Right = “No” path

  • No inputs (top blocks): These are triggers — they start the flow


Best Practice for Structure

You don’t have to link everything together in a single chain.
The best approach is to split your trading system into clear, separate trees:

  1. Buy logic and execution

  2. Sell logic and execution

  3. Trade management (e.g., trailing stop loss, closing trades)

This keeps your project tidy and makes testing and debugging much easier.


The 4 Main Parts of Any Strategy

Every trading system — no matter how simple or advanced — is built from these core components:


1. When to Trade (Triggers)

These blocks tell your trading system when to run its checks:

  • Run per tick → executes on every market price change

  • Run per candle → executes once per completed candle

Example: “Check the strategy rules once every 1 hour candle.”


2. Trading Rules (Logic Checks)

These decide if a trade should be taken:

  • Trade Rule block → compare market data, indicators, or prices

  • Example: “If the last candle closed above the Moving Average”

The block gives a Yes or No result and moves to the next step accordingly.


3. Trade Execution

These blocks open positions:

  • Buy Now / Sell Now → instant orders

  • Pending Orders → place trades that will trigger later

  • You can set risk per trade as a percentage of your balance


4. Trade Management

These blocks manage open trades:

  • Select Trades → choose which trades to work with

  • Check Profit/Loss → see if a trade is in profit or loss

  • Modify SL/TP → adjust stop-loss or take-profit

  • Close Trades → exit trades based on your rules

  • Chart Object → add visual markers or notes on your chart


Example: Splitting Logic into Trees

Let’s say your strategy buys when the Moving Average points up and sells when it points down.
You could have:

  • Tree 1: Buy rules + Buy execution

  • Tree 2: Sell rules + Sell execution

  • Tree 3: Trade management for both sides

Each tree runs independently but at the same time.


Backtest It

Before deploying anywhere, put your trading system through a backtest inside Profectus:

  1. Click TEST STRATEGY, top right of the builder canvas.

  2. Set your Project, Asset, Timeframe, and Date range (2015–2026).

  3. Click START BACK-TEST. It runs in the cloud, typically 2–15 minutes. Free users get 5 backtests per month.

The Backtests panel shows Net Profit %, PF, and Win Rate, and keeps every run for comparison. Click VIEW to open the full report as a PDF, or SEE CHART to see every trade drawn on the candlestick chart.
👉 Full guide here: How to Backtest on Profectus.AI


Deploying to MetaTrader 5

Once your trading system is ready:

  1. Download it from Profectus

  2. In MetaTrader 5: File → Open Data Folder

  3. Paste into MQL5 > Experts and compile

  4. Backtest it in Profectus, and when the numbers hold up, go live. See the backtesting guide.

👉 Full guide here: Exporting Your First Strategy


What’s Next?

This article is your high-level roadmap.
The next guides will go deep into each key area:

  • When to Trade → Triggers like Run per tick / Run per candle

  • Trading Rules → Mastering the Trade Rule block

  • Execution → Buy Now / Sell Now blocks

  • Management → Select Trades, Check Profit/Loss, Close Trades

Did this answer your question?