Mentis course
Lesson 1. Meet Zscript
25 min, foundation level
Zscript is the small language you use to build your own chart indicators on TradeZoro. You write a few lines, add them to the chart, and your idea is drawn on the candles. It is free for every member.
In this lesson you add your first script and learn what its four parts do.
//@zscript 1
indicator("My first line", overlay=true)
average = ta.sma(close, 20)
plot(average, title="20-bar average")
The four parts
- Header:
//@zscript 1says this is Zscript, version 1. - Declaration:
indicator(...)names the script.overlay=trueputs it on the price chart. - Logic:
average = ta.sma(close, 20)makes a value from the closing prices. - Drawing:
plot(...)shows it.
Press Add to chart and a line follows price. Change 20 to 50 and add it again: the line gets smoother. Changing a number and looking is how you learn.
Education only. Not financial advice. A line on a chart describes the past; it does not promise anything.
Exercises
- Add your first script. Paste the script above into the editor and add it to a chart. Then change 20 to 5 and to 100. Write one sentence about how the line changes.
- Rename and recolor. Change the title to your own name and add color=color.orange to the plot call. Add it again.
Quick quiz
What does overlay=true do?
overlay=true draws on the price chart. Without it the script gets its own pane below.
What must be the first line of every Zscript file?
The header line tells the editor which language and version this is.
Education only. Not financial advice. Examples are teaching samples, not trading results.
