Limit Ladder Planner [Zen]

576
Limit Ladder Planner [Zen] plans an entry with one to five equal limit orders inside one price zone. You set the zone, the stop and the target on the chart. The script sizes the orders so that the loss with every order filled and the stop hit equals your risk, fees included, and shows what you lose or make if only part of the ladder fills.

WHAT IS ORIGINAL
Position size and risk/reward calculators are standard tools. This one is built for a plan with several limit orders inside a zone, where you do not know in advance how many of them will fill:
- The total size is set for the worst case: every order filled and the stop hit. That loss, with the entry fees and the stop fee, equals the risk you set.
- The table shows every partial fill: L1 only, L1-L2 and so on. For each one: average entry, size, loss at the stop, profit at the target and R. You see how the reward-to-risk changes as more orders fill.
- Limit order fees are applied to the entries and the take profit, the market fee to the stop.
- Open source: the formulas below are the ones in the code.

HOW IT CALCULATES
- Direction comes from the stop: below the zone = long, above the zone = short. A stop inside the zone or exactly on its edge gives no plan.
- N orders (1 to 5) of equal size are spread evenly from the near edge of the zone to the far edge: for a long from the top edge down, for a short from the bottom edge up. L1 is the order at the near edge. With one order, L1 is the middle of the zone. Order prices are rounded to the symbol's price step.
- Risk = balance x risk %.
- Total size Q = Risk / ((sum of |entry - stop| + limit fee x sum of entries) / N + market fee x stop), with fees as decimals (0.02% = 0.0002). Each order = Q / N.
- Scenario "the first k orders filled", with q = Q / N:
loss at the stop = q x sum of |entry - stop| + limit fee x q x sum of entries + market fee x k x q x stop
profit at the target = q x sum of |target - entry| - limit fee x q x sum of entries - limit fee x k x q x target
R = profit / loss
- Leverage only changes the margin shown (position value / leverage). It does not change the size or the risk.

ON THE CHART
- Nothing is drawn until the zone is set and the stop is outside it.
- The zone as a shaded area without a border: blue for a long, orange for a short. The first and the last order lines are its edges.
- A dashed line for each order, a red line for the stop and a green line for the target. They start 20 candles back and end one candle after the last candle. The target is drawn only when it is beyond the zone on the other side from the stop; otherwise the table asks you to move it.
- Short tags (L1, L2, ..., SL, TP) right after the last candle, where there are no candles.
- The price of every level is shown on the price scale: the orders in dark, the stop in red, the target in green. If you do not see these labels, turn on the indicator value labels in the chart's price scale settings.

TABLE (bottom right by default)
- Header: script name and timeframe.
- Plan: direction, risk in the symbol's quote currency and as % of the balance, number of orders x size of one order.
- One row per scenario (L1, L1-L2, ...): Avg entry, Size, Loss, Profit, R. Profit and R show a dash until the target is beyond the zone.
- All filled: position value and margin at your leverage.
- The fees used and "estimates only".
- Until the zone and the stop are set, or while the stop is inside the zone, the table shows what to fix instead of numbers.

ALERTS
- "Any alert() function call": a message as soon as the price touches the zone (L1), the stop or the target on the open candle, not at the candle close. Example: "BTCUSD 15m: price reached the zone, L1 83694.52." Each event is sent at most once per candle; events from the same price update come in one message.
- Three alert conditions: "Zone reached (L1)", "Stop reached" and "Target reached". Their messages include the exchange, ticker and timeframe. They follow the frequency you choose when you create the alert: once per bar fires on the touch, once per bar close at the candle close.
- A level counts as reached when the current candle touches it and the previous candle did not. When a later candle reaches it again after a candle that did not, the alert fires again.
- The zone alert uses L1: the near edge, or the middle of the zone with one order.
- An alert keeps the prices it was created with. After you move a line or change a setting, delete the alert and create it again.
- The script does not know whether your orders filled.

HOW TO USE
1. Add the script to the chart. TradingView asks you to click four prices: zone edge 1, zone edge 2, stop loss, take profit.
2. In the settings, set your balance, risk %, number of orders, leverage and your exchange's fees.
3. To change a price, drag its line on the chart or type it in the settings.
4. Check the table, then place the orders on your exchange yourself. The script does not place or track orders.
The levels are yours: the script does not suggest a zone, a stop or a target.

INPUTS (defaults)
- Zone edge 1, Zone edge 2, Stop loss, Take profit: set by clicks when the script is added
- Limit orders: 3 (1 to 5)
- Account balance: 1000
- Risk per trade %: 1 (0.01 to 100)
- Leverage: 10 (1 to 200)
- Limit order fee %: 0.02
- Stop (market) fee %: 0.06
- Table position: bottom right (also bottom center, top right, bottom left, top left)

LIMITS
- Estimates only. Slippage, spread, funding and liquidation are not included. Check on your exchange that the liquidation price is beyond your stop.
- For linear contracts (USDT-margined perpetuals) and spot, where profit = size x price change. Not for inverse (coin-margined) contracts.
- The balance and all results are in the symbol's quote currency, shown in the table.
- Sizes are in units of the base asset and are not rounded to your exchange's lot size or minimum order. The table shows them rounded (4 decimals, up to 8 below 0.01), so a row total can differ from the sum of the rounded order sizes in the last digit.
- Scenarios assume the orders fill in order from the near edge and the take profit is a limit order.
- In a very narrow zone several orders can get the same rounded price, and their tags can overlap. The prices stay on the price scale.
- If the table covers part of the plan, move it with Table position.
- Colours follow the chart theme (light or dark) automatically.

Not financial advice.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。