• If the stock is extremely volatile and has a better than 50% chance of hitting the stop loss, then risk only 0.25% of your capital on that trade.
• If a stock has low and has less than 20% change of hitting the stop loss, then risk 2% of your capital on that trade.
• Risking anywhere between 0.25% and 2% is purely based on your intuition and assessment of the market.
• If you are on a losing streak and you want to cut back on your position sizing, then lowering the Risk % can help you weather the storm.
• If you are on a winning streak and your entries are experiencing a higher level of success, then gradually increase the Risk % to reap bigger profits.
• If you want to trade outside the noise of the market or take on more noise/risk, you can adjust the ATR Factor.
• … and whatever else you can imagine using it to benefit your trading.
The position size is calculated using the Capital and Risk % fields, which is the percentage of your total trading capital (a.k.a net liquidity or Capital at Risk). If you instead want to calculate the position size based on a specific amount of money, then enter the amount in the Custom Risk Amt input box. Any amount greater than 0 in the Custom Risk Amt field will override the values in the Capital and Risk % fields.
The stop loss is calculated by using the ATR. The default setting is the 14 RMA, but you can change the length and smoothing of the true range moving average to your liking. Selecting a different length and smoothing affects the stop loss and position size, so choose these values very carefully.
The ATR Factor is a multiplier of the ATR. The ATR Factor can be used to adjust the stop loss and move it outside of the market noise. For the more volatile stock, increase the factor to lower the stop loss and reduce the chance of getting stopped out. For stocks with less , you can lower the factor to raise the stop loss and increase position size. Adjusting the ATR Factor can also be useful when you want the stop loss to be at or below key levels of support.
The Market Session is the hours the market is open. The Market Session only affects the Opening Range Breakout (ORB) option, so it’s important to change these values if you’re trading the ORB and you’re outside of Eastern Standard Time or you’re trading in a foreign exchange.
The ORB is a bonus to the script. When enabled, the indicator will only appear in the first green candle of the day (09:30:00 or 09:30 AM EST or the start time specified in Market Session). When using the ORB, the stop loss is based on the spread of the first candle at the Open. The spread is the difference between the High and Low of the green candle. On 1-day or higher timeframes, the indicator will be the spread of the last (or current) candle.
The output of the indicator is a label overlaying the chart:
1. ATR (14 RMA x2) – This indicated that the stop loss is determined by the ATR. The x2 is the ATR Factor. If ORB is selected, then the first line will show SPREAD, instead of ATR.
2. Capital – This is your total capital or capital at risk.
3. Risk X% of Capital – The amount you’re risking on a % of the Capital. If a Custom Risk Amt is entered, then Risk Amount will be shown in place of Capital and Risk % of Capital.
4. Entry – The current price.
5. Stop Loss – The stop loss price.
6. -1R – The stop loss price and the amount that will be lost of the stop loss is hit.
7. – These are the target prices, or levels where you will want to take profit.
This script is primarily meant for people who are new to active trading and who are looking for a sound risk management strategy based on market . This script can also be used by the more experienced trader who is using a similar system, but also wants to see it applied as an indicator on TradingView. I’m looking forward to maintaining this script and making it better in future revisions. If you want to include or change anything you believe will be a good change or feature, then please contact me in TradingView.
If you prefer to use percentage of your cost basis to determine the price targets, then this update is for you! The updated script will show you price targets set at 1%, 5%, 10% and 20% of the cost basis. The script also allows you to enter a custom percentage, in case you want to know the target price for a specific percentage of the cost basis. If you select 'Show price targets of cost basis' and enter an amount greater than 0.0 in the 'Percentage Of Cost Basis' field, then the label will show the price target for that percentage.
- Renamed Targets to Price Targets.
- Removed the -1R line, since it was the same as the Stop Loss.
- Rounded positionSize variable, so that all risk and price target calculations are consistent.
- Added 'Cost Basis' line to the label, in order to show what it will cost if you were to buy using stated position size and current price.
- Changed 'Entry' to 'Current Price' in the label.
Although it wasn't my intention to write this script solely for buyers, I do realize this limitation and I plan to update the script so that it can also be used by short sellers. Keep an eye on the next update!
- Label color will turn red
- Stop loss will be above the current price
- Price targets will be below the current price
When choosing to short, the Price target can go no lower than 0.00. If that's the case, then the profit at 0.00 will be shown.
Also, the script now has an error condition to check if custom stop loss is greater than the current price for short and less than the current price when long. Price targets will not show when this error condition returns true.
This script is now in its fifth and almost final revision. Pine script doesn't provide the ability to do any unit testing, so adding more functionality will make the script unwieldy and more difficult to maintain. I'm planning to remove the Opening Range Breakout feature in the next revision, in order to improve the maintainability of the code. However, add a comment below to let me know if this is something you would like to keep in the script.
Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.