Position Size By Risk For Bar Size

If you are trading a fixed risk amount (e.g. $100) per trade and your Entry and Stop is defined by a specific bar on the chart (any resolution e.g. 15 min, 5 min, 2 min etc) then this indicator will show you the position size you can take.
The user configures the risk amount per trade in the setting for the indicator, the default is 100 (e.g. $100).
It calculates each bar size (high - low) for the resolution of the chart that is being viewed.
The position size = (risk amount) / (bar size).
It then displays a "." (dot) for each bar and to see the position size hover your mouse over this dot.
The pane for this indicator can be set to the top of the chart by using the "Move pane up" option on the chart so that the indicator is easily accessible and discrete at the top of the chart.
Also, there is an option to use this indicator as a substitute for the built-in volume display.
This version adds User Input options to show 2 different position sizes for different risk amounts. This version also adds a user option to display the High & Low of the bar. Tooltips added for User Input boxes.
Details
Normally you will trade with a consistent $ risk amount (Normal Size), but there are occasions where you might want to trade 1/2 size or double size depending on the quality of the trade. So this second risk amount box can be used for this purpose. By default the second position sizing is turned off.
Also added a User Input option to display the High & Low of the bar. By default this is turned off.
Modified options to configure what is displayed in the label:
Yes - Shows position size and risk amount
Yes Compact (Default) - Shows only position size
No - Does not show position size or risk amount
Restructured code to bring it in line with Pine Script coding style guide (tradingview.com/pine-script-docs/en/v5/writing/Style_guide.html)
Additional features include
1. The label character, font size and text colour can now be chosen in settings
2. Introduced a Point Value to handle position sizing for futures where 1 point has a different monetary value e.g. 1 point for NQ = $20, 1 point for ES = $50. The default is 1 point = $1 for US Equities
3. Added a option to include slippage in points so that position size is reduced to account for likely value of slippage if stop loss is hit and still keep within the target $ being risked
Have not done exhaustive testing, so please test for your own setup before using.
size.auto (0),
size.tiny (~7),
size.small (~10),
size.normal (12),
size.large (18),
size.huge (24).
The default value is size.normal, which represents the numeric size of 12
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.