← Back to the Academy
Adept · Bonus · Hands-On

Pine Script → Paper Trade

Turn a TradingView indicator into live paper trades on CryptoLwa, end to end — no real money, and no code experience needed to start.

⚠ Requires a TradingView account Pine scripts do NOT run on CryptoLwa. They load into TradingView.com — a free account works. CryptoLwa gives you the scripts and teaches you to use them there; TradingView runs them and fires the alerts that travel down the pipeline below.
THE PIPELINE

How the Whole Thing Connects

A green signal travels from your chart all the way to your scoreboard.
🧠
Pine Script
the brain
📈
TradingView
where it runs
📡
Webhook
the messenger
Lasirèn bridge
paper sim
📊
Paper Trade
scoreboard
Going deeper — why the chain is built this way

This pipeline is an example of a beautiful engineering idea: separation of concerns. Each stage does exactly one job and hands a clean baton to the next. Pine Script only decides; TradingView only runs the decision against live candles; the webhook only carries the message; the Lasirèn bridge only simulates the fill; Paper Trade only scores. Because the pieces are decoupled, you can improve your strategy without touching the plumbing, or swap the venue without rewriting the logic. The glue between them is a tiny packet of JSON — just labeled text like {"action":"long"} that both sides agree to speak.

The ten-year-old versionThink of a relay race. The brain (Pine) figures out when to run, then passes a baton to a runner (the webhook) who sprints it to the next teammate (the bridge), who hands it to the scorekeeper. Nobody tries to do everyone's job — each teammate is great at one thing, so if one gets faster, the whole team wins.

The single most important word in this whole chain is paper. Every fill is imaginary — real market prices, pretend money. That's not a limitation; it's the entire point. You get to be wrong for free, over and over, until the numbers earn your trust. Real funds move only at your explicit request, with your final say on every trade.

STEP 01

What Is Pine Script?

TradingView's simple language for indicators & strategies.

Indicators draw lines and signals on a chart; strategies are rules that simulate buys and sells. You don't need to be a coder to start — load a ready-made script and press play.

Explain like I'm 10Pine Script is a recipe you hand to a robot chart. The recipe says "if the fast line crosses above the slow line, shout BUY." The robot watches the chart 24/7 and shouts for you.
Going deeper — how Pine actually "thinks"

Pine has one quirk worth understanding: it runs once per candle, left to right across history, as if reliving the chart bar by bar. On each bar it can see the past but never the future — a safeguard against fooling yourself. The trap that ruins beginner strategies is repainting: a signal that looks perfect on history because it secretly used information that wasn't available yet in real time. A backtest that repaints is a mirage — it "predicts" moves it actually peeked at. Honest Pine waits for a bar to close before trusting a signal, which is why barstate.isconfirmed and closed-candle logic matter so much.

The ten-year-old versionImagine grading your own homework, but you're only allowed to use what you knew before you saw the answer key. Repainting is like sneaking a peek at the answers and then bragging you got them all right. It feels great until the real test — the live market — where there's no answer key to peek at.

This is also why the difference between an indicator and a strategy matters. An indicator just draws — lines, labels, alerts. A strategy simulates actual buys and sells and produces a strategy tester report you can grade. For CryptoLwa, the ready-made scripts like MAZAKA and GEDE4 are pre-shaped so their honest, closed-bar alerts drop straight into the webhook — no peeking, no repainting.

STEP 02

Load a Script on TradingView

Paste, save, add to chart.
Heads-upSending alerts to a webhook needs a paid TradingView plan. On the free plan you can still run the script and get email/popup alerts — then place the paper trade manually on CryptoLwa.
Going deeper — reading the strategy tester before you trust it

When you add a strategy to a chart, TradingView runs it across all visible history and hands you a strategy tester report — and learning to read it skeptically is the whole game. The headline number is net profit, but that's the least trustworthy figure. Look instead at number of trades (fewer than ~30 and the results are noise), max drawdown (the worst peak-to-valley pain you'd have had to sit through), and profit factor (gross wins ÷ gross losses; above 1.5 is respectable). A strategy that made money on three lucky trades has proven nothing at all.

The ten-year-old versionIf someone says "I'm great at basketball, I made 2 out of 2 shots!" you'd laugh — two shots proves nothing. But "I made 300 out of 500 over a whole season" means something. A backtest is the same: a handful of wins is bragging; hundreds of trades across good times and bad is evidence.

Two silent killers hide in pretty backtests. The first is ignoring fees and slippage — a strategy that trades constantly can look brilliant until real costs eat every edge. The second is overfitting: tuning the inputs until the strategy perfectly fits the past, which almost guarantees it breaks on the future. The cure is exactly what this lesson builds toward — prove it forward in paper, on data the strategy has never seen, before you believe a single number.

