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

Diamondarrow

#http://www.optionstrategi.com/

###########################################################

declare upper;

input n = 5;

#input showLines = yes;

def SMA10 = SimpleMovingAvg(close, 9);

def SMA21 = SimpleMovingAvg(close, 21);

def SMA40 = SimpleMovingAvg(close, 40);

#TTM_Squeeze

input price = CLOSE;

input length = 21;

input nK = 1.5;

input nBB = 2.0;

input displaceTTM = 0;

def TTM1 = TTM_Squeeze(price, length, nK, nBB);

def TTM_UP = TTM1 > TTM1[1];

def TTM_DN = TTM1 < TTM1[1];

rec countTTM = if TTM_UP == 1 and countTTM[1] == 0 then 1 else if TTM_DN == 0 and countTTM[1] >= 1
then countTTM[1] + 1 else 0;

rec countTTM1 = if TTM_DN == 1 and countTTM1[1] == 0 then 1 else if TTM_UP == 0 and countTTM1[1]
>= 1 then countTTM1[1] + 1 else 0;

def TTM_SIGNALup = TTM_UP == 1 and countTTM >= 1;

def TTM_SIGNALdn = TTM_DN == 1 and countTTM1 >= 1;


def DotTTMUp = if TTM_SIGNALup then low * (1 - displaceTTM) else Double.NaN;

def DotTTMDn = if TTM_SIGNALdn then high * (1 + displaceTTM) else Double.NaN;

#ADX

def ADXsignal = ADX(5);

#def ADXup = ADXsignal > ADXsignal[1];

def up = (ADXsignal >= 27) and (ADXsignal <= 75) and (ADXsignal > ADXsignal[1]);

AddLabel(1, Concat("ADX : ", ADXsignal), Color.BLACK);

#MACD

input fastLength = 8;

input slowLength = 17;

input MACDLength = 9;

input AverageType = {SMA, default EMA};

def MACD1 = MACD(fastLength, slowLength, MACDLength, AverageType).Value;

def Avg = MACD(fastLength, slowLength, MACDLength, AverageType).Avg;

AssignPriceColor(if MACD1 > Avg then Color.BLUE else if MACD1 < Avg then Color.RED else
Color.CURRENT);

input displace = .001;

def MACD_UP = MACD1 > Avg[1];

def MACD_DN = MACD1 < Avg[1];

rec count = if MACD_UP == 1 and count[1] == 0 then 1 else if MACD_DN == 0 and count[1] >= 1 then
count[1] + 1 else 0;
rec count1 = if MACD_DN == 1 and count1[1] == 0 then 1 else if MACD_UP == 0 and count1[1] >= 1 then
count1[1] + 1 else 0;

def MACD_SIGNALup = MACD_UP == 1 and count <= 6;

def MACD_SIGNALdn = MACD_DN == 1 and count1 <= 6;

def DotUp = if MACD_SIGNALup then low * (1 - displace) else Double.NaN;

def DotDn = if MACD_SIGNALdn then high * (1 + displace) else Double.NaN;

def slopUp = SMA21 > SMA40;

def slopdn = SMA21 < SMA40;

########CEK BB

input PriceBB = close;

input DisplaceBB = 0;

input LengthBB = 21;

input Deviation2 = 0.25;

input Deviation3 = 3.0;

def sDev = StDev(data = price[-displace], Length = length);

def MidLine = SimpleMovingAvg( Length = length);

def UpperBand2 = MidLine + Deviation2 * sDev;

def LowerBand2 = MidLine - Deviation2 * sDev;

def UpperBand3 = MidLine + Deviation3 * sDev;

def LowerBand3 = MidLine - Deviation3 * sDev;


def BBup = (high < UpperBand3) and (low >= UpperBand2);

def BBdn = (low > LowerBand3) and (high <= LowerBand2);

#####ATR#####

input ATR_Period = 5;

def R = Average(TrueRange(high, close, low), ATR_Period ) ;

