Okay, so you want to get going with algorithmic trading - and quick. You’re at the right place. This post will show you how to think about a first trading algo, how to write a small one in Python, and how ProfitView helps you run and monitor it.
This is not investment advice. The point is to learn the workflow: write down a rule, turn it into code, run it carefully, and use the results to improve.
What Is an Algo?
An algorithm is just a rule. A trading algorithm is a rule that decides when to buy, sell, reduce risk, or do nothing.
That means your first algo does not need to be clever. In fact it should not be. A beginner algo should be boring enough that you can explain it in one sentence:
If my decision score is positive, buy a small amount. If it is negative, sell a small amount. If it is close to zero, do nothing.
That is enough to learn the important parts: data, decision rules, order sizing, execution, risk, logs, and P&L.
Start With the Rule
Do not start by asking, “How do I place orders?” Start by asking, “What fact would make me want a position?”
Some beginner-friendly examples:
- Momentum: if price has been rising over the last few minutes, buy.
- Mean reversion: if price has moved unusually far above its recent average, sell.
- News sentiment: if fresh news is strongly positive for an asset, buy.
- Risk control: if my exposure is too large, reduce it.
For a first ProfitView trading strategy, it is useful to express the decision as a score from -1.0 to 1.0:
1.0means strongly long.0.0means neutral.-1.0means strongly short.
Your Trading code can then decide whether that score is strong enough to place an order.
Write the Smallest Useful Strategy
Here is a deliberately simple skeleton. ProfitView calls trade_update() when market trades arrive. The strategy filters for the venue and symbol you care about, calculates a score, logs it, and does nothing else:
from profitview import Link, logger
class Trading(Link):
VENUE = "your_exchange"
SYMBOL = "your_symbol"
def trade_update(self, src, sym, data):
if src != self.VENUE or sym != self.SYMBOL:
return
score = self.calculate_score(data)
logger.info(f"{score=}")
def calculate_score(self, trade):
return 0.0
This strategy does nothing because calculate_score() always returns 0.0. That is a feature, not a bug. Before a strategy trades, prove that it receives the market data you expect, writes useful logs, and points at the venue and symbol you intended.
Then add the strategy logic.
Add a Simple Rule
Here is a toy example using a tiny moving average. It is not a complete trading system, but it shows the shape of algo writing: collect data, compute a value, compare it with a threshold, and return a score.
def __init__(self):
super().__init__()
self.prices = []
self.last_order_side = None
def calculate_score(self, trade):
self.prices.append(trade["price"])
if len(self.prices) < 5:
return 0.0
recent_prices = self.prices[-5:]
short_average = sum(recent_prices[-3:]) / 3
long_average = sum(recent_prices) / len(recent_prices)
if short_average > long_average:
return 1.0
if short_average < long_average:
return -1.0
return 0.0
The important detail is not the moving average. The important detail is that the algo returns a bounded decision. The next step is deciding when that decision is strong enough to trade.
def trade_update(self, src, sym, data):
if src != self.VENUE or sym != self.SYMBOL:
return
score = self.calculate_score(data)
logger.info(f"{score=}")
if score > 0 and self.last_order_side != "Buy":
self.create_market_order(src, sym, "Buy", 1)
self.last_order_side = "Buy"
if score < 0 and self.last_order_side != "Sell":
self.create_market_order(src, sym, "Sell", 1)
self.last_order_side = "Sell"
This is intentionally tiny. A beginner strategy should never jump straight to serious size. Keep the order size small while you are learning how the code behaves, and add throttles before you let it run unattended.
Think in Layers
A useful trading strategy usually has four layers:
- Data: prices, trades, positions, news, balances, volatility, or anything else the strategy needs.
- Decision rule: the calculation that says buy, sell, or do nothing.
- Risk: limits on size, leverage, losses, symbols, and frequency of trading.
- Execution: the part that turns the decision into orders.
Beginners often mix these together. Try not to. If your decision code is separate from your risk code, you can change one without breaking the other.
Use ProfitView for the Boring but Important Work
The hard part of algo trading is not typing if price > average. The hard part is running code reliably against live markets and then understanding what happened afterwards.
ProfitView gives you a workspace for that:
- Write Python trading algos.
- Connect the exchanges and wallets you use.
- Monitor P&L, positions, and key metrics in realtime.
- Review trading history and export reports.
- Use logs to understand what your strategy believed at each decision point.
That feedback loop matters. You write an idea, run it small, review the evidence, then improve the idea.
A Good First Project
For a first serious exercise, build a strategy that does only one of these:
- Places tiny orders from a simple momentum score.
- Reduces exposure when volatility rises.
- Does nothing most of the time and only trades when a very clear condition appears.
- Logs a score for a week before you allow it to trade.
That last one is underrated. If your score would have behaved badly in observation mode, it would probably have behaved badly with money attached.
Getting Started
Sign up for ProfitView, connect the venue you want to monitor or trade, and create a small Trading strategy from the simplest possible template. Do not begin by trying to automate your entire trading life. Begin with one market, one symbol, one decision rule, and one risk limit.
Once it is running, spend time in ProfitView’s P&L and Positions screens. Ask the useful beginner questions:
- Did the strategy do what I expected?
- Did it trade too often?
- Was the order size sensible?
- Did the logs explain each decision?
- Would I be comfortable leaving this on while I am away from the screen?
If the answer to any of those is no, improve the algo before increasing size.
Algorithmic trading is not magic. It is a disciplined way to make your trading rules explicit. ProfitView helps you turn those rules into Python, run them, and learn from the results.
If you have any questions about the process described here or about ProfitView, we’d be happy for you to join our Discord server. Or email us at team@profitview.net and we will add you.