# CM_Williams_Vix_Fix

1328 просмотров
mistudy("CM_Williams_Vix_Fix", overlay=false)
//1 - CM WILLIAMS
pd = input(22, title="LookBack Period Standard Deviation High")
bbl = input(20, title="Bolinger Band Length")
mult = input(2.0 , minval=1, maxval=5, title="Bollinger Band Standard Devaition Up")
lb = input(50 , title="Look Back Period Percentile High")
ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")
pl = input(1. 01 , title="Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%")
hp = input(true, title="Show High Range - Based on Percentile and LookBack Period?")
sd = input(true, title="Show Standard Deviation Line?")

wvf = ((highest(close, pd )-low)/(highest(close, pd )))*100

sDev = mult * stdev(wvf, bbl )
midLine = sma (wvf, bbl )
lowerBand = midLine - sDev
upperBand = midLine + sDev

rangeHigh = (highest(wvf, lb )) * ph
rangeLow = (lowest(wvf, lb )) * pl

col = wvf >= upperBand or wvf >= rangeHigh ? lime : gray

//plot( hp and rangeHigh ? rangeHigh : na, title="Range High Percentile", style=line, linewidth=4, color=orange)
//plot( hp and rangeLow ? rangeLow : na, title="Range High Percentile", style=line, linewidth=4, color=orange)
//plot(wvf, title="Williams Vix Fix", style=histogram, linewidth = 4, color=col)
//plot( sd and upperBand ? upperBand : na, title="Upper Band", style=line, linewidth = 3, color=aqua)

//2 - CM STOCH
//Created by ChrisMoody on October 23, 2014 by user request - platinumFX
//Defaults to current timeframe Ability to change to different timeframe, or plot two RSI's on different timeframes.
//study(title="CM_Stochastic_MTF", shorttitle="CM_Stoch_MTF")
len = input(14, minval=1, title="Length for Main Stochastic")
smoothK = input(3, minval=1, title="SmoothK for Main Stochastic")
smoothD = input(3, minval=1, title="SmoothD for Main Stochastic")
upLine = input(80, minval=50, maxval=90, title="Upper Line Value?")
lowLine = input(20, minval=10, maxval=50, title="Lower Line Value?")
sml = input(true, title="Show Mid Line?")
sbh = input(false, title="Show Back Ground Highlights When Stoch is Above/Below High/Low Lines?")
sch = input(true, title="Show Back Ground Highlights When Stoch Cross - Strict Criteria - K Greater/LesThan High/Low Line - Crosses D ?")
sl = input(true, title="Show 'B' and 'S' Letters When Stoch Crosses High/Low Line & D?")
sac = input(false, title="Show Back Ground Highlights When Stoch Cross - Any Cross?")
sacl = input(false, title="Show 'B' and 'S' Letters When Stoch Crosses - Any Cross?")
useCurrentRes = input(true, title="Use Current Chart Resolution?")
resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="60")
ssStoch = input(false, title="Show 2nd Stoch?")
resCustom2 = input(title="Use 2nd Stoch? Check Box Above", type=resolution, defval="D")
useCurrentRes2 = input(false, title="Use 2nd Stoch Plot On Samet Timeframe?")
len2 = input(14, minval=1, title="2nd Stoch Length")
smoothK2 = input(3, minval=1, title="SmoothK for 2nd Stoch")
smoothD2 = input(3, minval=1, title="SmoothD for 2nd Stoch")
//Resolutioon for MTF
res = useCurrentRes ? period : resCustom
res2 = useCurrentRes2 ? period : resCustom2
// Stoch formula
k = sma ( stoch (close, high, low, len ), smoothK)
d = sma (k, smoothD)
outK = security(tickerid, res, k)
outD = security(tickerid, res, d)
//Optional 2nd Stoch for additional plot
k2 = sma ( stoch (close, high, low, len2), smoothK2)
d2 = sma (k2, smoothD2)
outK2 = security(tickerid, res2, k2)
outD2 = security(tickerid, res2, d2)
//definitions for Cross
aboveLine = outK > upLine ? 1 : 0
belowLine = outK < lowLine ? 1 : 0
crossUp = (outK < outD and outK < lowLine) and (outK > outD) ? 1 : 0
crossDn = (outK > outD and outK > upLine) and (outK < outD) ? 1 : 0
//Definition for Cross that doesn't have to be above or below High and Low line.
crossUpAll = (outK < outD and outK > outD) ? 1 : 0
crossDownAll = (outK > outD and outK < outD) ? 1 : 0
//BackGroound Color Plots
//bgcolor( sbh and aboveLine ? red : na, transp=70)
//bgcolor( sbh and belowLine ? lime : na, transp=70)
//bgcolor(sch and crossUp ? lime : na, transp=40)
//bgcolor(sch and crossDn ? red : na, transp=40)
//plots for Cross with no filter
//bgcolor(sac and crossUpAll ? lime : na, transp=40)
//bgcolor(sac and crossDownAll ? red : na, transp=40)
//Plot main Stochastic
//plot(outK, title="Stoch K", style=line, linewidth=3, color=lime)
//plot(outD, title="Stoch D", style=line, linewidth=3, color=red)
// Ability to plot 2nd Stoch
//plot(ssStoch and outK2 ? outK2 : na, title="2nd Stoch K - Different TimeFrame", style=line, linewidth=3, color=orange)
//plot(ssStoch and outD2 ? outD2 : na, title="2nd Stoch D - Different TimeFrame", style=line, linewidth=3, color=yellow)

