Hi I've revamped this bot mentioned in the linked idea to make it work with v4 of pine. In doing so there are some very significant changes to how it works. The main one is that it no longer uses traditional daily pivot calculations to calculate the bands. It creates a more dynamic intraday set of pivot points based on recent price action rather than yesterday's ohlc. As published, the bot is tuned for a 15 min time frame. But it actually works well on lower time frames you just need to adjust the lookback periods in settings a bit to re tune it. It's also tuned to ES really but will need tweaking for a different instrument at the very least.
The basic concept is recent price action is used to calculate a 'middle' around which red and green bands are located. Their position or width is largely determined by recent volatility. The middle line is again calculated from recent price action. The three lines from that form a tradeable range with green at the top and red at the bottom. The strategy is simple enough, it shorts as it sinks from outside red, and longs when rising above green. The basic principle being that once you enter that range you have a high probability of hitting the middle before you hit your stop loss. So the basic principle is you are trying to capture the inherent ranginess of liquid indices like S&P 500. That back and forth movement that happens. The bot is capturing this by fading extremes of a recent range but the problem with that is you'dd get murdered in a strong trend. To mitigate that there is a trend calculation running in the background the will prevent trading against firm trends mostly. So the bot should trade mostly in rangy conditions because that is what it is trying to do.
Bot will close issue close signals automatically upon crossing the middle, it also will close automatically at predefined stops or limits. These values are denominated in market mintick values. For example the CFD SPX500 has a mintick of 0.1. Therefore a stop value of 100 will equate to 10 points on the index. If trading the same market via ES1! the mintick value is different - 0.25. So in this case a value of 40 is required to set the stop at 10 points.
Anyway shout if you have questions. Hope it's useful.