JustUncleL

Price Action Trading System v0.3 by JustUncleL

This is an updated and improved version of my "Price Action Trading strategy". I have added two extra optional filters, one is a trend direction filter based on the MACD slow EMA(17), blue line, and the other is a RSI (7) filter which works similarly to CCI (14) but slightly different dynamics (thank you to gianfranco60 for the suggestion). Also made a couple of corrections:
- input for lenLower minval=1 should be maxval=-1
- one bar pullback did not reset trigger, missing some alerts
Some Notes about usage:
- this is an alert indicator not a signal generator, each alert is a strong trend continuance candidate,
but should be treated on it's own merits by looking at chart dynamics and market conditions.
- will work well on trending markets only.
- works best on the first alert after MACD cross over.
- don't take trades when MACD and signal are close together.
- don't trade when channel and slow MA are flat or close together or
chopper (yellow and blue MA cross over quickly over short period).
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2 
//Name: Price Action Channel Trading System v0.3 by JustUncleL
//Created By: JustUncleL on 3 Aug 2016
//Version: 0.3
//
//Description: 
//  This is an implementation of 'Price Action Channel, “The Gold line” Trading System'
//  for Binary Options, originally a scapling system, but without the MA cross "Arrow1".
//  This is a Trend following price action system.
//  To complete the setup instead of the two "Chandelier Stop" indications, 
//  I replaced them with a MACD(12,17,8) indicator.
//  This is suitable for 15min charts, with 2 to 4 candle (30min to 60min) expiry.
//
//  Call Entry:
//  - Green Triangle, confirmed by MACD background green.
//  - CCI Candles aqua.
//  - For best call entry wait for the price retrace back to the gold line, 
//    back inside channel also works well.
//
//  Put Entry:
//  - Red Triangle, confirmed by MACD background red.
//  - CCI Candles black.
//  - For best put entry wait for the price retrace on the gold line,
//    back inside channel also works well.
//
//Notes:
//  - will work well on trending patterns only.
//  - works best on the first alert after MACD cross over.
//  - don't take trades when MACD and signal are close together.
//  - don't trade when channel and slow MA are flat or close together or
//    chopper (yellow and blue MA cross over quickly over short period).
//
//Modifications:
//  0.3 : Added optional filters for trend direction from MACD slow EMA(17)
//        and also RSI(7) filter.
//        Some corrections: 
//        - input for lenLower minval=1 should be maxval=-1
//        - one bar pullback did not reset trigger, missing some alerts
//  0.2 : Use MACD instead of Chandelier Stop for filtering, giving
//        a simplier looking chart.
//  0.1 : Original version.
//
// reference:
//  - Chandelier Stop by pipCharlie (not used in this version)
//  - http://www.forexstrategiesresources.com/scalping-forex-strategies/73-price-action-channel-the-gold-line/
//  - Used some ideas from RSI Candles by glaz
//
study(title="Price Action Trading System v0.3 by JustUncleL",overlay = true, shorttitle="CCIPAT v0.3 by JustUncleL")
//
len = input(14, minval=1, title="CCI Length")
lenUpper = input(75, minval=1, title="CCI UpLevel")
lenLower = input(-75, maxval=-1, title="CCI DownLevel")
bars_on = input(true, title="Color CCI Bars")
src = input(close,title="CCI Source") 
lenLo   = input(5, minval=2, title="Low Channel Length")
lenHi   = input(5, minval=2, title="High Channel Length")
lenMe = input(4, minval=1, title="Median Channel Length")
//
fastLength = input(12, minval=1,title="MACD Fast Length")
slowLength=input(17,minval=1,title="MACD Slow Length")
signalLength=input(8,minval=1,title="MACD Signal Length")
//
rsiLen  = input(7,minval=2,title="RSI length")
rsiUpper= input(70,minval=50,maxval=100,title="RSI Upper limit")
rsiLower= input(30,maxval=50,minval=0,title="RSI Lower Limit")
//
filterM = input(true,title="Use MACD confilter filter")
filterR = input(true,title="Use RSI confirm filter")
filterE = input(true,title="Use Trend direction filter")
dCandles= input(4,minval=2,title="Direction test Candles")
//
rsiVal = rsi(src,rsiLen)
//
// Calculate MACD and color background
fastMC = ema(src, fastLength)
slowMC = ema(src, slowLength)
macd = fastMC - slowMC
signal = sma(macd, signalLength)
OutputSignal = signal > macd ? 1 : signal < macd ? -1 : 0
bgcolor(OutputSignal>0?red: OutputSignal<0?green:yellow, transp=90)
plot(slowMC,color=blue,transp=0,title="Slow EMA trend line", linewidth=2)

// Calculate and draw the Price Action channel 
emaLo = ema(low,lenLo)
emaHi = ema(high,lenHi)
emaMe = ema(hl2,lenMe)
plot(emaLo,title="Low Price Line",style=line,color=gray,transp=0,linewidth=2)
plot(emaHi,title="High Price Line",style=line,color=gray,transp=0,linewidth=2)
plot(emaMe,title="Median Price Line",style=line,color=orange,transp=0,linewidth=2)

// Calculate CCI
cciVal = cci(src, len)

// Calculate CCI indicating continuance of trend.
isup = cciVal > lenUpper
isdown = cciVal < lenLower
barcolor(bars_on ? isup ? aqua : isdown ? black : na : na )

// Check have alert and use MACD filter
cciup_alert = isup and close>open and (not filterR or rsiVal>rsiUpper) and (not filterM or OutputSignal<0) and 
              (not filterE or (emaMe>slowMC and rising(slowMC,dCandles))) ? na(cciup_alert[1]) ? 1 : cciup_alert[1]+1 : 0
ccidn_alert = isdown and close<open and (not filterR or rsiVal<rsiLower) and (not filterM or OutputSignal>0) and 
              (not filterE or (emaMe<slowMC and falling(slowMC,dCandles))) ? na(ccidn_alert[1]) ? 1 : ccidn_alert[1]+1 : 0
//
plotshape(cciup_alert==1? cciup_alert : na, title="CCIPAT Up Arrow", style=shape.triangleup,location=location.belowbar, color=olive, transp=0, size=size.small)
plotshape(ccidn_alert==1? ccidn_alert : na, title="CCIPAT Down Arrow", style=shape.triangledown,location=location.abovebar, color=red, transp=0, size=size.small)

// generate an alert if required.
alertcondition(cciup_alert==1 or ccidn_alert==1, title="CCIPAT Alert", message="CCIPAT Alert")

//EOF
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out