PROTECTED SOURCE SCRIPT

Strategy - Bobo's Pivot ATR Swing

Mis à jour
Hi there, welcome to my pivot ATR swing bot. I put this out there with source code hidden to see what ideas others have to use it. Also if there are any coders of trading systems out there who wanted to work with me to put this into a form that could trade automatically we could both use... I'd welcome that kind of collaboration and will happily share the underlying rules of this and the more highly developed version that isn't public.

But as it is, the signals are free for all, use them as you wish and at your own risk. If you want to discuss the code, strategy or ideas, I'm around fairly regularly just message.

The bot is fairly simple design that will give you signals for long and short intraday/week on equity futures / CFDs / ETFs. You'll see it backtests fairly well on an hourly SPX500 chart as configured. You will need to set up certain parameters to account for any different timeframes and markets you wish to trade. For me it's most effective pick out a few good swing trades per week in equity futures. However part of the idea of putting this in the public domain is to see if other people will have good but different ideas how to use it. Please share with me if so :).

The basic concept is a series of 3 lines that define the area and movement we wish to trade. The daily pivot is the central line (blue). We are looking to capture reversions to this middle line from extremes (red and green). Therefore the bot will signal exit at the close of every candle that has passed through the pivot.

Entry is decided by the outer bands around the blue line. Red is the top band, green the bottom. As configured, these are simply placed a daily ATR value apart, centred around the pivot. You can change this quite a lot though, so let's go through the settings:

Pivot Timeframe - simple, a daily pivot is calculated from the previous day's values (high + low + close)/3 . BUt the same calculation can be applied to any length candle, day, minute, month or whatever. This makes the middle target line more or less responsive to recent price action.

ATR Band Timeframe
- When we calculate the average range, we need to know what candle length makes up our series. Daily candles is the default, but you can change that here.

ATR Lookback - When we calculate the average range, we need to know how many instances of the timeframe (day, minute, hour etc) we look back to create an average. The lower the lookback value, the more the width of the bands (the distance from pivot) will change quickly based on the volatility of previous candles. The higher the lookback value, the more stable the band width will be to recent volatility.

ATR divisor - The ATR value above is divided by this value, before being added or subtracted to the pivot to create the red and green lines. Default value is 2, and this means the distance from the red band to the green band will be equal to 1 ATR, as calculated according to the parameters above. Setting this to 1 would mean that each band is one ATR away from pivot (ie the bands got wider apart). Set this to 4, and it means that it is only 1/2 an ATR from green to red.

Take Profit / Stop Loss. - We know what a stop and profit target are, but worth nothing that a 0 value disables stop loss or profit targets. The bot will still close positions when crossing pivot.

Also, note the mintick value of the instrument you apply this to. For example for the CFD chart SPX500 the mintick value is 0.1. So a 100 value for stop loss = 10 points on SPX500. but if you were to trade the same thing basically, but the emini future ES, the mintick value is 0.25. So for a 10 point stop on the ES chart, you would need a value of 40 in this bot. US30 and YM have convenient mintick values of 1. Currencies can be a bit of a nightmare :).

Notes de version
Clearer title, no code changes
algorithmAverage True Range (ATR)IndicesPivot Pointsswingtrading

Script protégé

Ce script est publié en code source fermé et vous pouvez l'utiliser librement. Vous pouvez le préférer pour l'utiliser sur un graphique. Vous ne pouvez pas visualiser ou modifier son code source.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité