TWENTYTRADER

PRICE CHANNEL MEAN REVERSION

TWENTYTRADER Actualizado   
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
Notas de prensa:
#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
Notas de prensa:
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
Notas de prensa:
fixed short position bar color. fixed back test order fill to more accurately reflect actual market entry.
Notas de prensa:
Added strategy close function to have back tester more accurately reflect real-time strategy alerts
Notas de prensa:
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".
Notas de prensa:
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 que requiere invitación

El acceso a este script está restringido a los usuarios autorizados por el autor y, por regla general, es de pago. Puede añadirlo a sus favoritos, pero solo podrá usarlo si solicita permiso al autor y éste le autoriza. Póngase en contacto con TWENTYTRADER para obtener más información o siga las siguientes instrucciones del autor.

TradingView recomienda no comprar ni utilizar un script si su autor no le ofrece total confianza o cuando no entienda cómo funciona. En muchos casos, puede encontrar una buena alternativa de código abierto de forma gratuita en nuestros Scripts de la comunidad.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

Instrucciones del autor

El autor de este script ya no puede otorgar acceso al mismo. Rogamos que no solicite el acceso.

¿Quiere utilizar este script en un gráfico?

Advertencia: Por favor, consulte antes de solicitar acceso.