BT Trading · Help Center

BadTeacher Trading

A trading chart app: candlesticks, 49 indicators, a script editor, alerts, replay, about 90 drawing tools, watchlists and paper trading.

Crypto prices are live from Binance, Bitstamp, OKX, MEXC, Gate.io and Bybit.

Stocks, funds, futures, forex and indices come from Yahoo Finance.

Capital.com works too, once you add your own API key (see below).

What's in this folder

FileWhat it does
index.htmlThe page layout and styles (colors, sizes, positions)
app.jsMarket data, chart, timeframes, time zones, indicators on the chart, watchlist, search, paper trading
indicators.jsThe formulas for all indicators (RSI, MACD, Bollinger Bands, ...)
pine.jsRuns BadScript, the language you write in the Script Editor
account.jsSign in / create account, and saving your app data to your account
home.jsThe Home page (market summary, indices, crypto, stocks, news)
tools.jsThe Screener, Calendars (economic and earnings) and Heatmaps pages
cycles.jsThe Cycle Lows indicator (daily / weekly / yearly cycle lows and everything around them)
data/Made when the first account is created: the accounts and their saved data (private, not uploaded to git)
drawings.jsThe drawing toolbar on the left and everything you draw on the chart
serve.jsA small web server. It shows the page and fetches data from the exchanges, Yahoo, Nasdaq and Capital.com
logo.webpThe BadTeacher logo (the black-and-white drawing) in the header, browser tab, sign-in page, Home and Help. To change it, replace it with a new round image of the same name, then change logo.webp?v=2 to ?v=3 in the files so browsers load the new one
logo-bw.webpThe previous logo (the photo in black and white). To use it again, copy it over logo.webp
logo-color.webpThe original colour logo. To use it again, copy it over logo.webp
signin-flag.webpThe Vergina sun behind the chart on the sign-in page (shown in black and white). Replace it with another image of the same name to change it
signin-flag-photo.webpThe earlier flag photo for the sign-in page. To use it again, copy it over signin-flag.webp
package.jsonTells Node.js how to start the app (npm start)
.env.exampleTemplate for your Capital.com API key (optional)

The only program you need is Node.js (version 22.9 or newer). Nothing else has to be installed:

the chart library loads from the internet when the page opens.

Start the app (step by step)

1. Open the project in IntelliJ

2. Open the terminal inside IntelliJ

3. Check that Node.js is installed

Type this and press Enter:

node --version

You should see something like v26.13.0.

If you get "node is not recognized", install Node.js from https://nodejs.org (the LTS button),

then close and reopen IntelliJ and try again.

4. Start the app

Type:

npm start

You should see:

BadTeacher Trading: http://localhost:5173

5. Open it in your browser

Open Chrome/Edge and go to http://localhost:5173.

At the top right you should see a green dot and Live · Binance (or the source of the symbol you picked).

6. Stop the app

Click inside the terminal and press Ctrl + C.

Making changes

Using the chart

Data sources and credits

Open the account menu (the button at the top right: Sign in, or your name) → About & credits for the full list. In short:

Going live (a public app)

Step by step, for 0 €: see [deploy/GO-LIVE.md](deploy/GO-LIVE.md): a free Oracle Cloud server, a free DuckDNS web address and free HTTPS. deploy/make-package.ps1 packs the app, and deploy/setup-server.sh sets up the server with one command (public mode is switched on there for you).

Optional: Capital.com

Capital.com only shares prices with account holders, through an API key.

Keep .env private. It is listed in .gitignore so it is never uploaded with your code.

Optional: IC Markets (through cTrader)

IC Markets doesn't publish prices on its website. Its prices are available through the official cTrader Open API, using your own IC Markets cTrader account (a free demo account works). Setting it up takes about 10 minutes, once:

The sign-in is saved in .ctrader-token.json in the project folder (private, like .env; it is listed in .gitignore). If it ever stops working, open the connect link again. The app only asks cTrader for read-only access to your account information and prices; it never places trades.

Optional: alert emails

For Send email and Send plain text in an alert's Notifications, the app sends the emails through your own email account.

```

SMTP_HOST=smtp.gmail.com

SMTP_PORT=465

SMTP_USER=you@gmail.com

SMTP_PASS=the app password

SMTP_FROM=you@gmail.com

```

(Outlook: SMTP_HOST=smtp-mail.outlook.com and SMTP_PORT=587.)

Optional: CoinMarketCap Fear & Greed

Without a key, the Fear & Greed panel shows the free Alternative.me index (the panel says which one it shows).

To use CoinMarketCap's own index:

If something goes wrong

MessageWhat it meansFix
EADDRINUSE ... 5173The app is already running somewhereClose the other terminal, or press Ctrl + C there
bad option: --env-file-if-existsYour Node.js is older than 22.9Install the current LTS from https://nodejs.org
Badge says SimulatedThe page can't reach that symbol's price sourceCheck your internet connection and that you opened http://localhost:5173, not the file directly
Stocks say CLOSEDThe market is closed (evenings, weekends)Normal. Prices update again when the market opens
Capital.com sign-in failedA value in .env is wrongCheck the key, email and the key's custom password
IC Markets: could not connect (under the symbol search)The cTrader sign-in expired or the app isn't active yetCheck the app is Active at openapi.ctrader.com, then open http://localhost:5173/ctrader/connect again

Notes: Yahoo Finance data is free and unofficial, so it may be delayed up to 15 minutes.

Drawings, the watchlist, indicators, alerts, scripts and settings are saved in your browser. Paper trades reset when you reload the page.