STEP 03

Wire the Alert into CryptoLwa

Right-click → Add alert → your script → Any alert() call.

Then set the webhook destination and the message — a short JSON that includes your secret token:

Webhook URL
https://www.cryptolwa.io/api/gede4/webhook
Alert message (JSON)
{ "token": "<your GEDE4_WEBHOOK_SECRET>", "symbol": "{{ticker}}", "action": "long", "price": {{close}} }
Going deeper — what a webhook is, and why the secret token matters

A webhook is just an automatic phone call from one program to another. When your alert fires, TradingView makes an HTTP POST — it "phones" the URL you gave it and delivers your JSON message. The receiving end (CryptoLwa) picks up, reads the message, and acts. There's no polling, no waiting; the event pushes itself the instant it happens. That's why it's near-instant compared to a program that has to keep asking "anything new yet?"

The ten-year-old versionInstead of you checking the mailbox every five minutes to see if a letter came, a webhook is a doorbell: the moment there's news, it rings and hands the message straight to you. Faster, and you never miss it.

But an open doorbell anyone can ring is dangerous — a stranger could push fake "BUY" signals into your account. That's the entire job of the secret token in the JSON. It's a shared password only you and the site know; the webhook checks it on every message and ignores anything without the right token. This is why you never paste your GEDE4_WEBHOOK_SECRET into a public place, and why CryptoLwa verifies it server-side before a signal is allowed to touch even the paper engine. Authentication first, action second — always.

STEP 04

Trade It in Paper Trade

A flight simulator for trading — pretend money, real lessons.
Going deeper — why paper trading is real practice, not a toy

The point of paper trading is forward-testing: proving a strategy on data it has never seen, in real time, as the future unfolds. A backtest can be quietly overfit to the past; a forward paper run can't cheat, because tomorrow's candles genuinely don't exist yet. The bridge simulates the swap using live market prices so your fills reflect real conditions — spread, timing, the whole texture of the market — just without real money at risk. That's the closest thing to live trading that can't hurt you.

The ten-year-old versionIt's a flight simulator. A pilot doesn't learn to fly by reading about old flights (backtesting) — they climb into a simulator that behaves exactly like a real plane, crash a hundred times for free, and only fly passengers once the simulator says they're ready. Paper trading is your cockpit before the real skies.

Paper trading also trains the part of you that's hardest to fix: your own behavior. It reveals whether you'll actually let a strategy run without fiddling, whether you can sit through a drawdown, whether you respect the exit plan. The one honest limit to remember — paper trading can't fully reproduce the emotion of real money, so real capital always deserves extra caution and, on CryptoLwa, your explicit final say on every trade.

STEP 05

Monitor Your Progress

Read the scoreboard like a scientist.

Your blotter and the agent journal track open & closed positions, win rate, average win/loss, expectancy, and drawdown — all computed from your closed paper trades.

The honest barOne good trade proves nothing. Look for positive expectancy over 20+ closed paper trades before you trust a strategy. Then tune one input, re-test, and compare.
Going deeper — the scoreboard metrics that actually matter

Reading your blotter like a scientist means knowing which numbers carry weight. Win rate is the most overrated — you can win 40% of the time and still be hugely profitable if your winners dwarf your losers. The number that ties it all together is expectancy: on average, how much do you make (or lose) per trade? A positive expectancy over a real sample is the only proof that matters. Pair it with the average win vs. average loss ratio and max drawdown, and you have an honest portrait of the strategy's character — not just whether it won, but how it won and what it cost you emotionally.

The ten-year-old versionWinning a lot of tiny games but losing a few huge ones can still leave you broke. What matters isn't how often you win — it's whether, after adding up every win and subtracting every loss, you end each round a little richer on average. That average-per-round is the only score that tells the truth.

The final discipline is change one thing at a time. If you tweak three inputs at once and results improve, you'll never know which change helped — or whether you just got lucky. Adjust a single dial, re-run over 20+ closed trades, and keep the change only if the data clearly backs it. This is the scientific method wearing a trader's hat, and it's exactly the loop MAZAKA uses to improve itself: hypothesis, test, measure, keep or discard.

That's the whole loop: Pine decides, TradingView runs, the webhook carries, the bridge simulates, the scoreboard judges. Practice in paper until the numbers earn your trust — and real-money trading happens solely at your explicit request, with your final say on every trade.
← Back to the Academy Paper mode only · not financial advice · no real funds
Listen to this class · Narrated by Elena
0:00 / 4:19