shortPosition

The Short Position tool is a projection used when you expect the market to move downward. It displays your entry, stop-loss, and take-profit levels directly on the chart. Traders use it to plan risk–reward ratios and backtest trade management for bearish setups.

Syntax

shortPosition(time, price, styles?)

Parameters

time (number) · The bar time where the position starts. price (number) · The entry price for the short trade. styles (PositionToolOverrides) · Style and risk settings:

  • stopLevel (number) · Distance from entry up to stop-loss (in price units).

  • targetLevel (number) · Distance from entry down to take-profit (in price units).

  • riskReward (boolean) · Show the risk/reward ratio on the chart.

  • fillBackground (boolean) · Fill the short position area.

  • transparency (number) · Background transparency (0–100).

  • line (LinesLevels without coeff) · Border style (linestyle, linewidth, color).

  • background (RGBAColor | BaseColors) · Fill color for the projection zone.

Return Value

(string) · The drawing ID of the created Short Position.

Example

Every 50 candles, place a short position starting from a recent swing high with a defined stop and target.

Tips

  • Use recent swing highs as logical stops for short trades.

  • Keep a favorable risk/reward ratio (e.g., 2:1 or better).

  • Excellent for visualizing backtesting strategies where risk control is important.

Warning

  • Don’t make the stop level too tight; minor pullbacks could exit you too early.

Good Practice

  • Stick to a clear color scheme (red for shorts, green for longs).

  • Test different stopLevel and targetLevel values against volatility to ensure realistic setups.

Last updated