HomeTrading Widgets › Position Size Calculator Widget

Position Size Calculator Widget

Give your readers a risk-based position size calculator without building one. Copy one line of HTML and it runs inside your page.

One lineNothing to install
🛡️
No trackingOf you or your readers
🆓
FreeCommercial use allowed

i In short

A position size calculator is the single most requested tool on any trading education site, and it is also the one most publishers end up leaving out. Building one properly means handling account currency, risk percentage, stop distance in pips or in price, instrument pip value and lot conventions, then keeping all of it correct as the page is redesigned. This widget does that work for you. You paste an iframe, and your readers get a calculator that takes their account balance, their chosen risk percentage and their stop-loss distance, and returns the position size that puts exactly that much capital at risk.

The calculation runs entirely in your visitor's browser. Nothing they type is sent anywhere, no cookie is written, and no analytics script is loaded, which means the widget does not add a third-party data processor to your privacy policy and does not slow the rest of your page down waiting on a tracker. It is a single iframe pointing at a static file.

The tool was built for a South African audience, so rand-denominated accounts, ZAR crosses and the currency conversion step that applies when a trader with a rand balance sizes a USD-priced instrument are all handled correctly rather than assumed away. That specificity is useful well beyond South Africa: the same conversion logic applies to anyone trading instruments priced in a currency other than their account currency.

You can set the widget to light, dark or automatic so it inherits your reader's system preference, change the accent colour to match your brand, hide the title bar if your page already has a heading, and switch off the calculation breakdown if you want a more compact block. Every option is a query string parameter on the iframe URL, so there is no dashboard to log into and nothing to configure server side.

Try the Position Size Calculator Widget

Live previewThis is exactly what your readers will see

Embed code

Copy this into your page

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

  1. 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.
  2. 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.
  3. 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.
  4. 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

ParameterValuesWhat it does
themeauto, light, darkDefault follows the reader's own system setting, so the widget looks right on a dark site and a light one without you choosing.
accentSix hex digits, e.g. accent=1A56DBRecolours the header bar and the primary button to match your brand.
header1 or 0Set to 0 to hide the title bar when your page already has a heading above the widget.
breakdown1 or 0Set to 0 to hide the calculation breakdown for a more compact block.
corners1 or 0Set to 0 for square corners if your design has no rounding anywhere else.
widthfullRemoves 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 asks for an account balance, a risk percentage, an entry price and a stop-loss price, then works through the standard risk-based sizing formula: risk amount equals balance multiplied by risk percentage, and position size equals risk amount divided by the per-unit distance between entry and stop. It shows the resulting position size, the cash at risk, and the stop distance in both price terms and as a percentage of the entry.

Below the result it prints a step-by-step breakdown of how the number was reached, which is the part that makes it useful as a teaching tool rather than a black box. Readers who have never sized a trade deliberately can follow each line and see why a wider stop forces a smaller position, and why increasing risk percentage is a far blunter instrument than most beginners expect.

Who this widget suits

Trading education sites

Drop it into a lesson on risk management so readers can test the concept immediately instead of reading the formula and moving on.

Finance blogs and newsletters

A working tool in a post gives readers a reason to return to that page, which tends to help both time on page and repeat visits.

Course and membership pages

Embed it in a module on money management. It works inside most course platforms that allow a raw HTML block.

Related widgets

The full library of free trading widgets has more than seventy tools, and the widget builder lets you preview and configure any of them before you copy the code.

Frequently asked questions

Is the position size calculator widget really free?

Yes, for any site including commercial ones. There is no licence fee, no usage cap and no sign-up. The only thing asked in return is that you leave the small credit line at the bottom of the widget in place, since that is how readers find the full version and how the tool continues to pay for itself.

If the credit line does not suit your layout, get in touch through the contact page rather than stripping it out, and we will usually find an arrangement that works.

Does the widget work on WordPress?

Yes. Paste the iframe into a Custom HTML block in the block editor, or into the Text tab of the classic editor. Elementor users should use the HTML widget rather than the Text Editor widget. The WordPress instructions page covers each of those routes step by step, including the common problem of the visual editor stripping iframe tags on some managed hosts.

Will it slow my page down?

The iframe is loaded lazily, so the browser only fetches it when the reader scrolls near it. The widget carries no external fonts, no framework and no tracking scripts, and the whole document is under 50KB. In practical terms it costs less than a single stock photograph.

Can I change the colours to match my site?

Yes. Add accent=RRGGBB to the iframe URL with your hex colour and the header bar and primary button pick it up. You can also force theme=light or theme=dark, or leave the default and the widget follows your reader's system setting. The widget builder lets you set all of this visually and gives you the finished code.

Does the widget collect anything about my visitors?

No. There are no cookies, no local storage, no analytics and no network calls once the page has loaded. Everything a reader types stays in their browser and disappears when they close the tab. That is deliberate, because a calculator that quietly reports what your readers are risking would be a liability for you as the publisher.

How is this different from just linking to your calculator?

A link sends your reader away. The widget keeps them on your page, which is usually the point of adding a tool in the first place. If you would rather link, the full calculator page adds worked examples and a long FAQ that the embedded version deliberately leaves out to stay compact.

🛡️
Test the numbers on real prices

Try a Free Demo Account

Widgets show the maths. A demo account shows how the same maths behaves against live spreads and real market movement, without risking funds.

Open a free demo account
  • FSCA RegulatedTrade with confidence
  • Practice Risk FreeReal market conditions
  • Beginner FriendlyPerfect for learning

79% of retail CFD accounts lose money. Demo accounts do not guarantee future profits.