Skip to content

Long short position tools

Long position calculations

Position size

Qty = min(QtyRisk, QtyLvg)

Where:

QtyRisk = (RiskSize / ((EntryPrice - StopPrice) * PointValue)) / LotSize
QtyLvg  = (AccountSize * Leverage / EntryPrice) * PointValue / LotSize

Account balance after take profit

Amount = AccountSize + (ProfitPrice - EntryPrice) * Qty * PointValue * LotSize

Account balance after stop loss

Amount = AccountSize - (EntryPrice - StopLevel) * Qty * PointValue * LotSize

Target level

TP price offset   = ProfitPrice - EntryPrice
TP percent offset = ((ProfitPrice - EntryPrice) / EntryPrice) * 100

Stop level

SL price offset   = EntryPrice - StopPrice
SL percent offset = ((EntryPrice - StopPrice) / EntryPrice) * 100

Risk/reward ratio

RiskRewardRatio = (ProfitPrice - EntryPrice) / (EntryPrice - StopPrice)

Profit PnL

PnL = (ProfitPrice - EntryPrice) * Qty * PointValue * LotSize

Loss PnL

PnL = (StopPrice - EntryPrice) * Qty * PointValue * LotSize

Open and closed PnL behavior

For long positions:

  • If the tool is placed over historical data with no bars inside the tool area:
OpenPnL = PositionRightEdgeClosePrice - EntryPrice
  • If the entry price is not reached, or neither take profit nor stop loss is reached, the tool can still show open PnL based on the relevant chart state.
  • If the tool is placed in the future where no bars exist yet:
OpenPnL = LastPrice - EntryPrice
  • If the take-profit level is reached:
ClosedPnL = TP price offset
  • If the stop-loss level is reached:
ClosedPnL = SL price offset

Short position calculations

Position size

Qty = min(QtyRisk, QtyLvg)

Where:

QtyRisk = (RiskSize / ((StopPrice - EntryPrice) * PointValue)) / LotSize
QtyLvg  = (AccountSize * Leverage / EntryPrice) * PointValue / LotSize

Account balance after take profit

Amount = AccountSize + (EntryPrice - ProfitLevel) * Qty * PointValue * LotSize

Account balance after stop loss

Amount = AccountSize - (StopLevel - EntryPrice) * Qty * PointValue * LotSize

Target level

TP price offset   = EntryPrice - ProfitPrice
TP percent offset = ((EntryPrice - ProfitPrice) / EntryPrice) * 100

Stop level

Stop price offset   = StopPrice - EntryPrice
Stop percent offset = ((StopPrice - EntryPrice) / EntryPrice) * 100

Risk/reward ratio

RiskRewardRatio = (EntryPrice - ProfitPrice) / (StopPrice - EntryPrice)

Profit PnL

PnL = (EntryPrice - ProfitPrice) * Qty * PointValue * LotSize

Loss PnL

PnL = (EntryPrice - StopPrice) * Qty * PointValue * LotSize

Open and closed PnL behavior

For short positions:

  • If the tool is placed over historical data with no bars inside the tool area:
OpenPnL = EntryPrice - PositionRightEdgeClosePrice
  • If the entry price is not reached, or neither take profit nor stop loss is reached, the tool can still show open PnL based on the relevant chart state.
  • If the tool is placed in the future where no bars exist yet:
OpenPnL = EntryPrice - LastPrice
  • If the take-profit level is reached:
ClosedPnL = TP price offset
  • If the stop-loss level is reached:
ClosedPnL = SL price offset

Shared variables

AccountSize = Initial account size entered in the tool settings
RiskSize = Risk

When risk is entered as a fixed value.

RiskSize = (Risk / 100) * AccountSize