PROTECTED SOURCE SCRIPT
[DEM] Relative Strength Signal (With Backtesting)

[DEM] Relative Strength Signal (With Backtesting) is a momentum indicator that generates trading signals based on when an asset reaches its highest or lowest relative strength compared to the SPY benchmark over a 20-period lookback window. The indicator calculates relative strength by dividing the current asset's price by SPY's price, then triggers buy signals when this ratio hits a 20-period high (indicating maximum outperformance) and sell signals when it reaches a 20-period low (indicating maximum underperformance). To prevent signal clustering and improve practical utility, the indicator includes a built-in filter that requires a minimum number of bars (default 20) to pass between signals of the same type, ensuring adequate spacing for meaningful trade opportunities. The system includes comprehensive backtesting functionality that tracks signal accuracy, average returns, and signal frequency over time, displaying these performance metrics in a detailed statistics table to help traders evaluate the effectiveness of trading on relative strength extremes versus the broader market.
نص برمجي محمي
تم نشر هذا النص البرمجي كمصدر مغلق. ومع ذلك، يمكنك استخدامه بحرية ودون أي قيود - تعرف على المزيد هنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي محمي
تم نشر هذا النص البرمجي كمصدر مغلق. ومع ذلك، يمكنك استخدامه بحرية ودون أي قيود - تعرف على المزيد هنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.