def C = (high - low);

AddLabel (yes, "ATR : " + Round(R, 4), Color.DARK_GREEN );

#def ATRup = cek_ATR and (DailyATR < DailyATR[1]);

#######################################################

def PointUp = high > high[1];

def PointDn = low < low[1];

def PointCALL = open > SMA10;

def PointPUT = open < SMA10;

plot CALL = PointCALL and PointUp and DotUp and DotTTMUp and up and BBup and slopUp ;

CALL.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

CALL.SetDefaultColor(Color.BLUE);

CALL.SetLineWeight(4);

#AddVerticalLine(CALL, " CALL ", Color.blue, curve.Firm);

Alert(CALL, "CALL!! ", Alert.BAR, Sound.Ring);

plot PUT = PointPUT and PointDn and DotDn and DotTTMDn and up and BBdn and slopdn;

PUT.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

PUT.SetDefaultColor(Color.RED);

PUT.SetLineWeight(4);

#AddVerticalLine(PUT, " PUT ", Color.RED, curve.Firm);

Alert(PUT, "PUT!! ", Alert.BAR, Sound.Ring);


AddLabel(CALL, " CALL ", if CALL then Color.BLUE else Color.BLUE);

AddLabel(PUT , " PUT ", if PUT then Color.RED else Color.RED);

#Ob/Os

input evalPeriod = 30;

input overBought = -20;

input overSold = -80;

def WR = reference WilliamsPercentR( length = evalPeriod );

plot OB = If( ( WR[1] < overBought ) and ( WR[0] > overBought ), high, Double.NaN );

OB.SetStyle( Curve.POINTS );

OB.SetDefaultColor( Color.BLACK );

OB.SetLineWeight(4);

AddLabel(OB, " OverBOUGHT ", if OB then Color.BLACK else Color.BLACK);

def bConfirmCond1 = If( IsNaN( OB[1] ), 0, close > OB[1] );

def bConfirmCond2 = If( IsNaN( OB[2] ), 0, close > OB[2] );

def bConfirmCond3 = If( IsNaN( OB[3] ), 0, close > OB[3] );

def bConfirmCond4 = If( IsNaN( OB[4] ), 0, close > OB[4] );

def bConfirmCond5 = If( IsNaN( OB[5] ), 0, close > OB[5] );

def bisConfirmed = ( bConfirmCond1 + bConfirmCond2 + bConfirmCond3 + bConfirmCond4 +


bConfirmCond5 ) > 0;

AddLabel(bisConfirmed, " SIAP2 CALL ", if bisConfirmed then Color.BLUE else Color.BLUE);

plot SignalCALL = if ( ( bisConfirmed[0] == 1 ) and ( bisConfirmed[1] == 0 ) ) then low - ( 5 * TickSize() )


else Double.NaN;

SignalCALL.SetPaintingStrategy( PaintingStrategy.ARROW_UP );

SignalCALL.SetDefaultColor( Color.DARK_GREEN);

SignalCALL.SetLineWeight(2);

Alert(SignalCALL, "SIAP2 CALL !!!! Perhatikan Trend, Hindari Candle panjang", Alert.BAR, Sound.Ding);

#AddVerticalLine(SignalCALL , " SIAP2 CALL ", Color.dark_green, curve.Firm);


plot OS = If( ( WR[1] > overSold ) and ( WR[0] < overSold ), low, Double.NaN );

OS.SetStyle( Curve.POINTS );

OS.SetDefaultColor( Color.BLACK );

OS.SetLineWeight(4);

AddLabel(OS, " OverSOLD ", if OS then Color.BLACK else Color.BLACK);

def sConfirmCond1 = If( IsNaN( OS[1] ), 0, close < OS[1] );

def sConfirmCond2 = If( IsNaN(OS[2] ), 0, close < OS[2] );

def sConfirmCond3 = If( IsNaN( OS[3] ), 0, close < OS[3] );

