This ProBuilder script is designed to create a custom screener that calculates and analyzes the relative strength of a stock compared to a benchmark index. The relative strength is a popular metric used in technical analysis to compare the performance of an individual stock or asset to a broader market index.
EQUITYFRAME("Indices Euronext","PXI")
valeur2=close equityframe(default)
valeur1=close
Forcerelative= valeur1/valeur2
while Forcerelative < 0.4 and Forcerelative > 0 do
forcerelative=forcerelative*10
wend
while Forcerelative > 6 do
forcerelative=forcerelative/10
wend
avg = average[10](forcerelative)
test = forcerelative crosses over avg or forcerelative crosses under avg
SCREENER[test](forcerelative AS"RelativeStrength")
Explanation of the code:
EQUITYFRAME function is used to set the reference index for comparison, which in this case is “Indices Euronext” with the symbol “PXI”.Forcerelative) by dividing the close price of the current equity (valeur1) by the close price of the index (valeur2).while loops are used to scale the relative strength value into a more manageable range. If the value is less than 0.4, it is multiplied by 10 until it is no longer less than 0.4. If it is greater than 6, it is divided by 10 until it falls below this threshold.average[10](forcerelative) function calculates the 10-period moving average of the normalized relative strength.test variable checks for crossover events where the relative strength crosses over or under its moving average, which can signal potential changes in trend.SCREENER function is used to filter and display stocks where a crossover event has occurred, labeling the output as “RelativeStrength”.This script is useful for traders and analysts who want to screen stocks based on their performance relative to a broader market index, helping to identify potential outperformers or underperformers.
Check out this related content for more information:
https://www.prorealcode.com/topic/croisement-ema-avec-force-relative-comparaison/#post-168280
Visit Link