Good morning,
I am wondering how to screen for a condition that occured within the last x days.
E.g.: a new 2months low that happened within the last 3 days
Does anybody know how to program or where to find information how to do it ?
Thx in advance
Brgds Rolf
Hello Rolf,
in this example the event is the moving average[20] crossing over the moving average[40].
The event is valid ( event =1) for “X” bars. You can set the variable eventtime to define the number of bars.
You can use the PRT Assistant to create the screener for event=1.
////timeframe for the event
eventtime = X
ind1 = Average[20](close)
ind2 = Average[40](close)
c1 = ind1 crosses over ind2
if c1 then
event = 1
eventindex = barindex
endif
if barindex - eventindex < eventtime then
event = 1
elsif barindex - eventindex > eventtime then
event = 0
endif
return event as "event"