Scripts
Your own indicators (scripts)
Create indicators in Navy — or let ChatGPT or Claude write them from your description — keep them in your account and share them with every Wintrading user.
Overview
A script is an indicator written in Navy, the language of the Wintrading charts. A script goes on a chart like a built-in indicator: on the price chart or in a pane of its own, with its own settings window.
Everything is in the indicator window of any chart (Coins, the heatmap, the constructor's charts, the trend screener), under the divider at the bottom of its list:
- My scripts — the scripts you created: switch them on and off, open them in the editor, publish, delete. Create with AI and Open editor are at the top.
- Community — the scripts other traders published: the search line on top searches them, sort them by popularity or by date, vote, put them on your chart, copy them into your scripts.
The script editor opens in a floating window over the page: move it by its header, resize it from its corner — it stays where you left it. ← Indicators in its header takes you back to the indicator window. On a phone it opens full screen.
New to the language? Navy: getting started explains how a script runs and walks you through your first indicator; then come the core concepts, what a script draws and the quick reference.
Create an indicator with AI
You do not need to code. ChatGPT or Claude writes the script; Wintrading gives them the language reference.
- In the indicator window open My scripts → Create with AI. The steps open right there.
- Describe what the indicator should show, in your own words — for example: «Mark breaks of market structure and label the price of each broken level». The examples under the field fill in typical requests.
- Press Copy the prompt: it holds the Navy reference and your description. Open ChatGPT or Claude (their buttons open them in a new tab) and paste it into a new chat.
- Copy the whole answer and paste it into the third step. The code is found in it and checked at once: you see its name, where it draws and what data it reads.
- Press Add to chart: the script is saved to your account, goes on the chart, and you are back in «My scripts» with its row lit. Open in the editor shows the code first, unsaved.
When the AI makes a mistake, the third step lists the errors: press Copy the errors for the AI, paste them into the same chat and paste the new answer back. One round usually fixes it. Closing the window by accident loses nothing: your description and the pasted answer are still there when you come back.
You can also attach the reference as a file: download the Navy reference (.txt) or copy it.
Bring an indicator from TradingView
An indicator you use on TradingView can come over if its code is open. ChatGPT or Claude rewrites it in Navy; Wintrading gives them the language reference and the porting task.
- On TradingView, open the indicator and press Source code
{}; select all of the code and copy it. Indicators with protected or invite-only code have no such button and cannot be ported. - In the indicator window open My scripts → From TradingView and paste the code. You see at once its name, author and inputs, and what Navy has no direct counterpart for — data of another timeframe (
request.security), strategy orders, tables — with what the AI does instead. - Press Copy the prompt and paste it into a new chat with ChatGPT or Claude. For a long script, download the prompt (.txt) and attach it to the chat.
- Paste the whole answer back. The code is checked at once: you see how many of the original's inputs it kept and what the AI could not port. Then Add to chart or Open in the editor.
Pasting TradingView code straight into the editor works too: a bar over the code offers Port with AI and takes the code into these steps.
What TradingView scripts are made of carries over as it is: blocks set by indentation instead of braces, parameters with the same name in different groups and parameters without a name (they sit in the row of the previous one, like a color next to its list). In the indicator settings the script's groups become sections, the same as in the original. What else differs from Pine, form by form: Navy and Pine Script.
The editor
Open editor in «My scripts» starts a new script: paste code into it or type it in. It is saved to your account on the first Save or Add to chart, named after its own indicator('…') / overlay('…') line — an editor closed empty leaves nothing behind. An existing script opens from its row in «My scripts» (</>), from its settings window or from «On the chart».
- Pasting a whole AI answer keeps only its code; pasting a whole script over another one replaces it (
Ctrl+Zbrings the old code back). - Update on chart (
Ctrl+Enter) runs the code on every chart that shows this script — even before you save. «The chart shows unsaved changes» reminds you of it. - Save (
Ctrl+S) keeps the code in your account; closing the window with unsaved changes asks first. - The header shows the state at a glance: Compiled, warnings or errors. Problems lists them — a click jumps to the line; On the chart shows an error that stopped the script while it ran. Fix with AI copies the code with its errors for the chat with the AI; paste its answer back into the editor.
- The name menu: New script, Open another script, Save as a copy, Rename, Publish, Delete.
Someone else's script opens read-only; Copy to my scripts makes it yours to change.
Completion, hover help, quick fixes and the keyboard shortcuts: The editor and its keys.
Data: liquidations, open interest, clusters, the book, densities
Besides the candles, a script reads Wintrading's own data — the same that drives the screeners and the heatmap. Write it with a dot: liq.long, walls.price(i); the editor completes the names and shows what each one means. A chart loads this data only while a script on it reads it.
| Name | What it is | Where it has data |
|---|---|---|
vol.buy, vol.sell, vol.delta | Taker volume of the bar by side and their difference, in coins | Every chart |
liq.long, liq.short, liq.total | Liquidated longs and shorts of the bar, in $ | Binance and Bybit futures |
oi.open, oi.high, oi.low, oi.close, oi.delta, oi.usd | Open interest of the bar in coins, its change over the bar (close − open) and the close in $ | Futures, minute bars and longer; the forming bar refreshes about once a minute |
fp.buy, fp.sell, fp.delta, fp.volume, fp.poc | Clusters (footprint) of the bar: aggressive buys and sells, their delta and sum, the price with the most volume | Exchanges the heatmap covers, for the bars it keeps |
book.bid, book.ask, book.imbalance, book.bidWall, book.bidWallSize, book.askWall, book.askWallSize | The order book at the bar from the density history: $ within 1% of the close per side, their imbalance, the largest bid and ask level and its size in $ | As the clusters |
walls.size(), walls.price(i), walls.usd(i), walls.side(i), walls.age(i), walls.dist(i) | The density screener's current densities: price, size in $, side (1 a bid, −1 an ask), minutes since it appeared, distance from the price in % | Symbols the screener tracks; live, no history |
na: check it with na(x) or replace it with nz(x). walls is a snapshot of now: read it on the last bar, inside if (barstate.islast) { … }.//@navy 2.0
indicator('Liquidations')
plot(nz(liq.long), { title: 'Longs', style: 'columns', color: color.red })
plot(-nz(liq.short), { title: 'Shorts', style: 'columns', color: color.green })To start from an example, open Create with AI: its examples include liquidation spikes, nearest density walls and delta divergence.
Every name with its unit: Navy reference → Wintrading data; how a script reads them: What a script can read.
Other timeframes and seconds
A script can read the candles of another timeframe of the same coin — higher (15m, 1h, 4h, 1D, 1W, 1M) or lower, down to seconds (1s, 5s, 15s on Binance futures) — with security(timeframe, () => expression). The expression inside the arrow is computed on that timeframe's own bars: its open, high, low, close, volume, every ta.* function and var. The result is a line (or a true/false condition) on your chart's bars.
//@navy 2.0
overlay('4h trend on any chart')
const tf = input.timeframe('Timeframe', '4h')
const ema = security(tf, () => ta.ema(close, 50))
const up = security(tf, () => close > ta.ema(close, 50))
const dayOpen = security('1D', () => open, { lookahead: true })
plot(ema, { title: 'EMA 50 ' + tf, color: color.orange, width: 2, style: 'step' })
plot(dayOpen, { title: 'Day open', color: color.gray, style: 'step' })
bgcolor(up ? color.new(color.green, 0.06) : na)- No repainting. On every bar of your chart the value is that of the last bar of the other timeframe that had closed by the end of your bar: an hourly EMA on a 5-minute chart changes on the bar that closes the hour, the same on history and live, and an alert on it never fires on a value that later disappears.
- The current bar of a higher timeframe —
{ lookahead: true }: the bar your bar is inside, even unfinished. Use it only for what is known at that bar's open: today's open (security('1D', () => open, { lookahead: true })), yesterday's high (high[1]). For the current day's high it would look into the future on history. - Seconds inside a bar. A lower timeframe gives the value of its last bar inside your bar:
security('1s', () => ta.highest(volume, 60))on a 1-minute chart is the largest one-second volume of the last 60 seconds that traded. - Compute everything inside. The arrow reads the script's constants and inputs, but not your chart's variables:
security('1D', () => ta.atr(14)), notsecurity('1D', () => atr)— the editor underlines that. Wintrading's data (liq,oi,fp…) is per bar of your chart and is not available inside. - Pine's
request.security(syminfo.tickerid, '60', close)works too, so scripts converted from TradingView keep their higher-timeframe parts. Other coins' data is not available.
What the arrow may read and how a body in braces ends: Navy → Other timeframes.
na. Seconds are built from Binance futures trades only: elsewhere a seconds timeframe reads na.Lines, boxes and labels
Besides plots and markers a script draws objects: line.new, box.new and label.new — a level from a swing to its break, a zone, a label with a price or a hint. x is a bar index (bar_index, may lie in the future), y a price. Text is built with +, str.tostring(x, 2) or str.format('{0} at {1}', …).
if (bosUp) {
line.new(swingBar, swingHigh, bar_index, swingHigh, { color: color.green, style: 'dashed' })
label.new(bar_index, swingHigh, 'BOS ' + str.tostring(swingHigh, format.mintick), { style: 'down', color: color.green })
}- Objects can be made anywhere — in
if, loops, functions. Keep them invarvariables or arrays (array.new<line>()) to move or delete them later:l.set(…),l.delete(). - Up to 500 of each kind per script; past that the oldest go first.
- On the live bar an object follows every tick instead of piling up copies.
Every option and method of the three objects: Navy reference → Drawing objects.
Alerts
A script notifies you with alert(condition, 'message') — for example alert(brokeUp, '{{ticker}}: structure broken up at {{close}}', { freq: 'close' }). Ask the AI to «add an alert» and it writes one.
- How it arrives. Like the app's own alerts: the pop-up (if pop-ups are on in the alerts settings), a sound, the voice and desktop notifications if you use them, and the bell's list. The message names the script, the coin and the bar.
- When. While a chart with the script is open in your browser, on live bars only — history and bar replay never fire. There is no Telegram or phone push for scripts yet.
- How often.
freq: 'bar'(default) — once per bar;'close'— when the bar closes with the condition (no false alarms from a wick);'all'— on every update, at most once per few seconds. The same alert of the same script on several charts of one coin and timeframe arrives once. - Placeholders.
{{ticker}},{{exchange}},{{interval}},{{close}}and the bar's other values are filled in the text. - Sound. The script editor's menu (the script name) switches the sound of script alerts on or off in this browser.
alertcondition(...) stays silent for now — there is no switch for it yet. Use alert(...).Where the call goes and how to raise an alert from inside an if: Navy → Alerts.
Publishing and review
To share a script, open its menu in My scripts → Publish…: give it a name, a description (what it shows and how to read it), a category, and confirm the rules. The data it reads is detected from the code.
Every publication is reviewed by the Wintrading team before it appears in «Community», usually within a day. The status is shown next to the script: Under review, Published or Rejected with the reason.
To change a published script, edit and save it, then Submit the update. The update is reviewed too: until it is approved, everyone keeps the previous version. Remove from community hides it again; it stays in your scripts.
Published code is open: other traders can read it and copy it into their scripts.
Votes and popularity
Every community script has 👍 and 👎, like the old YouTube. A thumb adds your vote; the same thumb again takes it back; the other thumb moves it. You cannot vote for your own script.
Vote where you see the script: on its row in Community, under its description when you open the row (Rate this indicator), and in On the chart for the community scripts you have on the chart. Voting needs you to be signed in. Your own published scripts show their votes in My scripts.
Popular sorts by likes minus dislikes, then by how many traders put the script on a chart (the number next to the people icon). New sorts by the date of publication.
Limits
- Pro and the trial keep up to 3 of your own scripts, Pro+ has no limit. Every script you own counts — private, under review, published and copies; deleting one frees a slot. The counter next to My scripts shows how many are taken. After moving to a plan with a lower limit your scripts stay and keep working — only new ones wait for a free slot.
- The code of one script is up to 256 KB.
- Scripts run in a separate thread: a script that loops for too long or asks for too much memory is stopped and marked on the chart, the chart keeps working.
- On a Trial the limit of 2 indicators per chart counts scripts too.
- Data beyond the candles has gaps by nature: liquidations only on Binance and Bybit futures, clusters and the book only for the bars the heatmap service keeps, densities only for the symbols the screener tracks (see Data).