TurboCapitalTurboCapital

SierraChart Indicator

AutoPosSizeAndSLTP

Position Sizing + Order Entry + Risk Management. One Study.

AutoPosSizeAndSLTP

AutoPosSizeAndSLTP indicator screenshot

Automatic position sizing with integrated order entry, stop-loss, profit targets, and breakeven management.

Overview

AutoPosSizeAndSLTP calculates optimal position size based on market volatility (ATR) and provides one-click/one-key order entry with automatic bracket orders. Think of it as a complete trading execution system that:

  1. Sizes positions based on current volatility
  2. Sets stops and targets in dollar amounts (not ticks)
  3. Manages risk with automatic breakeven moves
  4. Executes trades via menu or keyboard shortcuts

Key Features

Volatility-Based Position Sizing

  • Uses Average True Range (standard or volume-weighted)
  • Higher volatility = smaller position size
  • Lower volatility = larger position size
  • Respects min/max position limits

Dollar-Based Risk Management

  • Set stop loss as a dollar amount (e.g., $50 max loss)
  • Set profit target as a dollar amount (e.g., $100 target)
  • Study automatically calculates tick distances based on position size
  • Offsets are rounded to whole ticks (minimum 1); the log reports the realized tick count and dollar value actually submitted
  • Entries are blocked (with a log message) for the few seconds after a symbol switch while Sierra hasn't loaded the tick value yet — otherwise the order would go out with no stop or target

Integrated Order Entry

  • Market orders (Buy/Sell)
  • Limit orders at pointer price
  • All orders include automatic stop and target brackets
  • Scale-in and scale-out support

Breakeven Management

  • Automatic stop move to breakeven when target % reached
  • Configurable breakeven trigger percentage
  • Offset to cover fees/commissions
  • Breakeven level and trigger are automatically clamped inside the bracket (0 <= level < trigger <= target ticks), so a large offset can never place the breakeven stop beyond a tight target

Inputs

Position Sizing

InputDefaultDescription
Length60ATR lookback period
Min Position Size1Minimum contracts
Max Position Size3Maximum contracts
Smoothing TypeWilder'sMoving average type for ATR
Use Volume Weighted ATRYesWeight ATR by volume for more responsive sizing
Auto Adjust Symbol Max SizeYesAutomatically update Sierra Chart's symbol max position
ATR Reference ($ per contract)$200Dollar volatility at which the position reaches max size — see sizing formula below

Risk Management

InputDefaultDescription
Stop Loss Amount ($)$50Maximum dollar loss per trade
Profit Target Amount ($)$100Target dollar profit per trade
Enable Move to BreakevenYesAuto-move stop to breakeven
Breakeven Trigger (% of Target)50%Move stop when this % of target reached
Breakeven Offset (Ticks)6Ticks beyond entry for breakeven stop
Target To Breakeven Offset (Ticks)3Offset for "Move Target to Breakeven" function

Order Entry

InputDefaultDescription
Enable Order EntryYesEnable menu and keyboard order entry
Enable Keyboard ShortcutsYesEnable hotkey trading
Initial Position Quantity1Contracts for new position entries
Scale Out Quantity1Contracts to reduce when scaling out
Allowed SidesBothRestrict to Long Only, Short Only, or Both

Keyboard Shortcuts (Customizable)

ActionDefault Key
Buy MarketB
Sell MarketS
Buy LimitN
Sell LimitD
Cancel Opening OrdersC
Move Target to BreakevenT

How Position Sizing Works

ATR is first converted to account currency per contract, so the same setting means the same dollar risk on every symbol:

ATR $ per contract = (ATR / Tick Size) * Currency Value Per Tick
Position Size      = Max Size * ATR Reference ($) / ATR $ per contract,  clamped to [Min, Max]

Example (ES, $12.50/tick):

  • Max Position Size: 3 contracts, ATR Reference: $200
  • Current ATR: 8 ticks → ATR $ = 8 × $12.50 = $100/contract
  • Calculation: 3 × 200 / 100 = 6 → clamped to 3 contracts
  • Current ATR: 24 ticks → ATR $ = $300/contract → 3 × 200 / 300 = 2 contracts

When volatility is high (large dollar ATR), position size decreases; when low, it grows up to the maximum. Position size reaches max exactly when the dollar ATR is at or below the reference.

Because ATR is compared in dollars per contract, the same ATR Reference setting means the same volatility threshold on every symbol — switching between e.g. NQ and ES does not change the effective sizing behavior.

If Min Position Size is misconfigured higher than Max Position Size, Min is silently clamped down to Max so the result never exceeds the declared maximum.

Stop / Target Sizing Across Scale-In

Stops and targets are sized so that the full position at max size equals Stop Loss Amount ($) / Profit Target Amount ($).

When scaling in with smaller Initial Position Quantity, each individual order carries proportionally smaller per-order $-risk:

  • Max target = 3, Initial qty = 1, Stop = $60 → first fill risks $20, full position risks $60.
  • Scale-in orders inherit the same offsets so the combined position reaches the configured $-risk only at full size.

Scale-out orders submit naked (no new brackets on the scale-out order itself). The study then explicitly reconciles working stops + targets on the exit side so that:

sum(working stop qty on exit side) == sum(working target qty on exit side) == abs(position)

