Hi,
Im looking to create a screener than gives me results when the upper BolBand, Lower BolBand and Moving Average have been crossed in that order over the last 10 bars.
The result doesnt seem to want to execute. Thanks. I have just put in the // so the code can been seen.
timeframe(30mn)
Bol5 = (BollingerUp[15](close))
boldown = (BollingerDown[15](close))
movingA = average[15]
c1= high crosses over bol5
c2= low crosses under boldown
c3= close crosses over movingA
//result= summation[10](c1 then c2 then c3)
screener [result]
Try this (not tested):
timeframe(30mn)
Bol5 = (BollingerUp[15](close))
boldown = (BollingerDown[15](close))
movingA = average[15]
c1= high crosses over bol5
if c1 then
bar1 = barindex //it must have the lowest barindex
endif
c2= low crosses under boldown
if c2 then
bar2 = barindex
endif
c3= close crosses over movingA
if c3 then
bar3 = barindex //it must have the highest barindex
endif
//
MaxBar = (c3 = max(bar1,max(bar2,bar3)))
MinBar = (c1 = min(bar1,min(bar2,bar3)))
result = MaxBar AND MinBar AND ((BarIndex - bar1) <= 10)
screener [result]
Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums.
Thank you 🙂
I deleted the other topic.
I dont seem to be getting any hits with the above code on Australian stocks considering i can see there are a few companies in their last 10 (30min) bars have all 3 definitions meet. I even tried to stretch it further (15 bars) out to have a bigger possible pool and no luck.
Try writing (30 minute) at line 1.
Sorry, my fault, lines 18 and 19 are wrong. This is correct:
timeframe(30mn)
Bol5 = (BollingerUp[15](close))
boldown = (BollingerDown[15](close))
movingA = average[15]
c1= high crosses over bol5
if c1 then
bar1 = barindex //it must have the lowest barindex
endif
c2= low crosses under boldown
if c2 then
bar2 = barindex
endif
c3= close crosses over movingA
if c3 then
bar3 = barindex //it must have the highest barindex
endif
//
MaxBar = (bar3 = max(bar1,max(bar2,bar3)))
MinBar = (bar1 = min(bar1,min(bar2,bar3)))
result = MaxBar AND MinBar AND ((BarIndex - bar1) <= 10)
screener [result]