def sConfirmCond4 = If( IsNaN( OS[4] ), 0, close < OS[4] );

def sConfirmCond5 = If( IsNaN( OS[5] ), 0, close < OS[5] );

def sisConfirmed = ( sConfirmCond1 + sConfirmCond2 + sConfirmCond3 + sConfirmCond4 +


sConfirmCond5 ) > 0;

AddLabel(sisConfirmed, " SIAP2 PUT ", if sisConfirmed then Color.RED else Color.RED);

plot signalPUT = if ( ( sisConfirmed[0] == 1 ) and ( sisConfirmed[1] == 0 ) ) then high + ( 5 * TickSize() )


else Double.NaN;

signalPUT.SetPaintingStrategy( PaintingStrategy.ARROW_DOWN );

signalPUT.SetDefaultColor( Color.DARK_RED );

signalPUT.SetLineWeight(2);

Alert(signalPUT, "SIAP2 PUT !!!! Perhatikan Trend ,hindari Candle panjang", Alert.BAR, Sound.Ding);

#AddVerticalLine(signalPUT, " SIAP2 PUT ", Color.dark_red, curve.Firm);

AssignPriceColor(if OS then Color.BLACK else if OB then Color.BLACK else Color.CURRENT);


Diamondarrow trend

#Update by OS

#http://www.optionstrategi.com/

###########################################################

input displace = 0;

input MA1_length = 3;

input MA2_length = 15;

input price = close;

DefineGlobalColor("RisingMA", color.BLUE);

DefineGlobalColor("FallingMA", color.RED);

input SimpleMovingAvg = {default Simple, Exponential, Weighted, Hull, Variable};

input movingAverageType2 = {default Variable, Simple, Exponential, Weighted, Hull};

def SMA1;

switch (SimpleMovingAvg) {

case Simple:

SMA1 = compoundValue(1, Average(price[-displace], MA1_length), price);


case Exponential:

SMA1 = compoundValue(1, ExpAverage(price[-displace], MA1_length), price);

case Weighted:

SMA1 = compoundValue(1, wma(price[-displace], MA1_length), price);

case Hull:

SMA1 = compoundValue(1, hullMovingAvg(price[-displace], MA1_length), price);

case Variable:

SMA1 = compoundValue(1, VariableMA(price = price, length = MA1_length), price);}

plot Trend1;

switch (movingAverageType2) {

case Simple:

Trend1 = compoundValue(1, Average(SMA1[-displace], MA2_length), SMA1);

case Exponential:

Trend1 = compoundValue(1, ExpAverage(SMA1[-displace], MA2_length), SMA1);

case Weighted:

Trend1 = compoundValue(1, wma(SMA1[-displace], MA2_length), SMA1);

case Hull:

Trend1 = compoundValue(1, hullMovingAvg(SMA1[-displace], MA2_length), SMA1);

case Variable:

Trend1 = compoundValue(1, VariableMA( SMA1, MA2_length), SMA1);}

Trend1.SetLineWeight(4);

Trend1.AssignValueColor(if Trend1 > Trend1[1] then globalColor("RisingMA") else


globalColor("FallingMA"));

Trend1.HideBubble();

rec sma3 = SimpleMovingAvg(close,3);

rec sma15 = SimpleMovingAvg(close,15);


def sma_15=sma15;

plot Slooping = sma3;

Slooping.AssignValueColor(if sma3 > sma15[1] then color.GREEN else (if sma3 < sma15[1] then
color.MAGENTA else color.YELLOW));

Slooping.SetLineWeight(2);

AddCloud(Trend1, Slooping, color.MAGENTA, color.YELLOW);

#addLabel(yes,"", color.blue);

DA shortly entry

#MACD

input fastLength = 8;

input slowLength = 17;

input MACDLength = 9;

input AverageType = {SMA, default EMA};

def MACD1 = MACD(fastLength, slowLength, MACDLength, AverageType).Value;