//p1 = plot(upLine, title= "Upper Line", style=solid, linewidth=3, color=red)
//p2 = plot(lowLine, title= "Lower Line", style=solid, linewidth=3, color=lime)
//plot( sml and 50 ? 50 : na, title="Mid Line", style=linebr, linewidth=2, color=gray)
//plotchar(sl and crossUp ? crossUp : na, title="Buy Signal Strict Criteria", char='B', location=location.bottom, color=lime, transp=0, offset=0)
//plotchar(sl and crossDn ? crossDn : na, title="Sell Signal Strict Criteria", char='S', location=location.top, color=red, transp=0, offset=0)
//plotchar(sacl and crossUpAll ? crossUpAll : na, title="Buy Signal Any Cross Up", char='B', location=location.bottom, color=lime, transp=0, offset=0)
//plotchar(sacl and crossDownAll ? crossDownAll : na, title="Sell Signal Any Cross Down", char='S', location=location.top, color=red, transp=0, offset=0)
//fill(p1, p2, color=silver, transp=70)

//3 - RSI
//Created by ChrisMoody
//Based on Larry Connors RSI-2 Strategy - Lower RSI
//study(title="_CM_RSI_2_Strat_Low", shorttitle="_CM_RSI_2_Strategy_Lower", overlay=false)
src = close,

// RSI CODE
up = rma(max(change( src ), 0), 2)
down = rma(-min(change( src ), 0), 2)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
//Criteria for Moving Avg rules
ma5 = sma (close,5)
ma200= sma (close, 200)

//Rule for RSI Color
colRsi = close > ma200 and close < ma5 and rsi < 10 ? lime : close < ma200 and close > ma5 and rsi > 90 ? red : silver

//plot( rsi , title="RSI", style=line, linewidth=4,color=colRsi)
//plot(100, title="Upper Line 100",style=line, linewidth=3, color=aqua)
//plot(0, title="Lower Line 0",style=line, linewidth=3, color=aqua)

//band1 = plot(90, title="Upper Line 90",style=line, linewidth=3, color=aqua)
//band0 = plot(10, title="Lower Line 10",style=line, linewidth=3, color=aqua)
//fill(band1, band0, color=silver, transp=90)

//4 - Indicator
plotarrow( wvf >= (rangeHigh - rangeLow) ? 1 : na, title="Down Entry Arrow", colorup=#000080, maxheight=20, minheight=20, transp=0)
plotarrow( wvf <= rangeLow*2 ? -1 : na, title="Up Entry Arrow", colordown=#000000, maxheight=20, minheight=20, transp=0)

bgcolor( sbh and aboveLine ? red : na, transp=70)
bgcolor( sbh and belowLine ? lime : na, transp=70)
bgcolor(sch and crossUp ? lime : na, transp=40)
bgcolor(sch and crossDn ? red : na, transp=40)
//plots for Cross with no filter
bgcolor(sac and crossUpAll ? lime : na, transp=40)
bgcolor(sac and crossDownAll ? red : na, transp=40)

plotarrow( rsi <= 10 ? 1 : na, title="RSI Down Entry Arrow", colorup=#006400, maxheight=70, minheight=70, transp=80)
plotarrow( rsi >= 90 ? -1 : na, title="RSI Up Entry Arrow", colordown=#8B0000, maxheight=70, minheight=70, transp=80)

## Комментарии

HOW TO USE FILTERED ENTRY PLS?
Ответить