Volatility Breakout tfmt4
Using the width between the Bollinger Bands called BandWidth, this system finds times of low volatility also known as a squeeze. It is called a squeeze because as the bands compress, they tend to expand again into higher volatility and the price can trend along the upper or lower band. This system finds low volatility and enters a new position when the price moves to the upper or lower Bollinger Bands.
The SMA used to create the Bollinger Bands is used as a trailing exit. After the price follows the upper or lower band, it returns to the middle of the bands to the moving average and the EA exits the position. This EA uses Percent Volatility position sizing to be able to treat any symbol or tick value the same to keep losses small with a fixed risk percentage as the lot size is calculated with the stop.
If the price moves in favor of your position, additional lots are added (optional via input) as the system pyramids. This EA will only close positions that it has opened (only matches to its magic number). John Bollinger mentions the squeeze in his book, Bollinger on Bollinger Bands, and on his website. There are times when the BandWidth can be low and the price moves to one band but then quickly moves to the other band. John calls this a headfake as it causes a whipsaw with the squeeze.
Note: The default input values are not optimized. Demo the EA and adjust the inputs to find the optimized combination for your risk tolerance and to maximize profitability. Trend Following systems are designed around long term probabilities. Although Trend Following systems have lower win rates, profitability comes from large trends as Trend Following cuts losses short and lets winners run. Test on a portfolio of symbols as profits from trending symbols will offset the small losses and provide profits when other symbols are not trending.
Entries and Pyramiding:
As the Bollinger Bands squeeze in low volatility, this EA enters a new position when the BandWidth is within the BandWidth_Percent threshold and the price equals or exceeds the upper or lower Bollinger Band. Using the BandWidth_Bars input, you specify how many bars back to find the lowest BandWidth value. Using the BandWidth_Percent input, you specify how close the BandWidth needs to be to the lowest BandWidth to allow a new entry. If you set the Max_Units input above 1, additional entries will occur and pyramid in ATR increments specified by the ATR_between_Pyramids input.
Exits are trailing with the simple moving average in the middle of the Bollinger Bands. For long positions, the EA exits when the price goes below the moving average. For short positions, the EA exits when the price goes above the moving average. The exit is only active when the BandWidth is outside of the entry squeeze threshold. By having this additional BandWidth criteria, it prevents exit when the price is moving in the close range of the squeeze when only the stop is needed if the price moves against the position.
Position Sizing and Stops:
This EA calculates the position sizing using the Percent Volatility method which is directly tied to the stop. The stop uses the ATR_Periods and Stop_Range_ATR inputs to calculate the ATR and then multiply the two values to set the stop distance from the entry price. Stops are not coded into the position but this EA closes out the position if the price reaches the stop value. As additional units are added through pyramiding, the stop moves to correspond to the latest entry price. Using the stop value, the Risk_Percent input, and your account information (tick size, lot size, digits, etc.), the position sizing uses the monetary value of the distance from entry to stop and keeps the number of lots limited to the percentage you specify. This allows every symbol, price, volatility to be treated equally. As your account size changes through profits or drawdowns, the position sizing will account for the change.
- MA_Periods: The number of bars used to calculate the simple moving average in the middle of the Bollinger Bands.
- Deviations: The number of standard deviations used to calculate the upper and lower Bollinger Bands.
- BandWidth_Bars: The number of bars back to find the lowest BandWidth value.
- BandWidth_Percent: The percentage to add to the lowest BandWidth value. If you want the squeeze threshold line to be 20% above the lowest BandWidth value, enter 20 to this input.
- Risk_Percent: The percent risked per position if the price reaches the stop. Example: If you want 2% of your equity to be risked per position, enter 2 to this input.
- ATR_Periods: The number of bars to use in the ATR calculation.
- Stop_Range_ATR: This value will be multiplied by the ATR to determine where the stop will be from the entry price. Example: If you want your stop to be set at 2* ATR from the price, enter 2 to this input.
- Max_Units: The maximum number of entries (including the initial entry) as the position gains profits and the EA adds pyramid positions.
- ATR_between_Pyramids: This value will be multiplied by the ATR to use for calculating when to add the next position through pyramiding. Example: Set this to 1.5 and the next pyramid position would be added when the price reaches your entry plus ( 1.5 * ATR ) for long positions or entry minus ( 1.5 * ATR ) for short positions.
- Slippage: Amount of allowable slippage when entering position.
- Reduction_Percent: Enter an amount by which to reduce your equity for the position sizing calculation. Example: If you are in a drawdown period you can enter 20 to this input and the position size will be 20% less than without the reduction. The position sizing calculation would treat your equity as 80% of what it really is to lower your risk until the drawdown is over.
The chart screenshot shows the Bollinger Bands in pink. Our BandWidth Squeeze indicator is also shown in the secondary chart window with the squeeze threshold line in yellow and the BandWidth in green when the EA can open a new position as the price reaches the upper or lower band.
Disclaimers: Trading is speculative in nature and not appropriate for all investors. Investors should only use risk capital that they are prepared to lose as there always exists the risk of substantial loss. Investors should fully examine their own personal financial situation before trading. Past performance does not guarantee future results. Hypothetical or simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.