def Avg = MACD(fastLength, slowLength, MACDLength, AverageType).Avg;

AssignPriceColor(if MACD1 > Avg then Color.BLUE else if MACD1 < Avg then color.RED else color.current);

input displaces = .001;

def MACD_UP = MACD1 > Avg[1];

def MACD_DN = MACD1 < Avg[1];


rec count=if MACD_UP==1 and count[1]==0 then 1 else if MACD_DN==0 and count[1]>=1 then
count[1]+1 else 0;

rec count1=if MACD_DN==1 and count1[1]==0 then 1 else if MACD_UP==0 and count1[1]>=1 then
count1[1]+1 else 0;

def MACD_SIGNALup = MACD_UP==1 and count<=6;

def MACD_SIGNALdn= MACD_DN==1 and count1<=6;

def DotUp = if MACD_SIGNALup then Low * (1 - displaces) else double.nan;

def DotDn = if MACD_SIGNALdn then High * (1 + displaces) else double.nan;

#######

input price = close;

def MiddleLR = InertiaAll(price);

def dist = HighestAll(AbsValue(MiddleLR - price));

plot UpperLR = MiddleLR + dist;

UpperLR.setlineWeight(2);

UpperLR.setdefaultColor(color.red);

plot LowerLR = MiddleLR - dist;

LowerLR.setlineWeight(2);

LowerLR.setdefaultColor(color.BLUE);

input prices = close;

def MiddleLRs = InertiaAll(prices);

def dists = HighestAll(AbsValue(MiddleLRs - prices)) * 0.5;

def UpperLRs = MiddleLR + dists;

def LowerLRs = MiddleLR - dists;


def LineUp = LowerLRs > LowerLRs [1];

def LineDn = UpperLRs < UpperLRs[1];

def Signalup = open <LowerLRs and close > LowerLRs;

def SignalDn = open > UpperLRs and close < upperLRs;

def signalup2 = open <middleLRs and close>middleLRs;

def signaldn2 = open >middleLRs and close<middleLRs;

def pointUp = close < middleLRs;

def pointDn = close > middleLRs;

def pointUp2 = close < upperLRs;

def pointDn2 = close > lowerLRs;

Plot CALL = Signalup and LineUp and pointUp and dotUp;

CALL.setlineWeight(4);

CALL.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);

CALL.setdefaultColor(color.BLUE);

Plot PUT = SignalDn and LineDn and pointDn and dotDn;

PUT.setlineWeight(4);

PUT.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);

PUT.setdefaultColor(color.RED);

AddVerticalLine(CALL, " Short CALL ", Color.BLUE, curve.Firm);

alert(CALL,"Short PUT!! ",alert.bar,sound.RING);

AddVerticalLine(PUT, " Short PUT ", Color.RED, curve.Firm);

alert(PUT,"Short PUT!! ",alert.bar,sound.RING);

AddLabel(CALL, " Short CALL ", if CALL then Color.BLUE else color.BLUE);

AddLabel(PUT , " Short PUT ", if PUT then Color.RED else Color.RED);
######################HL#########

ATR REVERSAL

declare upper;

input sound = sound.Ding;

Input Digit = 3;

def alertType = alert.oNCE;

def ATR_hari_ini = WildersAverage(TrueRange(high(period = AggregationPeriod.DAY), close(period =


AggregationPeriod.DAY), low(period = AggregationPeriod.DAY)), 10);

def ATR_Kemarin = WildersAverage(TrueRange(high(period = AggregationPeriod.DAY)[1], close(period =


AggregationPeriod.DAY)[1], low(period = AggregationPeriod.DAY)[1]), 10);

def DeltaATR = ATR_Kemarin - ATR_hari_ini;

