AlgoBarsX
A trading language
you can read out loud.
Write a trading idea in a few short lines. The same lines draw on your chart, test on past prices, send your alerts and place your trades. Write it once. Use it everywhere.
Trading involves risk of loss. AlgoBarsX is software. It doesn’t give financial advice or predict results.
strategy "EMA Cross"market: EURUSDbars: 15m input fast = 20input slow = 50 when crosses_above(ema(close, fast), ema(close, slow)):buy risk: 1%, stop: 25 pips, target: 2R when crosses_below(ema(close, fast), ema(close, slow)):close_allEMA Cross trades EURUSD on 15-minute bars. When the fast EMA crosses above the slow EMA, it buys at market, risking 1% of the balance, with a stop 25 pips from the entry and a target at 2R. When it crosses back below, it closes all trades.
Generated from the compiled script. If the English is wrong, the code is wrong.indicator "Trend Ribbon"pane: price input fast = 20input slow = 50 fast_line = ema(close, fast)slow_line = ema(close, slow) export up = fast_line > slow_lineexport strength = (fast_line - slow_line) / atr(14) plot fast_line as fast, color: if up then green else redplot slow_line as slow, color: grayTrend Ribbon is drawn over the price chart. It calculates a fast and a slow EMA, whether the trend is up, and its strength measured in ATR, and shares “up” and “strength” with other scripts. The fast line turns green in an uptrend and red otherwise.
Generated from the compiled script. If the English is wrong, the code is wrong.alert "Daily risk guard"check: every 1mrepeat: every timecooldown: 4h when history.today.pnl < -(2% of account.balance) or account.margin_level < 150%:notify "Daily P&L {history.today.pnl:$0.00}, margin level {account.margin_level:0}%"Daily risk guard checks every minute and waits 4 hours between alerts. When today’s closed P&L falls below −2% of the balance, or the margin level drops below 150%, it sends you a notification with both numbers.
Generated from the compiled script. If the English is wrong, the code is wrong.- Built-in functions
- 137
- Automated engine tests
- 678
- Bars a second in a backtest
- 195k
- A month, every feature
- $0
One script. Four places.
A rule means the same thing everywhere.
Every part of AlgoBars reads the same script, so a rule behaves the same on the chart, in a test, in an alert and in a live trade.
Plots, levels, boxes and marks drawn straight from the script.
Orders fill by 24 written rules, checked against 37 exact test cases.
How often it checks, repeats and stops is set in the script.
The same rules place and manage orders through your own broker account.
Sample data, for illustration.
Mistakes caught before anything runs
The compiler has your back.
AlgoBarsX checks every line before a single bar runs: wrong names, mixed-up units, a price where a distance should be. Each message says what’s wrong and how to fix it. Many fix in one click.
These are the compiler’s real messages. Each of its 50 diagnostic codes is stable: a code is never reused for a different meaning.
strategy "EMA Cross"market: EURUSD when crosses_above(emma(close, 20), ema(close, 50)):buy risk: 1%, target: 2Rtrail by: 25- E103A misspelled function
“emma” isn’t a function. Did you mean ema?
- E204A number with no unit
25 what? Pick pips or points.
- E305Risk with nothing to measure it from
A percent-risk order needs a stop before it can be sized.
Bring the scripts you already wrote
Paste it in. Get it back, checked.
AlgoBarsX reads scripts from other platforms, rebuilds them and checks that they work. Every line gets a note, and anything that can’t convert is flagged.
//@version=5strategy("EMA Cross", overlay=true)fast = input.int(20, "Fast")slow = input.int(50, "Slow")if ta.crossover(ta.ema(close, fast), ta.ema(close, slow))strategy.entry("Long", strategy.long)if ta.crossunder(ta.ema(close, fast), ta.ema(close, slow))strategy.close("Long")strategy "EMA Cross"market: EURUSDbars: 1h input fast = 20input slow = 50 when crosses_above(ema(close, fast), ema(close, slow)):buy size: 1 lot, tag: "Long" when crosses_below(ema(close, fast), ema(close, slow)):close_all tag: "Long"7 lines: 4 exact · 2 adapted · 2 decisions for you
- Exact
fast = input.int(20, "Fast")input() became an input - Adapted
if ta.crossover(…)an if that places orders became a rule - Your call
strategy.entry("Long", strategy.long)had no size of its own, so it became one lot: set the size or risk you want
Pine Script, MQL, NinjaScript, EasyLanguage and thinkScript are trademarks or products of their respective owners and are named only to describe compatibility. AlgoBars is not affiliated with, sponsored by or endorsed by any of them.
Risk is part of the grammar
One order, fully managed.
Percent, pips, R and dollars are real units here. Your stop, target and trade plan sit right under the order they belong to, so the whole plan is in one place.
Filled. The stop sits 1R below the entry.
buy risk: 0.5%, stop: lowest(low, 10) - 5 points, target: 3R:breakeven at: 1Rpartial 50% at: 2Rtrail by: atr(14) * 1.5, after: 2Rexit after: 60 barsMechanics only. A made-up path measured in R, not a result or a forecast.
The language
Simple on top. A full language underneath.
Size an order by what you are willing to lose
State the risk as a percent of the balance or as money, with the stop and the target. Position size follows from them, rounded down to the lot step. If the broker's minimum lot would carry more than you asked for, the trade is marked “above requested risk”.
buy risk: 1%, stop: 25 pips, target: 2Rsell risk: $200, stop: highest(high, 10) + 2 pips, target: lowest(low, 50)Name every confirmation
List what a setup needs, give each condition a name, and require all of them or at least some number. The backtest report then breaks trades down by which confirmations agreed.
confirmations long_setup:trend: ema(close, 50) > ema(close, 200)momentum: rsi(close, 14) between 55 and 70volume: volume > sma(volume, 20) * 1.5structure: break_of_structure(direction: up)require: at least 3Setups that happen in steps
A sequence waits for its steps in order, inside a bar limit, and resets if the idea is invalidated. Later steps can refer to the bar where an earlier step happened.
sequence liquidity_grab within 30 bars:step sweep: low < lowest(low, 20)[1]step reclaim: close > sweep.highstep retest: low <= reclaim.close and close > reclaim.closereset_if: close < sweep.lowSay when a rule may fire, on the rule
Every 4th time, skip the first 3, at most 2 a day, a 30-minute cooldown, once, inside named sessions, or between clock times in a named time zone. No counters to build by hand.
when setup.passed every 4th within sessions london, new_york:when starts(setup.passed) skip first 3 max 2 per day cooldown 30m:when grab.completed from 08:00 to 11:00 Europe/London:Market, limit, stop and Smart Orders
Pending orders can expire after a number of bars or a length of time. Size in lots or by risk. Opposite signals can be ignored, close the open trade, reverse it or hedge, and pyramiding and a minimum distance between entries are header settings.
buy limit: lowest(low, 5), size: 1 lot, expires: 10 barsbuy stop: high + 2 pips, risk: 0.5%, stop_loss: low - 2 pips, target: 2R, ghost: trueSet the limits where everyone sees them
Caps on open trades, trades per side, total risk, daily loss and drawdown sit in the header. When the daily limit is reached, open trades close, pending orders are cancelled and new entries wait for the next UTC day. A drawdown limit pauses the deployment until you resume it.
strategy "Language Tour"markets: EURUSD, GBPUSDmax_open: 3max_open_per_side: 2max_daily_loss: 3%max_drawdown: 10%trade_only: within sessions london, new_yorkRead other markets and other bar sizes
Higher bar sizes, other symbols, the 1-minute bars inside the current bar, and Renko, Heikin Ashi and X-Ray bars. A higher bar's value appears only once its candle has closed, and a script can ask how much data it actually has.
h4 = bars(bars: 4h)gold = bars(XAUUSD, bars: 15m)recent_high = intrabar(1m).high.max()spread_z = zscore(log(close_of(EURUSD) / close_of(GBPUSD)), 100)Run at the bar close, or on every tick
One header line switches a script to tick evaluation. Inside a forming bar prices are live while indicators hold their last closed value, so nothing repaints. When a backtest has no finer data for a bar, the run is labelled “approximate intrabar” and lists the bars affected.
strategy "Tick Scalper"market: XAUUSDbars: 1mevaluate: tickmax_open: 1 input max_stretch = 2.0 when crosses_above(close, vwap()) once per bar cooldown 2 bars:buy risk: 0.5%, stop: 30 points, target: 1.5R, ghost: true on tick:if not bar.confirmed and close < vwap() - atr(14) * max_stretch:close_all side: longAsk the account and the market directly
Balance, equity, margin, free margin and margin level, open positions and pending orders, today's and past results, plus each market's pip size, lot step, leverage tiers, sessions and next open. Useful for alerts that watch the account instead of the chart.
alert "Margin and exposure"check: every 5mrepeat: onceexpires: 30d when account.free_margin < 20% of account.equity or positions.len >= 8:notify "Free margin {account.free_margin:$0} with {positions.len} open positions"Alerts that carry their own rules
How often to check, whether to fire once, once per bar or every time, how long to wait between messages and when to expire are all written in the alert. Testing one shows the messages it would have sent and the ones it held back. Messages can include live values, and an alert can mark the chart where it fired.
alert "RSI bullish divergence"check: every 15mrepeat: once per barshow_on_chart: true input rsi_length = 14input lookback = 30 momentum_now = rsi(close, rsi_length)lower_low = low < lowest(low, lookback)[1]higher_rsi = momentum_now > lowest(momentum_now, lookback)[1] when lower_low and higher_rsi and was(momentum_now < 30, within: 5 bars):notify "Bullish RSI divergence on {market.symbol}: RSI {momentum_now:0.0}"Write an indicator once, use it everywhere
An indicator exports named values. A strategy or alert pulls it in by name and version, sets its inputs, and reads those values like any other, so a filter you trust is written once and never copied.
indicator "Trend Ribbon"pane: price input fast = 20input slow = 50 fast_line = ema(close, fast)slow_line = ema(close, slow) export up = fast_line > slow_lineexport strength = (fast_line - slow_line) / atr(14) plot fast_line as fast, color: if up then green else redplot slow_line as slow, color: grayReact to what happens
Run code on start, bar close, tick, fill, exit, session open, day change and render. Text in quotes can include live values with a format, such as a trade's result in R to two decimals.
on fill(order):log "filled {order.size}" on session open "new_york":log "New York is open" on exit(trade):log "{trade.tag} closed at {trade.r:0.00}R"Draw what the script sees
Plots, fills, lines, boxes, labels, Fibonacci levels, pitchforks, channels, volume profiles, heatmaps, tables and dashboards, plus a free-form canvas for anything else. Colours fade and blend by name.
fast_line = ema(close, 20)slow_line = ema(close, 50)plot fast_line, color: if fast_line > slow_line then green else red, width: 2fill fast_line, slow_line, color: green.fade(80)profile rows: 24, range: session, side: rightdashboard position: top_right, rows: [["Trend", "{bar.direction}"]]Simple on top, a full language underneath
Functions, your own types and enums, lists with filter and sort, loops, pattern matching and state that survives between bars. Libraries and indicators are versioned, and a script names the version it uses. There is one canonical layout: format a script twice and nothing changes.
use library "Quant Toolkit" v2 as qt enum Regime: trending, ranging, volatile fn swing_strength(len: int) -> number:up = highest(high, len) - closedown = close - lowest(low, len)return (down - up) / atr(14)In code, Smart Orders are written as ghost : true.
Rules the engine holds itself to
A backtest is only useful if it can’t cheat.
Our tests check these rules on every build. They describe how the software works, not how any strategy will do.
- What happens inside one bar
- When a bar touches both the stop and the target, the engine walks the 1-minute bars inside it in order. When finer data can’t tell, the stop fills. Never the flattering answer.
- No look-ahead
- A bar never sees a later bar. Tests change the future and check that the past didn’t move.
- Same answer every time
- The same script, inputs and bars give the same result, to the last digit.
- Higher timeframes stay honest
- A 4-hour value appears only after its candle closes. A 5-minute rule can’t peek early.
- A spent account stops the test
- When the test account runs out, the backtest ends there and says so.
- Costs are stated, not hidden
- Backtest profit is the raw price move. Spread, fees, swaps and slippage are left out, so live results will differ.
Backtest results are hypothetical and based on historical data. Past performance doesn’t guarantee future results.
From first draft to a live account
The Terminal around the language.
- A report that explains itself
- Breakdowns by the rule that opened each trade, how it ended, confirmations, side, tag and month, plus drawdown, MAE, MFE and the spread of results in R.
- Every run is kept
- Each run is saved with the code that produced it, so trying an idea never costs you the last one.
- Say it in plain English
- Type a description and a Convert to AlgoBarsX button writes the script for you to read and change.
- Share it open or sealed
- An open .abx file carries its code. A sealed one runs on someone else’s account without showing it, but still states what it does.
- Live runs wait for the broker
- A trade exists only once your broker confirms it, and an instruction is never sent twice.
- Edits to a live script are explained first
- Before you change a running script, the Terminal tells you what the edit would change.
Do I need to know how to code?
No. AlgoBarsX reads like a trading plan, and every script is turned back into plain English so you can check it says what you meant. Or let the AI write it for you.
What does it cost?
$0 a month, with every feature unlocked. Writing, importing and backtesting your own scripts is free and unlimited. If the AI writes or analyses a script for you, you pay only its compute cost. No credits. Each MetaTrader 4, MetaTrader 5, cTrader or external broker account you connect is $97 a month or $1,000 a year.
Will live results match my backtest?
No, and you shouldn’t expect them to. Backtests are hypothetical: they use past prices and leave out spread, fees, swaps and slippage. Past performance doesn’t guarantee future results.
Does AlgoBars hold my money?
No. AlgoBars is software, not a broker. It connects to your own account at a supported broker and never holds your money. We don’t give financial, investment or trading advice.
Can I bring my existing scripts?
Yes: Pine Script, MQL4 and MQL5, NinjaScript, EasyLanguage, thinkScript or Python. Each line gets a note, and anything that can’t convert is flagged.
More questions
Everything else you asked.
Answers to the other questions people ask about this.
Is backtesting free?
Yes. Backtests are free and unlimited on every account. Test any market and bar size we have data for. Profit is the raw price move, with no spread, fees, swaps or slippage added.
Can I share a strategy without showing the code?
Yes. Save it as a sealed .abx file. Others can run it but can't read the code. It still shows its name, what it trades, its inputs and a plain-English summary, so no one runs it blind.
What happens if a live strategy restarts?
Nothing is lost. The runner saves your open trades, stops and half-done setups. After a restart it warms up the indicators and picks up where it stopped. A trade only counts once your broker confirms it.
Write it once. Use it everywhere.
$0 a month. Unlimited backtests. No card.
Every feature, free. No card. No catch. · AI at compute cost only · Trading involves risk
