Вы находитесь на странице: 1из 4

The Option Guru

Instructions:
1) These are not importable studies.
2) In a TOS chart, select "Edit Studies and Strategies"
3) Click the "New..." button in the lower left on the panel
4) Give the study a new name - no spaces. OK, flatter me by using my study name.
Make sure you have the thinkscript Editor selected.
5) Select the text in this document between the
"//////////COPY BELOW THIS LINE//////////"
and
"//////////COPY ABOVE THIS LINE//////////"
6) Paste it into your new study
7) The editor will validate your code. If there are no errors, click OK.
8) Tweak the study as you wish under "Properties"
9) Happy Trading
--------------------------------------------------------------------------Timeframe: 1 to 5 Studies (used for 1:5 timeframe fractals)
OG_MACD_1to5
For manual setup:
Short ema=3
Long ema=10
ema of MACD=15
Turn histogram off
---------------------------------------------------------------------//////////COPY BELOW THIS LINE//////////
# OG_MACD_1to5_v2
# jeff@theoptionguru.com
# Last Update 12/9/2013
declare lower;
input
input
input
input

fastLength = 3;
slowLength = 10;
MACDLength = 15;
AverageType = {SMA, default EMA};

plot Value;
plot Avg;
switch (AverageType) {
case SMA:
Value = Average(close, fastLength) - Average(close, slowLength);
Avg = Average(Value, MACDLength);
case EMA:
Value = ExpAverage(close, fastLength) - ExpAverage(close, slowLength);
Avg = ExpAverage(Value, MACDLength);
}
Avg.AssignValueColor(if Avg > Avg[1] then color.white else (if Avg == Avg[1] the
n color.white else color.magenta));
Avg.SetLineWeight(2);
plot Diff = Value - Avg;

plot ZeroLine = 0;
Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.AssignValueColor(if DIFF > DIFF[1] then color.green else (if DIFF == DIFF[1
] then color.green else color.red));
ZeroLine.SetDefaultColor(GetColor(0));
//////////COPY ABOVE THIS LINE//////////
------------------------------------------------------------------------------OG_Stochastic_1to5
For manual setup:
%K:3
%K smoothing:1
%D:3

//////////COPY BELOW THIS LINE//////////


# OG_Stochastic_1to5_v2
# jeff@theoptionguru.com
# Last Update 12/9/2013
declare lower;
input MidLine1 = 55;
input MidLine2 = 45;
input over_bought = 80;
input over_sold = 20;
input KPeriod = 3;
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 2;
input smoothingType = 1;
input length = 50;
input displace = 0;
def Trnd = Average(close[-displace], length);
def c1 = priceC - Lowest(priceL, KPeriod);
def c2 = Highest(priceH, KPeriod) - Lowest(priceL, KPeriod);
def FastK = c1 / c2 * 100;
plot FullK;
plot FullD;
if smoothingType == 1
then {
FullK = Average(FastK, slowing_period);
FullD = Average(FullK, DPeriod);
} else {
FullK = ExpAverage(FastK, slowing_period);
FullD = ExpAverage(FullK, DPeriod);
}
plot OverBought = over_bought;
plot OverSold = over_sold;

plot MdLn1 = MidLine1;


plot MdLn2 = MidLine2;
FullD.AssignValueColor(if FullD > FullD[1] then Color.White else (if FullD == Fu
llD[1] then Color.White else Color.Magenta));
FullD.SetLineWeight(1);
FullK.AssignValueColor(if FullK > FullK[1] then color.green else color.red);
FullK.SetLineWeight(3);
MdLn1.SetDefaultColor(GetColor(3));
MdLn2.SetDefaultColor(GetColor(3));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));
;
//////////COPY ABOVE THIS LINE//////////
----------------------------------------------------------------Simple Moving Average (up is green, down is red)
//////////COPY BELOW THIS LINE//////////
# OG_SMA
# jeff@theoptionguru.com
# Last Update 7/18/2012
input price = close;
input length = 50;
input displace = 0;
plot SMA = Average(price[-displace], length);
SMA.AssignValueColor(if SMA > SMA[1] then color.green else (if SMA == SMA[1] the
n color.black else color.red));
SMA.SetLineWeight(3);
//////////COPY ABOVE THIS LINE//////////
----------------------------------------------------------------20 Period Exponential Moving Average (up is light green and down is light orange
)
//////////COPY BELOW THIS LINE//////////
input price = close;
input length = 20;
input displace = 0;
plot AvgExp = ExpAverage(price[-displace], length);
AvgExp.AssignValueColor(if AvgExp > AvgExp[1] then color.light_green else (if Av
gExp == AvgExp[1] then color.light_green else color.light_orange));
AvgExp.SetLineWeight(2);
//////////COPY ABOVE THIS LINE//////////
----------------------------------------------------------------Exponential Moving Average. Up is White and down is magenta.

//////////COPY BELOW THIS LINE//////////


# OG_EMA
# jeff@theoptionguru.com
# Last Update 1/23/2013
input price = close;
input length = 9;
input displace = 0;
plot AvgExp = ExpAverage(price[-displace], length);
AvgExp.AssignValueColor(if AvgExp > AvgExp[1] then color.white else (if AvgExp =
= AvgExp[1] then color.white else color.magenta));
AvgExp.SetLineWeight(3);
//////////COPY ABOVE THIS LINE//////////
----------------------------------------------------------------------------------------------------IV Percentile Script:
1) Go to 'Charts' tab
2) Click on the "eye-dropper" icon (officially called "edit studies icon"...same
line where you type in the ticker same symbol, first icon moving left to right)
3) Click on "New"... Lower left hand corner
4) Delete everything in the box. (plot Data = close;)
5) Paste the entire code listed below
6) Name the Study
7) Click 'OK'
8) Click 'Apply'
9) Click 'OK'
//////////COPY below THIS LINE//////////
declare upper;
input period = AggregationPeriod.DAY ;
#hint period: time period to use for aggregating implied volatility.
input length =252 ;
#hint length: #bars to use in implied volatility calculation.
def ivGapHi = if isnan(imp_volatility(period=period)) then 99999999999 else imp_
volatility(period=period);
def ivGapLo = if isnan(imp_volatility(period=period)) then -99999999999 else imp
_volatility(period=period);
def periodHigh = highest( ivGapLo,length=length);
def periodLow = lowest( ivGapHi, length=length);
def ivRange = periodHigh - periodLow ;
def ivp = round( 100*(imp_volatility(period=period) - periodLow)/ivRange, 0);
AddLabel(1, Concat("IV% ", ivp), if ivp > 80
then Color.Green
else if ivp < 80 and ivp > 50
then Color.Yellow
else color.Red);
//////////COPY ABOVE THIS LINE//////////
Hints:
a) Use 252 as input length for 1-year or 52-week IV percentile
b) You can change 252 to 189 for 9-month IV percentile
c) You can change 252 to 126 for 6-month IV percentile

Вам также может понравиться