Reconciliation is deferred one study tick after the scale-out submit. Sierra's ModifyOrder / CancelOrder calls are asynchronous, so doing them inline before SellEntry/BuyEntry could leave the stop at its original quantity when the scale-out reached the matching engine — causing the stop to fill alongside the scale-out and over-flatten the position. By deferring to the next tick, Sierra has already processed the scale-out fill, the actual position is read via GetTradePosition, and excess bracket quantity is removed via ModifyOrder (preferred — keeps the position protected) or CancelOrder (when an entire bracket leaf is no longer needed).

Log lines confirm the cleanup:

Scale-out reconcile: shrunk stop order 12345 from qty 2 to 1 @ 29591.25
Scale-out reconcile: cancelled target order 12346 (qty 1) @ 29798.75

Order Types

New Position

  • Uses Initial Position Quantity
  • Attaches stop and target based on dollar amounts
  • Enables breakeven management if configured

Scale-In (Adding to winning position)

  • Checks remaining capacity vs max position
  • Uses Initial Position Quantity (or remaining capacity if smaller)
  • Each scale-in entry attaches its own stop + target bracket (per-entry, not shared), so the bracket count grows with the position. The reconciler shrinks them back on scale-out.

Scale-Out (Reducing position)

  • Uses Scale Out Quantity
  • Reduces position via Sierra's SupportTradingScaleOut
  • Brackets on the exit side are reconciled to match the reduced position on the next tick (see above)

No Auto-Reversal

sc.SupportReversals is forced to 0 so an opposite-direction entry against an existing position is never re-interpreted as "close everything + open the opposite". To flip direction:

  1. Press Cancel Opening Orders (or close manually).
  2. Place a new entry once the position is flat.

This prevents the inconsistent "close 1 vs close 2" behavior seen when Sierra mixed scale-out and reversal interpretations on the same SellEntry/BuyEntry submit.

Menu Commands

Right-click chart to access:

  • Buy Market (Calc Size) - Market buy with calculated sizing
  • Sell Market (Calc Size) - Market sell with calculated sizing
  • Buy Limit at Pointer (Calc Size) - Limit buy at crosshair price
  • Sell Limit at Pointer (Calc Size) - Limit sell at crosshair price
  • Move Target to Breakeven - Move profit target to entry + offset
  • Cancel Opening Orders - Cancel limit entries, keep stops/targets

Requirements

  • Sierra Chart with Trade Mode enabled
  • Chart Trade Mode must be active for order entry
  • Works with simulation or live trading

The study keeps sc.SendOrdersToTradeService in sync with sc.GlobalTradeSimulationIsOn on every call, so toggling Trade > Trade Simulation Mode On (or starting Replay) is picked up immediately without re-applying the study.

Sierra Chart setup (one-time)

The study assumes Sierra is configured to not auto-add anything to the orders it submits. Without these settings the study's bracket math collides with Sierra's own bracket / scaling logic and you get phantom brackets, mismatched quantities, or unexpected reversals.

Run through this checklist once per chart/trade account:

  1. Trade Template — clear default attached orders. Trade > Trade Templates... → set attached stop, target, and any "attached order on entry" options to None / 0 / no offsets. The study supplies its own brackets via StopAllOffset / Target1Offset on new entries and scale-ins; the Trade Template must not add anything on top. Symptom if not cleared: after a scale-out a fresh bracket pair appears "for the wrong direction" (e.g. a long-style stop below price after scaling out of a short), often at very wide default offsets.
  2. Trade Window — no Stop / Target / Trail set. Open the Trade Window and clear the Stop, Target, and Trail Stop fields (set to 0 / blank). The study's bracket sizing comes from the input dollar amounts, not the Trade Window.
  3. Turn off Sierra's native scaling. Trade > Trade Window → disable the built-in scale-in / scale-out buttons and any "automatic scale order" options. The study handles scaling via its own menu items and hotkeys.
  4. Disable "Maintain Same Quantity for OCO Orders". In the trade configuration, turn this off. With it on, Sierra forces every OCO leaf to match the latest qty change, which fights the study's reconciler when it shrinks one bracket but not its pair.
  5. Disable Sierra's native chart-trade hotkeys. Global Settings > General Settings > Trading → unbind the built-in keyboard shortcuts (Buy, Sell, Flatten, etc.). The study consumes its matched hotkeys so they no longer fall through to Sierra's native chart trading, but unbinding avoids conflicts for keys the study is not handling. The one exception is Move To Breakeven — leave it bound if you want Sierra's built-in MTBE in addition to the study's T hotkey.

Installation

  1. Place AutoPosSizeAndSLTP.dll in your Sierra Chart Data folder
  2. Add study to chart: Analysis > Studies > Add Custom Study
  3. Search for "AutoPosSizeAndSLTP"
  4. Enable Chart Trade Mode for order entry functionality

Exported Study Functions

FunctionPurpose
scsf_AutoPosSizeAndSLTPMain study — position sizing + order entry

An earlier scsf_GetCalculatedMaxPositionSize helper has been removed. It read from per-study persistent storage and therefore could never see the value written by the main study running in a separate study instance.

COMPLETE BUNDLE — ALL 7 INDICATORS

€149 EUR

One-time payment · Sierra Chart license · All 7 indicators included, not just AutoPosSizeAndSLTP