u/Abcdefg314

Tradingview's paper simulator problem.

Ok, let me try to post details here. Below is my conversation with AI.

Q. I'm looking at paper trading simulator in Tradingview and I don't understand the way margin is calculated in there.

A. TradingView’s paper trading simulator calculates margin dynamically based on trade value and leverage settings assigned to the specific asset class. TradingView uses two fundamental calculations to determine your margin requirements:
Required Margin = Trade Value / Leverage
Trade Value = Price x Quantity x Contract Multiplier
Current Equity = Account Balance + Unrealized P&L
Without Margin Control:
TradingView acts as a cash-only simulator or allows infinite leverage without forcing liquidations.
With Margin Control Enabled:
The system actively monitors your equity. If a trade goes against you and drops your equity below the threshold, the simulation responds immediately:
Current Equity <= Margin Required ==> Margin Call \ Forced Liquidation

Q. If I give you real numbers will you be able to explain?
A. Yes, absolutely. Please share the real numbers from your TradingView screen.

Q. I started fresh with 100000 USD simulated money and made just one trade. Here position values of this trade:
Symbol : CAPITALCOM:BTCUSD
Side : Short
Quantity : 0.1
Avg fill price: 64939.30 USD
Last price : 64987.45 USD
Unrealized PnL: -4.815 USD
Trade value : 6,493.93 USD
Market value : 6,489.12 USD
Leverage : 10:1
Margin : 648.91 USD
And here balances on my account after trade was completed:
Account balance: 100000.00 USD
Equity : 99995.19 USD
Unrealized PnL : -4.82 USD
Margin : 648.91 USD
Available funds: 99346.27 USD

A. Your numbers reveal exactly how TradingView calculates margin dynamically in real time. The key takeaway is that TradingView bases your margin on the current Market Value of the position, not the price you bought or sold it at.

  1. Calculating the Short Market Value:
    Trade Value: $64,939.30 × 0.1 = $6,493.93
    Unrealized PnL: ($64,939.30 - $64,987.45) × 0.1 = -$4.815
    Market Value: $6,493.93 + (-$4.815) = $6,489.115 (Rounds to $6,489.12)
  2. Calculating the Dynamic Margin:
    Formula: Market Value ÷ Leverage = Required Margin
    Math: $6,489.12 ÷ 10 = $648.91
  3. Calculating Equity and Available Funds
    Equity: $100,000.00 (Balance) - $4.815 (PnL) = $99,995.185 (Rounds to $99,995.19)
    Available Funds: $99,995.185 (Equity) - $648.9115 (Margin) = $99,346.2735 (Rounds to $99,346.27)

Q. Suppose the price of a bitcoin jumped up and reached 200000 USD (Last price). If we repeat the above calculations, what it will be?

A. If the price of Bitcoin jumps to $200,000.00, your account equity will drop significantly due to the short position losses, while your required margin mathematically turns into a negative credit under TradingView's dynamic formula.

  1. New Position Values
    Trade Value: $6,493.93 (Stays identical to entry)
    Unrealized PnL: ($64,939.30 - $200,000.00) × 0.1 = -$13,506.07
    Market Value: $6,493.93 + (-$13,506.07) = -$7,012.14
    Margin: -$7,012.14 ÷ 10 = -$701.21
    (Note: In real brokers, margin can never drop below zero. However, TradingView's paper simulator directly links margin to the fluctuating contract Market Value. Because your short position value flipped negative from massive losses, the simulated required margin dynamically turns into a negative number)
  2. New Account Balances
    Account Balance: $100,000.00 (Stays unchanged until you close)
    Equity: $100,000.00 - $13,506.07 = $86,493.93
    Available Funds: $86,493.93 - (-$701.21) = $87,195.14
  3. Will this trigger a liquidation?
    No. Even with a severe spike to $200,000, your starting cushion of $100,000 cash easily absorbs the $13,506.07 loss. Your Equity remains highly positive ($86,493.93), meaning you are safely insulated from a margin call.

Q. There will be no margin call, indeed. But calculated numbers don't add up, because available funds now exceed equity ($87,195.14>$86,493.93). This is absurd!

A. You spotted the exact logical flaw that breaks the TradingView paper trading engine under extreme scenarios. It is completely absurd, and it highlights why you cannot perfectly trust the simulator's backend for short positions.
Why the Math Fails.
TradingView uses a rigid, automated formula across all assets:
Available Funds = Equity - Margin Requirement
Because its dynamic algorithm calculates the Short Market Value as a negative number (-$7,012.14), dividing it by your 10:1 leverage yields a negative margin requirement (-$701.21).When the system subtracts a negative, it mathematically turns into addition:
$86,493.93 - (-$701.21) = $87,195.14
This creates the impossible real-world loop where losing money on a short position somehow grants you more purchasing power.
How Real Brokers Handle This.
In a real live trading account, this breakdown never happens because brokers use two strict rules for short margin:
Absolute Value:
Margin calculations ignore the directional sign. They calculate your margin based on the absolute current cost to buy back those 0.1 Bitcoins ($20,000.00), requiring a minimum of $2,000.00 in frozen margin.
Floors:
A margin requirement can never drop below zero or turn into a credit.
If this were a real broker, your available funds would look like this:
$86,493.93 (Equity) - $2,000.00 (Real Margin Code) = $84,493.93 (True Available Funds)

reddit.com
u/Abcdefg314 — 20 hours ago

Tradingview's paper simulator problem.

Using Tradingview's paper simulator I've come across problems with margin calculations for short positions. Potentially it can lead to an absurd situation when available paper funds exceed total account equity. I wonder if this problem is already known to Tradingview? If necessary, I can provide details, just don't know how to report it. (I'm new to Tradingview and don't have any paid plan yet).

reddit.com
u/Abcdefg314 — 10 days ago