TradeZoro
Notifications

Mentis course

Lesson 5. Decisions and signals

35 min, foundation level

A condition is a true or false value for each bar. ta.crossover(a, b) is true on the bar where a moves above b.

//@zscript 1
indicator("Cross marks", overlay=true)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
plotshape(ta.crossover(fast, slow), "Up", shape.triangleup, location.belowbar, color.green)
plotshape(ta.crossunder(fast, slow), "Down", shape.triangledown, location.abovebar, color.red)

Use if / else to choose, and and, or, not to combine conditions. This lesson shows a rule on a chart. It is a teaching sample, not a trading system.

Exercises

  1. Add a filter. Only mark an up cross when close is also above a 100-bar SMA.
  2. Color the pane. Use bgcolor to tint the background green while fast is above slow.

Quick quiz

When is ta.crossover(a, b) true?

A cross is an event on a single bar.

What joins two conditions so both must be true?

and needs both.

Next lesson

Education only. Not financial advice. Examples are teaching samples, not trading results.

Zscript is coming soon

The manual opens when Zscript launches.

Back to home