Try the Profit Loss Calculator Widget
Free for any site, including commercial ones. Keep the small credit line at the bottom of the widget so readers can find the full version. Nothing is stored about the people who use it. See the disclaimer.
How to add it to your site
- Copy the code above Use the copy button so nothing is lost to line wrapping. It is a single iframe tag and it does not need anything else.
- Open the page you want it on In WordPress add a Custom HTML block, in Wix use the Embed HTML element, in Squarespace use a Code block, and on a hand-built site paste it straight into your HTML.
- Paste and publish The widget appears immediately. If you see an empty space instead, your editor has stripped the iframe tag, which the HTML embed guide explains how to work around.
- Adjust the look if you want to Add the parameters in the table below to the iframe URL to change the theme, the accent colour or the height. Nothing needs to be configured on our side.
Customisation options
| Parameter | Values | What it does |
|---|---|---|
theme | auto, light, dark | Default follows the reader's own system setting, so the widget looks right on a dark site and a light one without you choosing. |
accent | Six hex digits, e.g. accent=1A56DB | Recolours the header bar and the primary button to match your brand. |
header | 1 or 0 | Set to 0 to hide the title bar when your page already has a heading above the widget. |
breakdown | 1 or 0 | Set to 0 to hide the calculation breakdown for a more compact block. |
corners | 1 or 0 | Set to 0 for square corners if your design has no rounding anywhere else. |
width | full | Removes the 520px maximum so the widget stretches to its container. |
Parameters are added to the iframe URL as a normal query string, for example
/embed/position-size-calculator.html?theme=dark&accent=1A56DB&header=0. The
widget builder lets you set all of them visually and hands you the finished code.
What the widget calculates
The widget multiplies the price difference between entry and exit by the position size, applies the direction of the trade, and converts the result into the account currency. It shows the outcome in money and as a percentage of the position value.
Because both a target and a stop can be tested in seconds, it doubles as a way for readers to sanity check a trade's risk-to-reward before committing, which is the habit the risk-reward calculator formalises.
Who this widget suits
Trade idea and analysis posts
Readers can price your scenario against their own account size rather than yours.
Beginner guides
The fastest way to show what a pip is worth is to let someone change the lot size and watch the money move.
Journal and review pages
Useful alongside any article about reviewing closed trades.
Related widgets
- Risk Reward Ratio Calculator WidgetRisk-Reward Ratio Calculator
- Position Size Calculator WidgetPosition Size Calculator
- Pip Calculator WidgetPip Value Calculator
- Stop Loss Calculator WidgetStop-Loss Calculator
The full library of free trading widgets has more than eighty tools, and the widget builder lets you preview and configure any of them before you copy the code.
Frequently asked questions
Does the profit loss calculator widget include trading costs?
It calculates the gross outcome from entry, exit and size. Spread, commission and overnight financing are handled by the trading cost calculator and the spread cost calculator, which are separate widgets so that each tool answers one question clearly.
Does it work for short positions?
Yes. The reader selects the direction and the calculation inverts, so a short that closes below the entry produces a profit. Getting that sign right is a common stumbling block for beginners, which is part of why it is worth showing.
Can readers use it for shares as well as forex?
Yes. The calculation is the same for any instrument where you know the entry, the exit and the size. For JSE shares, remember that securities transfer tax and brokerage apply on top, which this widget does not include.
Is it suitable for a page aimed at complete beginners?
It is one of the better choices for that audience, because the inputs are intuitive and the output is in money. A reader who has never opened a trading platform can still understand entry, exit and size.
Does the widget give trading advice?
No. It is arithmetic on numbers the reader supplies. Nothing it produces is a recommendation, and the widget carries a risk notice making that clear, which matters if you are publishing to a South African audience under FSCA rules on financial advice.