Build trading rules without Python or Pine Script
Dovee is Algocrab's English strategy language — write when rules, plots, risk, and session filters; run them on the chart. Open any chart, use the code editor, press Run, and plots appear on the candles. For TradingView-only signals, use AlgoCrab Bridge instead of coding.
This tour matches the public Dovee docs on charting.in. Algocrab-specific publishing, brokers, and live risk are under On Algocrab.
input lines. buy, sell, and exit already draw an arrow and fill price — do not duplicate with extra labels on the same rule. Use alert only for a custom message.Example — EMA cross
strategy "EMA Cross" long only session 9:15 to 15:15 fastLen = input 9 as "Fast EMA" slowLen = input 21 as "Slow EMA" fast = ema(close, fastLen) slow = ema(close, slowLen) plot fast as "Fast" blue plot slow as "Slow" orange fill fast, slow blue when fast crosses above slow and bullish buy when fast crosses below slow exit alert "Trend flipped" stop 10 points targets 20, 40 split 50, 50
Entries
buy/sell/exit— long, short, flatten (exitonly while in a trade)long only/short only— opposite side becomes an exit- One trade at a time for same-side adds — opposite signals flip direction. Use
re-entryor an input toggle to allow pyramiding. 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 - RSI-style pane: put
oscillatorat the top of the script - Optional marks:
arrow up "Breakout",label,paint greenon the bar
Conditions
crosses above/crosses belowis above/is below- History:
close 1 bars agoorclose[1] - Candles:
bullish,bearish,doji,hammer,engulfing, … elseafter awhen;alert "message"without an extra order- Expressions:
rsi(14) > 70, arithmetic+ - * /
Language basics
- Comments:
#or// whenis the usual rule word (ifstill works); bodies use indent,then, or{ }- Evaluation is on each closed candle, not ticks
nameans not enough bars yet;replaceMissing(nzshorthand)- Helpers:
change,barssince,valuewhen,mask - Debug:
note "fast=" + fast(ordebug)
Indicators
English names — ema(9), supertrend(atrLen, factor), rsi(14), not Pine ta.*. Anything the trader should tune from the UI is an input. Color a line with mask, not paint. Full signatures: Function reference.
Example — Supertrend
strategy "Supertrend Stop Target" atrLen = input 10 as "ATR Length" factor = input 3 as "Factor" st = supertrend(atrLen, factor) stUp = mask(st, close is above st) stDown = mask(st, close is below st) plot stUp as "Supertrend Up" green plot stDown as "Supertrend Down" red when close crosses above st buy when close crosses below st sell stop 2 points target 2 points
Multi-timeframe & levels
- HTF:
ema(close, 50) on 1h— last closed HTF bar only - Prior periods:
previous day high,previous week low - Session:
session high(needs asessionline) - Opening range:
openingRange = range 9:15 to 9:30thenopeningRange high timezone "Asia/Kolkata"for sessions and calendar buckets
Strategy state (simulated)
flat/long/short/in positionentry price,bars since entry,profit percent,trade count- Persistent:
state highestSinceEntry = na, assign insidewhen
Risk (script)
stop 10 points,stop 2 percent,stop 2 atrtarget 20 points,trail 5 points,breakeven after 10 pointstargets 5, 10, 15 split 40, 30, 30for partial exitsrisk 1 percentsizes quantity from capital and stop distance
On Algocrab, live broker SL/target and publish flow are documented in On Algocrab — Risk.
Canonical words
Prefer when, plot, exit, input. Aliases if, show, close (action), ask still run with deprecation warnings where applicable.
Start with these 10
ema— trend and crossoverssma— slower trend linersi— overbought / oversoldmacdline— momentumsupertrend— ATR trailatr— volatility;stop 2 atrbbupper/bblower— Bollinger bandsvwap— session averageadx— trend strength