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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
////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" |
2 users thanked author for this post.