Optuma Forums › Optuma Scripting › Custom Breadth Indicator › Reply To: Custom Breadth Indicator
March 25, 2022 at 7:34 am
#67788
- Topics: 5
- Replies: 608
- Posts: 613
Hi,
You would need to use both the TimeSinceSignal() function and the SignalAfter() function. This script uses the V4 plot for the cross rules, you can change it to V3 if that was what you were after.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
V1 = GETDATA(CODE=ADVSPX:BM) ; V2 = GETDATA(CODE=DECSPX:BM) ; V3 = V1 / (V1+V2); V4 = MA(V3, BARS=10, STYLE=Exponential, CALC=Close) ; //Find the two Cross Criteria V5 = V4 CrossesBelow 0.40; V6 = V4 CrossesAbove 0.615; //Find Time Since V5 Triggered V7 = TIMESINCESIGNAL(V5) ; //Find where value crosses above 0.615 after crossing below 0.40 within 10 days SIGNALAFTER(V5,V6) and V7 <= 10 |
Here is how it looks on the chart (blue shaded zones):