Divergencias
Forums › ProRealTime foro Español › Soporte ProScreener › Divergencias
- This topic has 1 reply, 2 voices, and was last updated 1 hour ago by
JS.
-
-
09/13/2025 at 11:39 AM #250787
Intento crear un ProScreeener para detectar divergencias con el RSI 14 y el precio, he encontrado en ProRealCode el siguiente codigo pero me da error.
¿Hay alguna posibilidad de disponer de un código que buque divergencias alcistas en todos los marcos de tiempo? y que solo filtre valores que negocien en dia mas de 1.000.000 de titulos.
Así como disponer de un código para buscar divergencias bajista en todos los marcos temporales y que solo filtre valores que negocien en dia mas de 1.000.000 de titulos.
Gracias
pego el código, el error lo da en la línea 47 :
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889//-----------------------------------------------////PRC_RSI Divergence//version = 0//05.05.2025//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-----------------------------------------------//// inputs//-----------------------------------------------//src=(open+high+low+close)/4x=5z=25revpct=0.01ialert=25rsiprd=14ob=70os=30//-----------------------------------------------//// RSI calculation//-----------------------------------------------//rv=rsi[rsiprd](src)//-----------------------------------------------//// Bullish Divergence//-----------------------------------------------////--- Define lower low in pricellvx=lowest[x](src)llvz=lowest[z](src)srcLL=src>llvx*(1+revpct) and llvx<llvz[x]//--- Define higher low in RSIllvrsix=lowest[x](rv)llvrsiz=lowest[z](rv)rsiHL=rv>llvrsix and llvrsix>llvrsiz[x] and llvrsix<osbullishDiv=srcLL and rsiHLif bullishDiv thencount=1elsecount=1+countendifif count<ialert thenbullishDivAlert=10+50elsebullishDivAlert=50endifcolorbetween(bullishDivAlert,50,"green",100)//-----------------------------------------------//// Bearish Divergence//-----------------------------------------------////--- define higher high in pricehhvx=highest[x](src)hhvz=highest[z](src)srcHH=src<hhvx*(1-revpct) and hhvx>hhvz[x]//--- define lower high in rsihhvrsix=highest[x](rv)hhvrsiz=highest[z](rv)rsiLH=rv<hhvrsix and hhvrsix<hhvrsiz[x] and hhvrsix>obbearishDiv=srcHH and rsiLHif bearishDiv thencountbear=1elsecountbear=1+countbearendifif countbear<ialert thenbearishDivAlert=50-10elsebearishDivAlert=50endifcolorbetween(bearishDivAlert,50,"red",100)//-----------------------------------------------//if bullishdiv thenred=0green=255blue=0elsif bearishdiv thenred=255green=0blue=0elsered=0green=0blue=255endif//-----------------------------------------------//return rv as "RSI" coloured(red,green,blue)style(line,2), bullishDivAlert coloured("green"), bearishDivAlert coloured("red"), ob style(dottedline), os style(dottedline), 50 as "midline"09/13/2025 at 12:21 PM #250788Hello,
The code you are using is designed for an indicator…
To convert it into a screener, you must remove all graphic elements and alert functions, and replace the
RETURN
withSCREENER[…]
…Try this…
RSI Divergences Screener123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960//-----------------------------------------------////RSI Divergence Screener//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-----------------------------------------------//// inputs//-----------------------------------------------//src=(open+high+low+close)/4x=5z=25revpct=0.01//ialert=25rsiprd=14ob=70os=30//-----------------------------------------------//// RSI calculation//-----------------------------------------------//rv=rsi[rsiprd](src)//-----------------------------------------------//// Bullish Divergence//-----------------------------------------------////--- Define lower low in pricellvx=lowest[x](src)llvz=lowest[z](src)srcLL=src>llvx*(1+revpct) and llvx<llvz[x]//--- Define higher low in RSIllvrsix=lowest[x](rv)llvrsiz=lowest[z](rv)rsiHL=rv>llvrsix and llvrsix>llvrsiz[x] and llvrsix<osbullishDiv=srcLL and rsiHLif bullishDiv thencount=1elsecount=1+countendif//-----------------------------------------------//// Bearish Divergence//-----------------------------------------------////--- define higher high in pricehhvx=highest[x](src)hhvz=highest[z](src)srcHH=src<hhvx*(1-revpct) and hhvx>hhvz[x]//--- define lower high in rsihhvrsix=highest[x](rv)hhvrsiz=highest[z](rv)rsiLH=rv<hhvrsix and hhvrsix<hhvrsiz[x] and hhvrsix>obbearishDiv=srcHH and rsiLHif bearishDiv thencountbear=1elsecountbear=1+countbearendifScreener[(bullishdiv or bearishdiv) and Volume>1000000] -
AuthorPosts