TWENTYTRADER

PRICE CHANNEL MEAN REVERSION

TWENTYTRADER Mis à jour   
This script is a Fully Automated trading script meant to be used with "Oanda" broker and the plug-ins for algorithmic trading automation.( FOREX ONLY)
This script is meant to capture "MEAN REVERSION " for intraday charts (1hour) preferably and will hold for days / weeks .trading on forex markets.

(The combination of indicators includes a high and low price channel along with a fast moving average)

This script is original in the description of Alan Hulls moving average combined with the high and low closing of price action.

The concept of this mean reversion strategy is to try and capture price exhaustive moves . The moving average is fast and most times remains in the channel. when the moving average overshoots the channel the average price of the instrument is thought to be rising or falling faster then average, indicating a possibility that the instrument may revert (pull back) this strategy aims to capture that pull back.

This strategy uses a higher risk than reward profile to jump in front of market moves (4 risk to 1 reward)
in the likelihood the instrument will revert back (example) 25 pips before it continues 100 pips in the current direction.

This strategy should only be used in markets that you believe are mean reverting at the time of trading otherwise you will be jumping Infront of a possible trend and the price can continue in the trending direction for an unknown specified amount of time.

This script uses a (user defined period) fast moving average ( green/red color) and (user defined period) price channel (White/Blue) chosen in the indicator settings menu.
The default parameters are 55 with a (minimum of 1 and maximum of 10000) for the moving average and 50 with a (minimum of 1 and maximum of 10000) for the price channel , the default parameters = roughly 2 days of price action on the (1 hour) chart.
"The default parameters should be kept unless you fully understand the complete strategy"
the upper band (white line) is the highest close of the specified period and the lower band (blue line) is the lowest close of the same period.
When the fast moving average over shoots the price channel (exits) then crosses back into the price channel (enters) it will trigger a long or short trade.
The long signal is given when the the moving average crosses below the low band then crosses back above the low band . The trade long trade will be entered and the trade will exit if the stop loss or profit targets are hit or if the short signal is given the trade will close then reverse.
The short trade will be entered if the fast moving average crosses above the upper band (white line) then crosses back down through the upper band (white line) The trade short trade will be entered and the trade will exit if the stop loss or profit targets are hit or if the long signal is given the trade will close then reverse.

When the trade is entered a red , a blue and green horizontal dotted line will appear on the chart.
the blue line is the strategy entry price , the red line is the stop loss price , and the green line is the take profit price . the colors will invert if the trade is long or short.

(Setting alerts should be done in the indicator settings menu, and the parameters you chose will determine the stop loss/target and the amount of "units = (position size)" you wish to trade for the (forex only) markets. using "alert() function calls only" is the only alert that should be used with this strategy.
(note : when "alert() function calls only" is set two messages will be sent, one closing any open position in the opposite direction and one placing the new order regardless if you are currently in a trade or not)

Trade targets , stoploss and trade position size are a user defined variables entered in the indicator settings menu. (target pips minimum 0 and a maximum of 1000)(stop pips minimum of 0 and maximum of 1000)


Back test date range is included in the script for back testing different data periods.
the back ground will be colored a transparent navy blue if the period you are looking trading is with in the date range( note: to place live trades the end date will need to be in the future)
this is also adjustable in the settings menu

The avoid spread filter is a user defined time in which the spread is typically higher than average, applying this filter avoids trades in the specified time. When this filter is applied there will be a transparent red back ground color in the specified time.

Back test default setting are equivocal to NZDUSD
at the time of this publication placing trades with the "Oanda" broker are as follows , NZD units = 3250 equal 2000 USD position size . "Oanda" current leverage is 33.3 to 1 for this particular pair and commission is paid in spread (1.7) pips = 0.55 USD per trade , Margin required for the trade is 60.50 USD , Position sizing = 6.5% of a 1000 USD account. NZDUSD
Notes de version:
#1 Margin requirement fixed 5% NZDUSD ,#2 Strategy update removed redundant calculation causing random back tester errors( late entry) ,#3 updated basic risk to reward being 1 risk to .5 reward
Notes de version:
added default setting recalculate on order fills = true to improve back testing accuracy , also added buy stop and sell orders to correct random order fill errors
Notes de version:
fixed short position bar color. fixed back test order fill to more accurately reflect actual market entry.
Notes de version:
Added strategy close function to have back tester more accurately reflect real-time strategy alerts
Notes de version:
Added the ability in the indicator settings menu to trade "long only" ,"Short Only" or both "Trades Long and Short" , (note: this ability allows traders to do a more thorough back test by separating long and short trades. It also will effect real time alerts!! be certain your trading setting are correct before setting alerts, as the alerts will trade "long Only" "Short Only" or both "Trades long and Short".
Notes de version:
Added an information table : table includes a Kelly criterion calculator (P * E) - (1 - P) / (W/L) . this calculation is is controlled by fully by user inputs , in the "Kelly criterion (table only)". not the strategy tester , you will need to enter this information manually. probability of win = strategy tester win percentage in decimal form 1 = 100% win rate .67 = 67% etc. Equity balance = account equity , Expected return = strategy tester profit factor , Wins in a row = is the amount of wins in a row as of last trade
" example if your last trade lost this number would be zero if it won it would be 1" . This is my personal take on the Kelly criterion . The Kelly Degradation factor uses the calculation of independent probability to degrade the full Kelly bet by a percent . (example the probability of coin flipping two heads in a row is .50 * .50 = .25 or 25% ) using this calculation if 1 full Kelly bet was 100$ the first trade would be a 100$ stop loss , the second trade would be degraded by 50% making a 50$ stop loss , the third trade would be 25% or 25$ stop loss etc.)

The ATR portion of this table is again a user defined input under the "Average true range (table only)" user input setting menu . This is the ATR of the current chart and timeframe converted into pips and rounded to the nearest whole number multiplied by a user defined ATR Stop loss multiplier and the take profit multiplier is a multiple of the ATR stop loss multiplied ( example 25 pip ATR multiplied by 4 = 100 * take profit multiplier 1.5 the stop would be 150 , the table would read (ATR stop in pips 100) (ATR take profit in pips 150)

Script sur invitation seulement

L'accès à ce script est limité aux utilisateurs autorisés par l'auteur et nécessite généralement un paiement. Vous pouvez l'ajouter à vos favoris, mais vous ne pourrez l'utiliser qu'après avoir demandé et obtenu l'autorisation de son auteur. Contactez TWENTYTRADER pour plus d'informations, ou suivez les instructions de l'auteur ci-dessous.

TradingView ne suggère pas de payer pour un script et de l'utiliser avant d'avoir 100% confiance en son auteur et de comprendre son fonctionnement. Dans de nombreux cas, vous pouvez trouver gratuitement une bonne alternative open-source dans nos Scripts communautaires.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Instructions de l'auteur

Instructions de l'auteur

Vous voulez utiliser ce script sur un graphique ?

Avertissement : Veuillez lire avant de demander l'accès.