Sei sulla pagina 1di 6

Menentukan Trend

Trend = 3.5 x ATR Trailing STOP dgn SD 2.5 offset

PUT Spread : price di atas ATR Trailing Stop dan dibawah SD Offset

Call Spread : price below ATR Trailing stop dan di atas SD offset

Jika Price SPX diluar area ATR dan SD, NO TRADE

Entry:

1. Sell 10 delta SPX weekly options dgn spread 10


2. Ambil initial credit > 0.4
3. Close spread jika diperoleh 80% initial credit
4. Stop loss = 100% intial credit
5. Trend di lihat dgn 2,5 x ATR Trailing STOP menggunakan TF 5 hari

Indicator

##Theta Trend ATR Trailing Stop with Standard Deviation Offset


##ATRts code from TOS, modified to include SD Offset
##www.thetatrend.com

input trailType = {default modified, unmodified};


input ATRPeriod = 5;
input ATRFactor = 3.5;
input firstTrade = {default long, short};
input price = close;
input length = 10;
input OSfactor = 2.5;

assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);

def StdDev = stdev(price,length)*OSfactor;


def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
def HRef = if low <= high[1] then high - close[1] else (high - close[1]) -
0.5 * (low - high[1]); def LRef = if high >= low[1]
then close[1] - low
else (close[1] - low) - 0.5 * (low[1] - high);
def ATRMod = ExpAverage(Max(HiLo, Max(HRef, LRef)), 2 * ATRPeriod - 1);

def loss;
switch (trailType) {
case modified:
loss = ATRFactor * ATRMod;
case unmodified:
loss = ATRFactor * AvgTrueRange(high, close, low, ATRPeriod);
}

rec state = {default init, long, short};


rec trail;
rec trail2;
switch (state[1]) {
case init:
if (!IsNaN(loss)) {
switch (firstTrade) {
case long:
state = state.long;
trail = close - loss;
trail2 = close - loss + StdDev;
case short:
state = state.short;
trail = close + loss;
trail2 = close + loss - StdDev;
}
} else {
state = state.init;
trail = Double.NaN;
trail2 = Double.NaN;
}
case long:
if (close > trail[1]) {
state = state.long;
trail = Max(trail[1], close - loss);
trail2 = Max(trail2[1], (close - loss + StdDev));
}
else {
state = state.short;
trail = close + loss;
trail2 = close + loss - StdDev;
}
case short:
if (close < trail[1]) {
state = state.short;
trail = Min(trail[1], close + loss);
trail2 = Min(trail2[1], (close + loss - StdDev));
}
else {
state = state.long;
trail = close - loss;
trail2 = close - loss + StdDev;
}
}

def BuySignal = Crosses(state == state.long, 0, CrossingDirection.Above);


def SellSignal = Crosses(state == state.short, 0, CrossingDirection.Above);

plot TrailingStop = trail;


plot SDoffset = trail2;

TrailingStop.SetPaintingStrategy(PaintingStrategy.POINTS);
TrailingStop.DefineColor("Buy", GetColor(0));
TrailingStop.DefineColor("Sell", GetColor(1));
TrailingStop.AssignValueColor(if state == state.long
then TrailingStop.color("Sell")
else TrailingStop.color("Buy"));

Zscore
#Computes and plots the Zscore
#Provided courtesy of ThetaTrend.com
#Feel free to share the indicator, but please provide a link back to ThetaTrend.com

declare lower;

input price = close;


input length = 20;
input ZavgLength = 20;

#Initialize values
def oneSD = stdev(price,length);
def avgClose = simpleMovingAvg(price,length);
def ofoneSD = oneSD*price[1];
def Zscorevalue = ((price-avgClose)/oneSD);
def avgZv = average(Zscorevalue,20);

#Compute and plot Z-Score


plot Zscore = ((price-avgClose)/oneSD);
Zscore.setPaintingStrategy(paintingStrategy.HISTOGRAM);
Zscore.setLineWeight(2);
Zscore.assignValueColor(if Zscore > 0 then color.green else color.red);

plot avgZscore = average(Zscorevalue,ZavgLength);


avgZscore.setPaintingStrategy(paintingStrategy.LINE);

#This is an optional plot that will display the momentum of the Z-Score average
#plot momZAvg = (avgZv-avgZv[5]);

#Plot zero line and extreme bands


plot zero = 0;
plot two = 2;
plot negtwo = -2;
zero.setDefaultColor(color.black);

1JP

TF 1 day 5 m

TTM_Squeeze (Close,20,1.5,2.0,1.0)

Trend indicator

Scalping

Potrebbero piacerti anche