TradingView
Carlos_F_444
24 Th01 2024 15:32

AUTO STOP LEVEL 

NVIDIA CorporationNASDAQ

Mô tả

This is a simple yet highly efficient code that calculates stop levels, taking into account the market trend and its volatility.

This script calculates and displays (as a white point in the chart) a stop-loss by considering both volatility and the nearest support/resistance point.

The stop level is determined as the average of three specific values: firstly, two distinct volatility indicators - ATR and Bollinger Bands, and finally, the nearest support/resistance provided by the Supertrend indicator.

Moreover, it analyzes the trend to determine whether the stop should be set for long or short positions, providing insights into the most probable path of future prices. For instance, if the calculated stop level is below the current market prices, it suggests taking long positions, and vice versa.

Customization options include fine-tuning the standard parameters for the three indicators used in averaging and selecting multiple time frames.
Bình luận
Carlos_F_444
Version 2.0 doesn't have significant changes, just a slight edit in the comments to make them more explanatory and improve readability for those reviewing the code.

Additionally, I examined the "repainting" behavior mentioned in a comment and found that it doesn't pose any issues or problems. It's essential to remember that 95% of indicators repaint, as stated in the Pine Script user manual, and by itself, repainting is not an undesirable behavior.

In the specific case of this indicator, repainting occurs only during real-time calculations, in the last bar/candle before the closing price is established. Once the period concludes, the definitive closing price for the bar/candle is determined, the indicator fixes its value, and it remains unchanged. For this reason, repainting doesn't pose any issues for a trader who is aware of this behavior and waits for the bar/candle to close before making a decision.
Ergul71
Thanks for sharing, One of the best trailing stop indicator but repaints...
Carlos_F_444
@Ergul71, Thanks for your comment, I'll take care of repainting in a future version.
Carlos_F_444
Finally, I reviewed the repaint issue you mentioned, and I found that there is no problem. As you probably know, and as indicated in the Pine Script user manual, 95% of indicators repaint, and it is not necessarily undesirable behavior, depending on various factors. In this case, the candle that repaints is only the last one, and it does so because it recalculates the stop value with each new iteration (each new price). However, once the candle is closed, the indicator uses the close price of the candle and definitively calculates the stop value without further changes.
Thêm nữa