- Topics: 28
- Replies: 131
- Posts: 159
The best place to start is with the Introduction to Scripting video series, which you can watch by signing in here. The language has been designed for non-programmers, so once you understand the logic you should be able to pick it up.
In your example, the difference between the upper and lower Bollinger Bands can be displayed in a tool called Bollinger Bandwidth. This basically takes the distance between the upper and lower bands and divides by the middle band.
Here’s your GE one year example showing both the 2 year Bollinger Bands and the Bandwidth tool: (38.05 – 18.10) / 28.08 = 0.71 (or 71%)
So for scripts for 5%, 10% and 15% you could add different coloured Show Bars for each value, using the BBW() function for the bandwidth.
Red (less then 5%) = BBW(BARS=2) < 0.05
Blue (between 5% and 10%) = BBW(BARS=2) > 0.05 and BBW(BARS=2) < 0.1
Green (between 10% and 15%) = BBW(BARS=2) > 0.1 and BBW(BARS=2) < 0.15
Note that these conditions will be calculated on the timeframe of the chart, so switching between quarterly and annual charts will automatically recalculate the Show Bar results.
If you wanted to create conditions for both timeframes it is possible to create formulas, such as this for both yearly and quarterly below 15%:
BBW(Year(PERIODAMOUNT=1), BARS=2) < 0.15 and BBW(Month(PERIODAMOUNT=3), BARS=2) < 0.15
Let me know what you think.