Convert · thinkScript

Bring your thinkScript scripts. Keep your work.

You have spent years on your thinkScript scripts. You should not have to start again. Paste one in, and AlgoBarsX rewrites it and tells you what it did to every line.

  • $0 a month
  • No card needed
  • Not a trial

A real example.

This is a real run of the importer. The result compiles. It read 8 lines: 7 carried over exactly, 1 were adapted, and 0 came back as choices for you.

You paste this · thinkScript
1input fastLength = 20;
2input slowLength = 50;
3def fast = ExpAverage(close, fastLength);
4def slow = ExpAverage(close, slowLength);
5plot FastLine = fast;
6plot SlowLine = slow;
7AddOrder(OrderType.BUY_TO_OPEN, fast crosses above slow);
8AddOrder(OrderType.SELL_TO_CLOSE, fast crosses below slow);
You get this · AlgoBarsX
1strategy "Imported study"
2market: EURUSD
3bars: 1h
4
5input risk = 1%
6input fastLength = 20
7input slowLength = 50
8
9fast = ema(close, fastLength)
10slow = ema(close, slowLength)
11
12when crosses_above(fast, slow):
13buy risk: risk, stop: atr(14) * 2, target: 2R
14
15when crosses_below(fast, slow):
16close_all side: long
17
18plot fast as FastLine
19plot slow as SlowLine
StatusYour lineWhat happened
Exactinput fastLength = 20the input fastLength carried over
Exactinput slowLength = 50the input slowLength carried over
Exactdef fast = ExpAverage(close, fastLength)fast carried over
Exactdef slow = ExpAverage(close, slowLength)slow carried over
Exactplot FastLine = fastthe plot FastLine carried over
Exactplot SlowLine = slowthe plot SlowLine carried over
AdaptedAddOrder(OrderType.BUY_TO_OPEN, fast crosses above slow)thinkorswim sizes an order by the chart settings, so this one risks a set share of the balance with an ATR stop: set the size you want
ExactAddOrder(OrderType.SELL_TO_CLOSE, fast crosses below slow)a closing order carried over

How the ideas translate.

In thinkScriptIn AlgoBarsX
input fastLength = 20;input fastLength = 20
def fast = ExpAverage(close, fastLength);fast = ema(close, fastLength)
plot FastLine = fast;plot fast as FastLine
fast crosses above slowcrosses_above(fast, slow)
AddOrder(OrderType.BUY_TO_OPEN, cond)when cond: with buy under it
AddOrder(OrderType.SELL_TO_CLOSE, cond)when cond: with close_all side: long under it
yes, notrue, false
BarNumber()bar.index

thinkScript orders carry no stop or size, so the import adds a risk input with a stop of two ATRs and a 2R target. Check those three numbers before anything else.

How to move a script.

  1. Paste or upload

    Open the Terminal, choose Import, and paste your code or pick the file.

  2. Read every note

    Each line is marked exact, adapted, or your call. Settle every “your call” before you go on.

  3. Read it back, then test

    Check the plain-English description against what your old script did. Then run a test.

What you gain.

It reads itself back

The compiler writes out what the script does in plain English.

Units are real

Percent, pips, R and money are types. Mix-ups are caught before anything runs.

One script everywhere

The same file draws, tests, alerts and trades.

Always read an import before you run it. No converter is perfect, and some shapes of code import better than others. Other platforms leave things unsaid that AlgoBarsX makes you state, such as the market, the bar size and the trade size. Compare the plain-English description with what your old script did, and test before you deploy.

Good questions.

Will every script convert cleanly?

No. Simple, common shapes convert best. An import that does not compile says so, and every changed line carries a note. Always read the result.

Do I lose my original?

No. Your old script is untouched. Lines that needed a choice keep the original as a comment.

Is it free?

AlgoBars is $0 a month with no card. Credits pay for AI, tests and auto trades.

Try it with one script.

Pick a small one. Paste it in. Read what comes back.

Create my free account

$0 a month · No card needed · Not a trial

Trading is risky. You can lose money. It is not right for everyone.