← Charts & Marketplace

Bring your code: an equivalent FTScript, written by AI

Most traders who try a new charting platform already have a script they trust, written for something else. Rewriting it manually is slow and error-prone. Bring your code has an AI study what your script does and write an FTScript that does the same thing — which you then check before relying on it.

What it does, and what it does not

Bring your code takes an indicator or strategy you already use and produces an FTScript that behaves the same way on FNOTrader Charts.

It accepts code written as AmiBroker AFL, Python (pandas, TA-Lib or backtrader style), MT4/MT5 MQL4/MQL5, NinjaTrader NinjaScript, Pine Script, thinkorswim ThinkScript, or anything else such as MetaStock, TC2000 or EasyLanguage under “Other”.

The important word is equivalent. Nothing runs your original code, and nothing translates it line by line. The AI reads what your script does — which averages it compares, when it buys, when it exits — and writes FTScript that does that. It is a best effort. It is not a guaranteed one-to-one conversion, and the result can differ from the original. FNOTrader is not affiliated with any of the platforms named here; they are named only to describe where your code came from.

How it works, step by step

On the Bring your code page you choose what your code is, whether you want a Strategy or an Indicator with Buy/Sell signals, a name, and a symbol and timeframe to test on (it pre-fills from the chart you came from, otherwise NIFTY on 15 minutes). Then you paste the code.

There are two ways to get the FTScript:

Either way, the output also includes a plain-language note on what the FTScript does and anything that may not match your original exactly. Read that note first.

Bring your code: pick the source language, strategy or indicator, symbol and timeframe, paste the code, then create the FTScript.
Bring your code: pick the source language, strategy or indicator, symbol and timeframe, paste the code, then create the FTScript.

A worked example

Take a two-line AFL crossover:

Buy = Cross(EMA(C, 9), EMA(C, 21));
Sell = Cross(EMA(C, 21), EMA(C, 9));

An equivalent FTScript strategy computes the same two averages and enters on ta.crossover(ta.ema(close, 9), ta.ema(close, 21)), closing on the reverse cross.

Here is the check that matters. On the same symbol, timeframe and date range, count the signals on both platforms. Suppose your old platform shows 14 buys over the last three months and the FTScript shows 13. One missing signal is a lead, not a rounding error: find that bar. A common cause is how the first bars of an EMA are seeded, or whether the order fills at the signal bar’s close or the next bar’s open. Once the signals line up bar for bar, compare trade-level P&L.

How to check the result before you trust it

  1. Read the code. FTScript is short and readable. Confirm the lengths, sources (close versus hl2) and conditions are the ones you meant.
  2. Compare signals bar by bar on a period you know well, as in the example.
  3. Check the fill timing. FTScript fills market orders at the next bar’s open by default. If your original filled at the signal bar’s close, results will differ even with identical signals. See how FTScript tests a strategy.
  4. Check costs. Commission and slippage settings must match before P&L can.
  5. Only then add it to a live chart, and treat its signals as you would any new tool — carefully.

What may not have an exact equivalent

Some logic has no clean counterpart, and the AI is asked to say so instead of guessing:

Your code is sent only to the AI that writes the FTScript.

Where to find it

  1. On FNOTrader Charts, open Indicators and press Import code. The Bring your code page opens in a new tab with your chart’s symbol and timeframe filled in.
  2. Pick the language, Strategy or Indicator + Buy/Sell, and a name. Paste your code.
  3. Press Create equivalent FTScript, or connect your own AI and press Copy prompt.
  4. Open the saved script on the chart. It is also in Indicators → My scripts.

Common questions

Can I convert my AFL code to run on FNOTrader?

Your AFL code itself does not run here. AI studies what it does and writes an equivalent FTScript, which you then check against your original.

Is the FTScript guaranteed to match my original script?

No. It is a best effort. Results can differ, which is why you should compare signals bar by bar and check fill timing before trading with it.

Do I need my own AI account?

No. FNOTrader AI can write it inside the page. You can also use your own MCP-capable AI client, connected once.

Which languages can I bring?

AmiBroker AFL, Python, MQL4/MQL5, NinjaScript, Pine Script and ThinkScript are listed, and an Other option covers MetaStock, TC2000, EasyLanguage and similar.

Where does the finished script go?

It is saved to your account under Indicators, My scripts, and can be opened on any chart.

More on Charts & Marketplace

More in Charts & Marketplace · App: FNOTrader Charts · Definitions: glossary · All: every article