Looking to see if there's an indicator or sample code that helps identify these 3 events that can be used as signals
1) Auto-draw a trend line envelope (for last 5-10 bars) if there's a reasonable trend quality, and signal if there's a trend-line break (i.e. cross-over/cross-under) - Note, I tried TrendlinePeaks/TrendlineTroughs, but it doesn't have a Period parameter (for a 5bar or 10bar trend) and it only connects 2 peaks over large # of periods - doesn't optimize across multiple peaks/troughs to generate a Best-fitting tight enveloper over a high-quality trend.
2) Auto-draw a Horizontal Support/Resistence line and signal if there's a Bounce off S/R
3) Bounce off a Simple Moving Average
Pl. advise most suitable indicator (saw several trend indicators but no Trend-Line envelope indicator) for these and any sample code that implements "Bounce detection"
Size:
Color:
2) Not exactly the S/R line but nonetheless here's some fine visuals. Don't remember where I got this from, probably converted Dion's code from WL3/4 times or maybe it's Robert's creation:
CODE:
Please log in to see this code.
3) A three-bar pattern where price is above the SMA, then touches it, and finally rebounds is very easy to code. But of course you're looking for a more flexible pattern where the movement can happen over any reasonable number of bars. The logic and math is exactly the same, you just need to apply this design pattern:
Tutorial: Setups, Triggers, Delays, and TimeoutsThe article features just one setup...
CODE:
Please log in to see this code.
...Whereas you are going to have three, enclosed like in this pseudocode:
CODE:
Please log in to see this code.
5/20/2014 EDIT: fixed code error (copy/paste).
Size:
Color: