Screener for RSI and Linear Regression trading signals

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #218172 quote
    manafull
    Participant
    New

    Hi Nicolas, awesome work for creating the Indictor of RSI and Linear Regression trading signals!

    By any chance, do you have the Screener version for this “RSI and Linear Regression trading signals”?

    I tried to convert the indicator to screener by replacing the drawing at the end i.e. “SCREENER[Signal](Signal AS “1=↑, 2=↓”)”, where I use the Signal =1 or 2 to replace the two condition of drawing in the codes … but at the end I always get the error “Syntax error: This variable is not used in the {did not show any further info}”.

    The Screener would complete your indicator perfectly if you can add the screener here for us.

    Thank you for the great work guiding us through, as always!

    #218174 quote
    JS
    Participant
    Veteran

    Hi Manafull,

    You can combine the indicators in different ways, I don’t know exactly what you want but here is an example of the RSI (30/70) in combination with the Linear Regression slope…

    myRSI=RSI[14](Close)
    C1=myRSI Crosses Over 30 //Buy signal
    C2=myRSI Crosses Under 70 //SellShort signal
    
    myLRS = LinearRegressionSlope[10](close)
    C3=myLRS > 0 //Buy signal
    C4=myLRS < 0 //SellShort signal
    
    If C1 and C3 then
    Trend=1
    ElsIf C2 and C4 then
    Trend=-1
    EndIf
    
    C5=Close>10
    
    SCREENER [C1 and C3 and C5 or C2 and C4 and C5] (Trend AS "Trend")
    
    Scherm­afbeelding-2023-07-26-om-16.59.00.png Scherm­afbeelding-2023-07-26-om-16.59.00.png
    #218184 quote
    manafull
    Participant
    New
    Hi JS Thanks for that and I will try yours and report back here.. In the meantime, the screener that I wanted to get to, is the indicator from Nicolos’s indicator that I wanted to convert into a screener… below is code I tried to run but always with the error ““Syntax error: This variable is not used in the {did not show any further info}”.”:
    // --- settings
    len = 21 //RSI Length
    period     = 200 //Period
    deviations = 2.0 //Deviation(s)
    // --- end of settings
    
    //extra for screener
    Signal  = 0
     
    irsi = rsi[len](close)
    periodMinusOne = period-1
     
    Ex = 0.0
    Ey = 0.0
    Ex2 = 0.0
    Exy = 0.0
    for i=0 to periodMinusOne
    closeI = (irsi[i])
    Ex = Ex + i
    Ey = Ey + closeI
    Ex2 = Ex2 + (i * i)
    Exy = Exy + (closeI * i)
    ExEx = Ex * Ex
    next
    //slope
    if Ex2=ExEx  then
    slope = 0.0
    else
    slope= (period * Exy - Ex * Ey) / (period * Ex2 - ExEx)
    endif
    ilinearRegression = (Ey - slope * Ex) / period
    intercept = ilinearRegression + barindex * slope
    deviation = 0.0
    for i=0 to periodMinusOne
    deviation = deviation + square((irsi[i]) - (intercept - slope * (barindex[i])))
    next
    deviation = deviations * sqrt(deviation / periodMinusOne)
    startingPointY = ilinearRegression + slope / periodMinusOne
    //lineColor
    //if startingPointY > startingPointY[1] then
    //color.blue
    //r=0
    //b=255
    //else
    //color.red
    //r=255
    //b=0
    //endif
    a = startingPointY-deviation
    c1 = startingPointY
    b = startingPointY+deviation
     
    up=irsi crosses over a
    down=irsi crosses under b
    if up then
    //drawtext("↑ up",barindex,irsi-5,dialog,standard,20) coloured(0,255,0)
    Signal = 1
    endif
    if down then
    //drawtext("↓ down",barindex,irsi+5,dialog,standard,20) coloured(255,0,0)
    Signal = 2
    endif
    
    SCREENER[Signal](Signal AS "1=↑, 2=↓")
    If you or Nicolas can review the above code and rectify it, that would be awesome. In the meantime, I will try your (JS) code as above. Thanks!
    #218185 quote
    manafull
    Participant
    New
    Hi JS, I just run your screener and it gives me some from NASDAQ. What I wanted is to see the list of the candidates who are at the signaling point either about to dive or taking off from the RSI  perspective. If you look at Nicolas’s indicator, it shows all those: https://www.prorealcode.com/prorealtime-indicators/rsi-and-linear-regression-trading-signals/ My above code is trying to convert Nicolas’s indicator into the Screener. It should not be difficult but I keep getting the syntax error.
    #218189 quote
    Nicolas
    Keymaster
    Master
    Here is a working version to check for those RSI breakout of its linear regression channel with a screener.
    //PRC_RSILinearRegressionSignals| indicator
    //25.09.2020
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //converted from tradingview
    //https://www.prorealcode.com/topic/rsi-linear-regresion/
    
    // --- settings
    len = 21 //RSI Length
    period     = 200 //Period
    deviations = 2.0 //Deviation(s)
    // --- end of settings
    
    irsi = rsi[len](close)
    periodMinusOne = period-1
    
    Ex = 0.0
    Ey = 0.0
    Ex2 = 0.0
    Exy = 0.0
    for i=0 to periodMinusOne
    closeI = (irsi[i])
    Ex = Ex + i
    Ey = Ey + closeI
    Ex2 = Ex2 + (i * i)
    Exy = Exy + (closeI * i)
    ExEx = Ex * Ex
    next
    //slope
    if Ex2=ExEx  then
    slope = 0.0
    else
    slope= (period * Exy - Ex * Ey) / (period * Ex2 - ExEx)
    endif
    ilinearRegression = (Ey - slope * Ex) / period
    intercept = ilinearRegression + barindex * slope
    deviation = 0.0
    for i=0 to periodMinusOne
    deviation = deviation + square((irsi[i]) - (intercept - slope * (barindex[i])))
    next
    deviation = deviations * sqrt(deviation / periodMinusOne)
    startingPointY = ilinearRegression + slope / periodMinusOne
    ////lineColor
    //if startingPointY > startingPointY[1] then
    ////color.blue
    //r=0
    //b=255
    //else
    ////color.red
    //r=255
    //b=0
    //endif
    a = startingPointY-deviation
    //c1 = startingPointY
    b = startingPointY+deviation
    
    up=irsi crosses over a
    down=irsi crosses under b
    screener[up or down]
    
    #218208 quote
    manafull
    Participant
    New
    Thank you so much Nicolas!!!! I just run it and it is brilliant – exactly what I am after! The only thing I need to accommodate to run the code at my end is to clean up my PC memory and make more room to run this screener, as it is taking some time to return the results, which are all gold to me. Just can’t thank you enough 👍👍👍
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Screener for RSI and Linear Regression trading signals


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
manafull @manafull Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by manafull
2 years, 7 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 07/26/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...