Donchian Filter tfmt5
Similar to our Turtle EA, this system is a Price Channel or Donchian Channel breakout system that adds 2 moving averages. The moving averages help confirm the trend direction to filter out false breakouts and reduce whipsaws. Of the two moving averages, one has more bars in its calculation and the other has less bars in its calculation. Long positions are taken when the shorter MA (less bars) is above the longer MA (more bars) and the price breaks out of the upper price channel. Short positions are taken when the shorter MA is below the longer MA and the price breaks out of the lower price channel.
As trends develop and the price begins to make new highs or new lows, the price will break through the upper or lower price channel and the two moving averages will help confirm the trend to try and reduce the number of whipsaw trades. The secondary price channel works as a trailing exit. 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.
The default inputs are the Turtle System 1 and what Curtis Faith mentions in his book, Way of the Turtle, as he tests this system in the Futures market along with testing the Turtle system. This EA lets you choose any number of bars for the entry and exit and any number of bars for the two moving averages. This EA will only close positions that it has opened (only matches to its magic number).
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
Entries occur when the price exceeds the highest high or the lowest low of the price channels from the Entry_Periods input and the moving average from the Short_MA input is on the breakout side of the moving average from the Long_MA input. The EA adds the position as soon as the price makes a new high or new low and does not wait until the following bar. 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 and use the price channels from the Exit_Periods input. As the price reverses and reaches the exit price channel, this EA exits all positions including the pyramid positions.
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.
- Entry_Periods: The number of bars back to calculate the highest high and lowest low to use for the entry breakouts.
- Exit_Periods: The number of bars back to calculate the highest high and lowest low to use for the trailing exits.
- Long_MA: The number of bars back to calculate the longer or slower simple moving average.
- Short_MA: The number of bars back to calculate the shorter or faster simple moving average.
- 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 uses our free price channels indicator with the green showing the 20 bar entry price channels and the red showing the 10 bar exit price channels. The yellow line is the shorter MA and the pink line is the longer MA. Long positions only begin when the yellow 50 bar MA is above the pink 300 bar MA and the price breaks out of the upper price channel. Short positions only begin when the yellow 50 bar MA is below the pink 300 bar MA and the price breaks out of the lower price channel.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.
Changed entry criteria to limit only one new entry per bar/candlestick. If stopped out or position exits in the same bar, new entry waits for a new bar. Pyramid entries are not impacted.