Order History Block: Complete Guide for Algorithmic Trading

The Order History block lets a trading strategy remember what it did last. Most indicators look at price. This one looks at your own trades. It reports the price, the age and the profit of a past order, so your rules can react to your own track record.

That is a different kind of input. It turns a strategy from a fixed set of signals into something that adapts to how its recent trades went.

What Does the Order History Block Do?

The Order History block is a utility block that reads one of your closed orders and outputs three facts about it. You choose which order by counting backwards. Order one is the most recent. Order two is the one before that, and so on.

For the chosen order, the block outputs:

You can also filter by side. Set it to buys only, sells only, or all orders. A strategy that wants “the last sell” and “the last buy” simply uses two blocks with different filters.

The block needs a trigger. Connect a Data Watcher or any other candle-driven signal to the trigger input. That tells the block when to refresh its reading. Without a trigger, it never updates.

What Happens When There Is No Order Yet?

Every strategy starts with an empty order book. The block handles this with safe default values. Price reads zero. Time elapsed reads 999,999 hours. Profit reads zero.

These defaults are deliberate. A rule like “only enter if more than 4 hours have passed since the last order” is true on the very first candle, because 999,999 is greater than 4. Your strategy can take its first trade without special handling. We cover the one trap this creates in the mistakes section below.

How Do You Read Order History Signals?

The block does not give buy or sell signals on its own. It feeds facts into your conditions. Three readings matter most.

Time since last order. This is the basis of every cooldown rule. Compare the hours elapsed with a fixed number. If the number is small, your strategy is trading frequently. If it is large, it has been quiet.

Profit of the last close. A negative value means the last trade lost. A positive value means it won. Two blocks set to orders one and two let you detect a losing streak.

Price of the last order. Compare it with the current price. If the current price is above the last buy, you are being asked to chase. If it is below the last sell, the market has moved against your exit. Both comparisons feed useful entry filters.

What Are the Best Order History Block Strategies?

Cooldown After a Loss

Revenge trading is the fastest way to turn one loss into three. The classic fix is a cooldown. Read the profit of the last sell. If it is negative, require that at least 12 hours have passed before the next entry. If it is positive, allow the strategy to re-enter immediately.

This gives you an asymmetric rule. Winners can compound. Losers trigger a pause. Our trade cooldown guide covers the reasoning in depth.

Anti-Chase Entry Filter

Trend strategies often re-enter at a worse price than they just exited. Read the price of the last sell. Only allow a new buy if the current price is at least 1% below that level, or if more than 24 hours have passed.

This stops the strategy from buying back the same move it just sold. It forces either a better price or a fresh setup.

Streak-Aware Position Sizing

Use two blocks. Set one to order one and the other to order two, both filtered to sells. If both profit readings are negative, halve the position size for the next trade. If both are positive, restore full size.

This is the opposite of a martingale system, which doubles after losses. Reducing size after a losing streak protects capital when a strategy has fallen out of sync with the market.

What Are Common Order History Block Mistakes?

Forgetting the trigger. The block only refreshes when something fires its trigger input. If your readings never change, this is almost always the reason.

Misreading the default. When no order exists, time elapsed is 999,999. A rule that says “enter only if fewer than 48 hours have passed” is false forever on a fresh strategy. Write cooldowns as “more than X hours”, not “fewer than X hours”, so the first trade can happen.

Expecting profit on buys. Profit % is zero for buy orders. A buy opens a position, so it has no result yet. Filter to sells when you want trade outcomes.

Confusing order count with trade count. A scaled entry with three buys and one sell is four orders. Order one is the sell, order two is the last buy. Count carefully, or use the side filter to skip the ones you do not want.

Over-fitting the cooldown. A 12-hour pause that looks perfect in one backtest may just match that period’s rhythm. Test a range of values. If only one works, the rule is fitted, not robust. Pyramiding rules built on last-order price have the same risk.

How to Build Order History Block Strategies in Arrow Algo?

Arrow Algo is a no-code visual builder. You drag blocks onto a canvas and connect them. An Order History rule takes four blocks.

  1. Data Watcher. Picks the exchange, pair and candle size. Its output feeds the trigger of the Order History block.
  2. Order History. Set the order index to one and the side to sell. Take the profit output.
  3. Condition. Compare profit with zero. The output is true when the last trade lost.
  4. AND gate. Combine the inverse of that condition with your normal entry signal. The entry only fires when the last trade did not lose, or when your cooldown has expired.

For the cooldown version, take the time elapsed output instead. Compare it with your pause length. Feed that into the same AND gate.

The Position Status block pairs well here. It tells you whether you are currently in a trade. Order History tells you how the last one went. Together they give a strategy full awareness of its own state.

Run a backtest. Then run the same strategy without the Order History rule. The difference in drawdown is the value the block adds.

What Are the Key Takeaways?

Disclaimer: This content is for educational purposes only and does not constitute financial advice. Trading involves significant risk and you should only trade with capital you can afford to lose. Past performance is not indicative of future results. Always conduct your own research before making any trading decisions.

Ready to build your own automated trading strategies without writing a single line of code? Start for free at Arrow Algo and join thousands of traders who've made the switch to systematic trading.