Documentation/AlgoCode/Language

Dovee

Dovee is Laabh’s English strategy language — not Pine. Write when-rules, marks, risk, and session filters; we run them live on the same pipeline.

Chart Script → Dovee tab. The Pine tab stays for TradingView scripts. Add to Chart and Deploy work the same for both.

This page is the language tour. Every word and indicator — signature, parameters, return value, example — is in the function reference.

What a trader can write

strategy "EMA Cross"
long only
once
session 9:15 to 15:15

fastLen = input 9 as "Fast EMA"
fast = ema(close, fastLen)
slow = ema(close, 21)

plot fast as "Fast" blue
plot slow as "Slow" orange
fill fast, slow blue

when fast crosses above slow and bullish
  buy
  arrow up "Buy"
  label "Buy"
  paint green
when fast crosses below slow
  exit
  arrow down "Exit"
  alert "Trend flipped"

stop 10 points
targets 20, 40 split 50, 50

Entries

  • buy / sell / exit — long, short, flatten (exit only while in a trade)
  • long only / short only — opposite side becomes an exit
  • once — no second entry while already in a trade
  • session 9:15 to 15:15 — signals only in that clock window

Chart

  • Lines: plot fast as "Fast" blue
  • Band: fill fast, slow green
  • Level: level 70 as "Overbought" red
  • Marks: arrow up "Buy", label "Buy"
  • Tint: paint green inside when
  • RSI-style pane: put oscillator at the top

Conditions

  • crosses above / crosses below
  • is above / is below
  • close 1 bars ago previous bar (shorthand: close[1]); close rising
  • Candles: bullish, bearish, doji, hammer, engulfing, shootingstar, insidebar, pinbar
  • Clock: mondaysunday, hour, minute (chart timezone)
  • else after a when
  • alert "message" — notify without an extra order
  • Symbols work too: rsi(14) > 70, + - * /

Language basics

  • Comments: # or //
  • when is the usual word for a rule (if still works); plot is the usual word for a line (show still works); bodies can use indent, then, or { }
  • Math: round floor ceil sqrt log pow sign abs
  • Price also has time (bar unix seconds), hour, minute. Evaluation is on each closed candle, not ticks.
  • Also: change, replaceMissing (shorthand nz), barssince. na means not available — not enough bars yet (for example ema(50) on the first 49 bars).
  • Colors: green red blue orange purple gray grey white black yellow lime
  • Debug without trading: note "fast=" + fast (or debug)

Indicators

English names, not Pine ta.*. Same library as the chart indicators — HMA, Keltner, Donchian, Williams %R, AO, Ichimoku lines, and the rest. ema(9) means close. Supertrend is supertrend(10, 3) (ATR length, then factor). Multi-line tools: keltnerupper, macdsignal, tenkan. Full list with arguments: Dovee reference.

Knobs for the UI: fastLen = input 9 as "Fast EMA". The old word ask still runs (you will see a deprecation warning).

Inputs can also control stop, target, and trailing settings: stopPoints = input 10 as "Stop Loss", then stop stopPoints points; use target targetPoints points the same way. For a stepped trailing stop, use trailAmount = input 10 as "Trailing Steps" and trailBy = input 5 as "Trail By", then trailsteps trailAmount points and trail trailBy points. Multi-target targets 10, 20, 30 split 40, 30, 30 shows Target 1/2/3 and Split 1/2/3 in Inputs. You can also name them: tp1 = input 10 as "Target 1" then targets tp1, tp2, tp3 split 40, 30, 30.

Risk

  • stop 10 points or stop stopPoints points, stop 2 percent, or stop 2 atr (2 × ATR of 14)
  • target 20 points; for stepped trailing, trailsteps 10 points means the price must move 10 points, and trail 5 points moves the stop by 5 points each time. Without trailsteps, trail keeps following price at that distance.
  • Multi-target: targets 100, 200, 300 split 50, 30, 20 (those numbers are editable in Inputs as Target 1/2/3 and Split 1/2/3)

Live size and exchange still come from Deploy — not from the script. qty on the script is only a hint: if Deploy has a size set, that size is the one that is used.

Start with these 10

The reference lists every indicator. New traders can begin here:

  • emaFollow the trend; fast vs slow EMA crossovers.
  • smaA slower trend line — support and resistance.
  • rsiSpot overbought / oversold turns.
  • macdlineMomentum and trend change.
  • supertrendStay with the trend; trail with ATR.
  • atrMeasure volatility; size stops as stop 2 atr.
  • bbupperUpper Bollinger — stretch and mean reversion.
  • bblowerLower Bollinger — stretch and mean reversion.
  • vwapIntraday fair value vs the session average.
  • adxTrend strength (not direction). High ADX = a real trend.

Other projects

Copy lib/dovee. Each indicator lives in ta/ (ema, rsi, Supertrend, MACD, Bollinger, and the rest). Call evaluateDovee(source, candles)— no Pine runtime required. On Laabh charts we still compile to Pine so live orders stay on the existing pipeline.

Templates in the Dovee tab: EMA Cross, RSI, Supertrend. Next: Function reference · Deploy · Pine examples