Hi there guys,
i have a question, i want to use the smoothed heiken ashi indicator (in my version eliminating highs and lows of smoothed heiken ashi) but screening the stocks one by one it takes too much time. So i thought to use the ‘defparam calculateonlastbars’.
I get an error. What is the right syntax of the command ‘defparam’ for lets say the last 5 bars?
Will the screener work using the following code?
Thanx!!!
PS my aim is to find the turning point of smoothed heiken ashi
DEFPARAM CalculateOnLastBars = 5
IF BarIndex=0 THEN
xClose = (open+high+low+close)/4
xOpen = open
ELSE
xClose = (open+high+low+close)/4
xOpen = (xOpen[1]+xClose[1])/2
endif
//Smoothed Heikin-Ashi
xxclose=Average[max (1,HeikinPeriod),AverageType](xclose)
xxOpen = Average[max (1,HeikinPeriod),AverageType](xOpen)
//bullish
c1= xxopen[-1] > xxclose[-1]
c2= xxopen < xxclose
c3= c1 and c2
//bearish
c8= xxopen[-1] < xxclose[-1]
c9= xxopen > xxclose
c10= c8 and c9
screener [c3 or c10]
JSParticipant
Veteran
Hi @gnellas77
You can’t/shouldn’t define parameters in a screener… (DefParam is not allowed)
In your code, you can’t use negative values for the index of a variable, so xxopen[-1] is not allowed, values must be whole and positive.
I tried your screener but in this form, it is certainly not slow, after a few seconds results already appeared…