EnginePine Script

Getting started

Run a small native Pine indicator with visible averages and a named numeric signal.

Create a fresh app or Agent Lab experiment with one instrument and available historical bars. Put the following source in the PineScript editor or the Lab's Pine tab. Keep other execution layers disabled while checking its output.

Paste the indicator

PineScript
//@version=5
indicator("Guide: EMA signals", overlay=true)

fastLength = input.int(3, "Fast length", minval=1)
slowLength = input.int(8, "Slow length", minval=2)
fast = ta.ema(close, fastLength)
slow = ta.ema(close, slowLength)
longSignal = barstate.isconfirmed and ta.crossover(fast, slow)
shortSignal = barstate.isconfirmed and ta.crossunder(fast, slow)
pineSignal = longSignal ? 1 : shortSignal ? -1 : 0

plot(fast, "Fast", color=color.blue)
plot(slow, "Slow", color=color.orange)
plot(pineSignal, "pine.signal", display=display.none)

The indicator emits 1 for an upward crossing, -1 for a downward crossing, and 0 when neither occurs. The signal is hidden from the visible chart but retained as named plot output for a reader.

Run and inspect

Save the source and select a historical window that contains enough observations and a change in price direction. Look for the Fast and Slow lines. A window without a crossing can legitimately contain only zero signal values.

The documentation tests compile and run this source through the native Pine engine on deterministic falling/rising/falling bars. They verify plots, directional output, and the absence of strategy orders. Your selected market period need not produce the same sequence.

Understand confirmation

Historical evaluation treats supplied historical bars as confirmed. In live mode, confirmation depends on the interval's close boundary and current time. A changing open candle can therefore behave differently from completed historical input.

Confirmation does not validate provider coverage or imply that SJS has already seen the new Pine result in that same frame.

Choose the next step

This indicator does not request orders. Inspect plots and outputs, then use the SJS signal observer to verify consumption before adding execution logic.

Read supported features before importing a larger script.

On this page