AbzParticipant
Veteran
Hi,
i get this error when trying to run this as a MTF screener. It works without MTF
This ProScreener market scan cannot be executed because there is an infinite loop within the program code.
An infinite loop is a sequence of instructions which repeats itself endlessly when the code is executed. This may happen if:
– the loop doesn’t have a termination condition
– the termination condition can never be met
– the termination causes the loop to start over
To run the scan, modify the code of your ProScreener.
TIMEFRAME(daily)
// --- settings
x123len = 21 //RSI Length
x123period = 200 //Period
x123deviations = 2.0 //Deviation(s)
// --- end of settings
x123irsi = rsi[x123len](close)
x123periodMinusOne = x123period-1
x123Ex = 0.0
x123Ey = 0.0
x123Ex2 = 0.0
x123Exy = 0.0
for x123i=0 to x123periodMinusOne
x123closeI = (x123irsi[x123i])
x123Ex = x123Ex + x123i
x123Ey = x123Ey + x123closeI
x123Ex2 = x123Ex2 + (x123i * x123i)
x123Exy = x123Exy + (x123closeI * x123i)
x123ExEx = x123Ex * x123Ex
next
//slope
if x123Ex2=x123ExEx then
x123slope = 0.0
else
x123slope= (x123period * x123Exy - x123Ex * x123Ey) / (x123period * x123Ex2 - x123ExEx)
endif
x123ilinearRegression = (x123Ey - x123slope * x123Ex) / x123period
x123intercept = x123ilinearRegression + barindex * x123slope
x123deviation = 0.0
for x123i=0 to x123periodMinusOne
x123deviation = x123deviation + square((x123irsi[x123i]) - (x123intercept - x123slope * (barindex[x123i])))
next
x123deviation = x123deviations * sqrt(x123deviation / x123periodMinusOne)
x123startingPointY = x123ilinearRegression + x123slope / x123periodMinusOne
x123a = x123startingPointY-x123deviation
//x123c1 = x123startingPointY
x123b = x123startingPointY+x123deviation
x123up=x123irsi crosses over x123a
x123down=x123irsi crosses under x123b
XSignal= 9000
IF x123up THEN
XSignal = 1000
ELSIF x123down THEN
XSignal = 2000
ENDIF
TIMEFRAME(4 hour)
// --- settings
y123len = 21 //RSI Length
y123period = 200 //Period
y123deviations = 2.0 //Deviation(s)
// --- end of settings
y123irsi = rsi[y123len](close)
y123periodMinusOne = y123period-1
y123Ex = 0.0
y123Ey = 0.0
y123Ex2 = 0.0
y123Exy = 0.0
for y123i=0 to y123periodMinusOne
y123closeI = (y123irsi[y123i])
y123Ex = y123Ex + y123i
y123Ey = y123Ey + y123closeI
y123Ex2 = y123Ex2 + (y123i * y123i)
y123Exy = y123Exy + (y123closeI * y123i)
y123ExEx = y123Ex * y123Ex
next
//slope
if y123Ex2=y123ExEx then
y123slope = 0.0
else
y123slope= (y123period * y123Exy - y123Ex * y123Ey) / (y123period * y123Ex2 - y123ExEx)
endif
y123ilinearRegression = (y123Ey - y123slope * y123Ex) / y123period
y123intercept = y123ilinearRegression + barindex * y123slope
y123deviation = 0.0
for y123i=0 to y123periodMinusOne
y123deviation = y123deviation + square((y123irsi[y123i]) - (y123intercept - y123slope * (barindex[y123i])))
next
y123deviation = y123deviations * sqrt(y123deviation / y123periodMinusOne)
y123startingPointY = y123ilinearRegression + y123slope / y123periodMinusOne
y123a = y123startingPointY-y123deviation
//y123c1 = y123startingPointY
y123b = y123startingPointY+y123deviation
y123up=y123irsi crosses over y123a
y123down=y123irsi crosses under y123b
YSignal= 900
IF y123up THEN
YSignal = 100
ELSIF y123down THEN
YSignal = 200
ENDIF
TIMEFRAME(1 hour)
// --- settings
z123len = 21 //RSI Length
z123period = 200 //Period
z123deviations = 2.0 //Deviation(s)
// --- end of settings
z123irsi = rsi[z123len](close)
z123periodMinusOne = z123period-1
z123Ex = 0.0
z123Ey = 0.0
z123Ex2 = 0.0
z123Exy = 0.0
for z123i=0 to z123periodMinusOne
z123closeI = (z123irsi[z123i])
z123Ex = z123Ex + z123i
z123Ey = z123Ey + z123closeI
z123Ex2 = z123Ex2 + (z123i * z123i)
z123Exy = z123Exy + (z123closeI * z123i)
z123ExEx = z123Ex * z123Ex
next
//slope
if z123Ex2=z123ExEx then
z123slope = 0.0
else
z123slope= (z123period * z123Exy - z123Ex * z123Ey) / (z123period * z123Ex2 - z123ExEx)
endif
z123ilinearRegression = (z123Ey - z123slope * z123Ex) / z123period
z123intercept = z123ilinearRegression + barindex * z123slope
z123deviation = 0.0
for z123i=0 to z123periodMinusOne
z123deviation = z123deviation + square((z123irsi[z123i]) - (z123intercept - z123slope * (barindex[z123i])))
next
z123deviation = z123deviations * sqrt(z123deviation / z123periodMinusOne)
z123startingPointY = z123ilinearRegression + z123slope / z123periodMinusOne
z123a = z123startingPointY-z123deviation
//z123c1 = z123startingPointY
z123b = z123startingPointY+z123deviation
z123up=z123irsi crosses over z123a
z123down=z123irsi crosses under z123b
ZSignal= 90
IF z123up THEN
ZSignal = 10
ELSIF z123down THEN
ZSignal = 20
ENDIF
TIMEFRAME(15 minute)
// --- settings
w123len = 21 //RSI Length
w123period = 200 //Period
w123deviations = 2.0 //Deviation(s)
// --- end of settings
w123irsi = rsi[w123len](close)
w123periodMinusOne = w123period-1
w123Ex = 0.0
w123Ey = 0.0
w123Ex2 = 0.0
w123Exy = 0.0
for w123i=0 to w123periodMinusOne
w123closeI = (w123irsi[w123i])
w123Ex = w123Ex + w123i
w123Ey = w123Ey + w123closeI
w123Ex2 = w123Ex2 + (w123i * w123i)
w123Exy = w123Exy + (w123closeI * w123i)
w123ExEx = w123Ex * w123Ex
next
//slope
if w123Ex2=w123ExEx then
w123slope = 0.0
else
w123slope= (w123period * w123Exy - w123Ex * w123Ey) / (w123period * w123Ex2 - w123ExEx)
endif
w123ilinearRegression = (w123Ey - w123slope * w123Ex) / w123period
w123intercept = w123ilinearRegression + barindex * w123slope
w123deviation = 0.0
for w123i=0 to w123periodMinusOne
w123deviation = w123deviation + square((w123irsi[w123i]) - (w123intercept - w123slope * (barindex[w123i])))
next
w123deviation = w123deviations * sqrt(w123deviation / w123periodMinusOne)
w123startingPointY = w123ilinearRegression + w123slope / w123periodMinusOne
w123a = w123startingPointY-w123deviation
//w123c1 = w123startingPointY
w123b = w123startingPointY+w123deviation
w123up=w123irsi crosses over w123a
w123down=w123irsi crosses under w123b
WSignal= 9
IF w123up THEN
WSignal = 1
ELSIF w123down THEN
WSignal = 2
ENDIF
//
TIMEFRAME(default)
Signal = XSignal + YSignal + ZSignal + WSignal
IF Signal = 9999 THEN
Signal = 0
ENDIF
SCREENER[Signal](Signal AS "1=↑,2=↓/4H15")
Hmm, that’s a lot of loops for ProScreener! 😳
So your problem is not related to the original code, but with your custom version of it!
You say it works without MTF, but on a single timeframe, right?
This indicator is the same as this simple code:
i = rsi[21]
lr = LinearRegression[200](i)
up=lr+std[200](i)*2
dn=lr-std[200](i)*2
return i,lr,up,dn
So that you can get rid of loops and make a MTF screener with ease!
bonjour
Je n’arrive pas à créer le Screener qui me permettrais de faire ressortir les signaux de retour dans les LinearRegression[200]
Ce premier indicateur (https://www.prorealcode.com/prorealtime-indicators/rsi-and-linear-regression-trading-signals/) qui donne la même chose que le votre ci-dessus indique des signaux.
Ces signaux sont bien souvent de bonne qualité en daily sur les titres en tendance, et j’aurais aimer un screener qui les filtres.
Mais malgré mes nombreux tests, rien de concluant!
Merci d’avance
hello I can not create the Screener that would allow me to bring out the return signals in the LinearRegression [ 200 ] This first indicator (https://www.prorealcode.com/prorealtime-indicators/rsi-and-linear- regression-trading-signals /) which gives the same as yours above indicates signals. These signals are often of good quality daily on trending titles, and I would like a screener who filters them. But despite my numerous tests, nothing conclusive! thank you in advance
@clave38
Only post in the language of the forumthat you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.
excuse me for this mistake
Unless I am mistaken, the screener you are trying to do (crossing upper and lower bounds of the linear regression channel applied to the RSI), must be this:
i = rsi[21]
lr = LinearRegression[200](i)
up=lr+std[200](i)*2
dn=lr-std[200](i)*2
test = i crosses over up or i crosses under dn
screener[test]
Hello I tried to modify your screener to bring out the stocks whose rsi went below Linear Regression and which started to rise again with a change of Heikin ashi candle from red to green.
Or perhaps more simply, the price of which has fallen below Linear Regression and which reclassifies it with a change of the HH candle from red to green.
here is the screener I wrote, but it doesn’t return anything to me?
sorry for my english, google translate…
Thank you in advance for your help.
cordially
i = rsi[21]
lr = LinearRegression[200](i)
dn=lr-std[200](i)*2
test = i crosses under dn
c2 = average[100](close) > average[200](close)
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
xOpen = (xOpen[1] + xClose[1])/2
endif
c3 = xClose>xOpen AND xClose[1]<xOpen[1]
screener[test and c2 and c3]