infinite loop issue
Forums › ProRealTime English forum › ProScreener support › infinite loop issue
- This topic has 9 replies, 4 voices, and was last updated 3 years ago by clave38.
-
-
09/29/2020 at 3:01 PM #145847
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.Loop issue123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212TIMEFRAME(daily)// --- settingsx123len = 21 //RSI Lengthx123period = 200 //Periodx123deviations = 2.0 //Deviation(s)// --- end of settingsx123irsi = rsi[x123len](close)x123periodMinusOne = x123period-1x123Ex = 0.0x123Ey = 0.0x123Ex2 = 0.0x123Exy = 0.0for x123i=0 to x123periodMinusOnex123closeI = (x123irsi[x123i])x123Ex = x123Ex + x123ix123Ey = x123Ey + x123closeIx123Ex2 = x123Ex2 + (x123i * x123i)x123Exy = x123Exy + (x123closeI * x123i)x123ExEx = x123Ex * x123Exnext//slopeif x123Ex2=x123ExEx thenx123slope = 0.0elsex123slope= (x123period * x123Exy - x123Ex * x123Ey) / (x123period * x123Ex2 - x123ExEx)endifx123ilinearRegression = (x123Ey - x123slope * x123Ex) / x123periodx123intercept = x123ilinearRegression + barindex * x123slopex123deviation = 0.0for x123i=0 to x123periodMinusOnex123deviation = x123deviation + square((x123irsi[x123i]) - (x123intercept - x123slope * (barindex[x123i])))nextx123deviation = x123deviations * sqrt(x123deviation / x123periodMinusOne)x123startingPointY = x123ilinearRegression + x123slope / x123periodMinusOnex123a = x123startingPointY-x123deviation//x123c1 = x123startingPointYx123b = x123startingPointY+x123deviationx123up=x123irsi crosses over x123ax123down=x123irsi crosses under x123bXSignal= 9000IF x123up THENXSignal = 1000ELSIF x123down THENXSignal = 2000ENDIFTIMEFRAME(4 hour)// --- settingsy123len = 21 //RSI Lengthy123period = 200 //Periody123deviations = 2.0 //Deviation(s)// --- end of settingsy123irsi = rsi[y123len](close)y123periodMinusOne = y123period-1y123Ex = 0.0y123Ey = 0.0y123Ex2 = 0.0y123Exy = 0.0for y123i=0 to y123periodMinusOney123closeI = (y123irsi[y123i])y123Ex = y123Ex + y123iy123Ey = y123Ey + y123closeIy123Ex2 = y123Ex2 + (y123i * y123i)y123Exy = y123Exy + (y123closeI * y123i)y123ExEx = y123Ex * y123Exnext//slopeif y123Ex2=y123ExEx theny123slope = 0.0elsey123slope= (y123period * y123Exy - y123Ex * y123Ey) / (y123period * y123Ex2 - y123ExEx)endify123ilinearRegression = (y123Ey - y123slope * y123Ex) / y123periody123intercept = y123ilinearRegression + barindex * y123slopey123deviation = 0.0for y123i=0 to y123periodMinusOney123deviation = y123deviation + square((y123irsi[y123i]) - (y123intercept - y123slope * (barindex[y123i])))nexty123deviation = y123deviations * sqrt(y123deviation / y123periodMinusOne)y123startingPointY = y123ilinearRegression + y123slope / y123periodMinusOney123a = y123startingPointY-y123deviation//y123c1 = y123startingPointYy123b = y123startingPointY+y123deviationy123up=y123irsi crosses over y123ay123down=y123irsi crosses under y123bYSignal= 900IF y123up THENYSignal = 100ELSIF y123down THENYSignal = 200ENDIFTIMEFRAME(1 hour)// --- settingsz123len = 21 //RSI Lengthz123period = 200 //Periodz123deviations = 2.0 //Deviation(s)// --- end of settingsz123irsi = rsi[z123len](close)z123periodMinusOne = z123period-1z123Ex = 0.0z123Ey = 0.0z123Ex2 = 0.0z123Exy = 0.0for z123i=0 to z123periodMinusOnez123closeI = (z123irsi[z123i])z123Ex = z123Ex + z123iz123Ey = z123Ey + z123closeIz123Ex2 = z123Ex2 + (z123i * z123i)z123Exy = z123Exy + (z123closeI * z123i)z123ExEx = z123Ex * z123Exnext//slopeif z123Ex2=z123ExEx thenz123slope = 0.0elsez123slope= (z123period * z123Exy - z123Ex * z123Ey) / (z123period * z123Ex2 - z123ExEx)endifz123ilinearRegression = (z123Ey - z123slope * z123Ex) / z123periodz123intercept = z123ilinearRegression + barindex * z123slopez123deviation = 0.0for z123i=0 to z123periodMinusOnez123deviation = z123deviation + square((z123irsi[z123i]) - (z123intercept - z123slope * (barindex[z123i])))nextz123deviation = z123deviations * sqrt(z123deviation / z123periodMinusOne)z123startingPointY = z123ilinearRegression + z123slope / z123periodMinusOnez123a = z123startingPointY-z123deviation//z123c1 = z123startingPointYz123b = z123startingPointY+z123deviationz123up=z123irsi crosses over z123az123down=z123irsi crosses under z123bZSignal= 90IF z123up THENZSignal = 10ELSIF z123down THENZSignal = 20ENDIFTIMEFRAME(15 minute)// --- settingsw123len = 21 //RSI Lengthw123period = 200 //Periodw123deviations = 2.0 //Deviation(s)// --- end of settingsw123irsi = rsi[w123len](close)w123periodMinusOne = w123period-1w123Ex = 0.0w123Ey = 0.0w123Ex2 = 0.0w123Exy = 0.0for w123i=0 to w123periodMinusOnew123closeI = (w123irsi[w123i])w123Ex = w123Ex + w123iw123Ey = w123Ey + w123closeIw123Ex2 = w123Ex2 + (w123i * w123i)w123Exy = w123Exy + (w123closeI * w123i)w123ExEx = w123Ex * w123Exnext//slopeif w123Ex2=w123ExEx thenw123slope = 0.0elsew123slope= (w123period * w123Exy - w123Ex * w123Ey) / (w123period * w123Ex2 - w123ExEx)endifw123ilinearRegression = (w123Ey - w123slope * w123Ex) / w123periodw123intercept = w123ilinearRegression + barindex * w123slopew123deviation = 0.0for w123i=0 to w123periodMinusOnew123deviation = w123deviation + square((w123irsi[w123i]) - (w123intercept - w123slope * (barindex[w123i])))nextw123deviation = w123deviations * sqrt(w123deviation / w123periodMinusOne)w123startingPointY = w123ilinearRegression + w123slope / w123periodMinusOnew123a = w123startingPointY-w123deviation//w123c1 = w123startingPointYw123b = w123startingPointY+w123deviationw123up=w123irsi crosses over w123aw123down=w123irsi crosses under w123bWSignal= 9IF w123up THENWSignal = 1ELSIF w123down THENWSignal = 2ENDIF//TIMEFRAME(default)Signal = XSignal + YSignal + ZSignal + WSignalIF Signal = 9999 THENSignal = 0ENDIFSCREENER[Signal](Signal AS "1=↑,2=↓/4H15")09/29/2020 at 3:27 PM #145849Hmm, 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?
09/30/2020 at 6:17 AM #14590910/01/2020 at 3:19 PM #146094This indicator is the same as this simple code:
1234567i = rsi[21]lr = LinearRegression[200](i)up=lr+std[200](i)*2dn=lr-std[200](i)*2return i,lr,up,dnSo that you can get rid of loops and make a MTF screener with ease!
1 user thanked author for this post.
02/13/2021 at 1:52 PM #161294bonjourJe 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’avancehello 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
02/13/2021 at 2:28 PM #161298Only 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.
02/14/2021 at 5:29 PM #16141402/15/2021 at 1:37 PM #161490Unless 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:
123456789i = rsi[21]lr = LinearRegression[200](i)up=lr+std[200](i)*2dn=lr-std[200](i)*2test = i crosses over up or i crosses under dnscreener[test]02/16/2021 at 9:13 PM #16171403/01/2021 at 8:00 PM #162897Hello 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
1234567891011121314151617181920i = rsi[21]lr = LinearRegression[200](i)dn=lr-std[200](i)*2test = i crosses under dnc2 = average[100](close) > average[200](close)xClose = (Open+High+Low+Close)/4if(barindex>2) thenxOpen = (xOpen[1] + xClose[1])/2endifc3 = xClose>xOpen AND xClose[1]<xOpen[1]screener[test and c2 and c3] -
AuthorPosts
Find exclusive trading pro-tools on