def ATR_over = DeltaATR <= 0; AddLabel(yes, "ATR Kemarin : "+ round(ATR_Kemarin,Digit)+" >> Sekarang
: "+ round(ATR_hari_ini,digit), if DeltaATR > 0 then Color.BLUE else Color.RED);

Alert(ATR_over, "A T R , Over ...!", alerttype, sound);

TAKE PROVIT DAYLI

declare upper;

input sound = sound.Ding;

Input Digit = 3;

def alertType = alert.oNCE;


def ATR_hari_ini = WildersAverage(TrueRange(high(period = AggregationPeriod.DAY), close(period =
AggregationPeriod.DAY), low(period = AggregationPeriod.DAY)), 10);

def ATR_Kemarin = WildersAverage(TrueRange(high(period = AggregationPeriod.DAY)[1], close(period =


AggregationPeriod.DAY)[1], low(period = AggregationPeriod.DAY)[1]), 10);

def TP= ATR_Kemarin/4;

AddLabel(1, concat("Take Profit Daily : ",TP), Color.BLUE);

DA LOWER

#http://www.optionstrategi.com/

###########################################################

declare lower ;

input price = close;

input BBlength = 10;

input BBNum_Dev = 1.0;

input MACDfastLength = 12;

input MACDslowLength = 26;

input MACDLength = 9;

#input simpleMovingAvg=0;

#def SMA = simpleMovingAvg;


def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength =
MACDLength);

plot MACD_Dots = MACD_Data;

plot MACD_Line = MACD_Data;

plot BB_Upper = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn =


-BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;

plot BB_Lower = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn =


-BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;

plot BB_Midline = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn =


-BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;

BB_Upper.SetDefaultColor(Color.GRAY);

BB_Lower.SetDefaultColor(Color.GRAY);

BB_Midline.SetDefaultColor(Color.GRAY);

BB_Midline.SetStyle(Curve.SHORT_DASH);

MACD_Line.SetDefaultColor(Color.WHITE);

MACD_Dots.SetStyle(Curve.FIRM);

MACD_Dots.SetLineWeight(3);

MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] then Color.GREEN else Color.RED);

plot zero = 0;

zero.AssignValueColor(if MACD_Line < 0 then Color.RED else Color.DARK_GREEN);

zero.SetLineWeight(2);

AddLabel (zero, "cross", if MACD_Line < 0 then Color.RED else Color.DARK_GREEN);

AddVerticalLine(zero, " CROSS ", if MACD_Line < 0 then Color.RED else Color.BLACK);
#RSI#

#declare lower;

plot rsi1 = if reference RSI(length = 14)."RSI" >= 50 then 3 else 2.5;

plot rsi2 = if reference RSI(length = 14)."RSI" < 50 then 3 else 2.5;

AddCloud(rsi1, rsi2, Color.GREEN, Color.RED);

plot dmi1 = if DMI(length = 14)."DI+" >= DMI(length = 14)."DI-" then 1.75 else 1.5;

plot dmi2 = if DMI(length = 14)."DI+" < DMI(length = 14)."DI-" then 1.75 else 1.5;

AddCloud(dmi1, dmi2, Color.GREEN, Color.RED);

plot sto1 = if StochasticMomentumIndex()."SMI" >= StochasticMomentumIndex()."AvgSMI" then 1 else


0.5;

plot sto2 = if StochasticMomentumIndex()."SMI" < StochasticMomentumIndex()."AvgSMI" then 1 else


0.5;

AddCloud(sto1, sto2, Color.GREEN, Color.RED);

rsi1.SetDefaultColor(Color.GREEN);

rsi2.SetDefaultColor(Color.RED);

dmi1.SetDefaultColor(Color.GREEN);

dmi2.SetDefaultColor(Color.RED);

sto1.SetDefaultColor(Color.GREEN);

sto1.SetLineWeight(1);

sto2.SetDefaultColor(Color.RED);

sto2.SetLineWeight(1);

#addLabel(yes,"Diamond", color.dark_green);

AddLabel(yes, " Diamond ", Color.BLUE);

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