Price difference percentage calculator — Tradetron Community
← Community

Price difference percentage calculator

Strategy 1,627 views

saikumar

I want to calculate price difference percentages between two legs on the current price of taken entries. Im not able to square off this position with this condition and able to square off position with time >= 1430

Lion Algos

Looks like your coding is wrong to calculate%.

For current price you have to use LTP

Amit Pathak

you cannot calculate untill your trade is executed and your code is also notcorrect

Tradetron Team Tradetron team

For the % difference between two traded legs, use Math Operation with each leg’s LTP:

((LTP leg1 − LTP leg2) / LTP leg2) × 100

  • LTP of each leg: LTP(Traded Instrument Name(Set 1, Condition 1, Leg 1)) and ... Leg 2.
  • Build it with nested Math Operation (operators + - * /).
  • Put the check in Set Exit, e.g. result > Number(2).

This only works after both legs have traded.

Example: leg 1 LTP = 102, leg 2 LTP = 100 → (102 − 100) / 100 × 100 = 2%. The exit fires on the next check where the result is above 2.

If the exit never fires, check that the Set / Condition / Leg numbers point at the right legs, and look at the computed value in the Notification Log while running in Live Offline. Keywords: Keyword Documentation — Tradetron

:sparkles: Answer written with AI from Tradetron docs (Oct 2026). Original replies are kept above. Spot something wrong? Reply below.