The strategy initializes with a capital of 100,000. Variables track the capital and the amount invested in the current trade. RSI Calculation:
The RSI and its SMA are calculated on the monthly timeframe using request.security(). Entry and Exit Conditions:
Entry: A long position is initiated when the RSI is above its SMA and there’s no existing position. The quantity is based on available capital. Exit: The position is closed when the RSI falls below its SMA. The capital is updated based on the net profit from the trade. Capital Management:
After closing a trade, the capital is updated with the net profit plus the initial investment. Plotting:
The RSI and its SMA are plotted for visualization on the chart. A label displays the current capital. Notes: Test the strategy on different instruments and historical data to see how it performs. Adjust parameters as needed for your specific trading preferences. This script is a basic framework, and you might want to enhance it with risk management, stop-loss, or take-profit features as per your trading strategy. Feel free to modify it further based on your needs!
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.