Sei sulla pagina 1di 16

1

# Arnold_PPS / 18062014

# 085.850.878.878 / 081.230.878.878

input Alarm_On = yes;

input sound = Sound.Ring;

input ShowTodayOnly = no;

def Today = if !ShowTodayOnly then 1 else if GetDay() == GetLastDay() then 1 else 0;

def space = Average(high - low) / 4;

plot Call = if !Today then Double.NaN else PPS().buySignal - space;

Call.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

call.setDefaultColor (color.GREEN);

Call.SetLineWeight(5);

Alert(Alarm_On && Call, “CALL”, Alert.BAR, sound);

plot Put = if !Today then Double.NaN else PPS().sellSignal + space;

Put.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

put.setDefaultColor (color.red);

Put.SetLineWeight(5);

Alert(Alarm_On && Put, “PUT”, Alert.BAR, sound);


2

script OpenRange {

input ORtime = 5;

def FirstBar = GetDay() != GetDay()[1];

def RangeTime = SecondsFromTime(0930) >= 0 and SecondsFromTime(0930) < 60 * ORtime;

def Rhigh = if FirstBar then high else if RangeTime and high > Rhigh[1] then high else Rhigh[1];

def Rlow = if FirstBar then low else if RangeTime and low < Rlow[1] then low else Rlow[1];

plot h = if RangeTime then Double.NaN else Rhigh;

plot l = if RangeTime then Double.NaN else Rlow;

def first30 = SecondsFromTime(0930) >= 0 and SecondsTillTime(1000) >= 0;

def today = GetLastDay() == GetDay();

def ATR = AvgTrueRange(high, close, low, 10);

plot yHigh = if !today then Double.NaN else high(period = "day" )[1];

yHigh.SetDefaultColor(Color.CYAN);

plot yLow = if !today then Double.NaN else low(period = "day" )[1];

yLow.SetDefaultColor(Color.PINK);

plot h5 = if !today then Double.NaN else if !first30 then Double.NaN else OpenRange(5).h;

h5.SetDefaultColor(Color.YELLOW);

plot l5 = if !today then Double.NaN else if !first30 then Double.NaN else OpenRange(5).l;
l5.SetDefaultColor(Color.YELLOW);

plot h30 = if !today then Double.NaN else OpenRange(30).h;

h30.SetDefaultColor(Color.YELLOW);

plot l30 = if !today then Double.NaN else OpenRange(30).l;

l30.SetDefaultColor(Color.YELLOW);

def lowConf = if first30 then Min(yLow, l5) - ATR else Min(yLow, l30) - ATR;

def highConf = if first30 then Max(yHigh, h5) + ATR else Max(yHigh, h30) + ATR;

plot lc1 = if first30 then lowConf else Double.NaN;

lc1.SetDefaultColor(Color.ORANGE);

plot lc2 = if !first30 then lowConf else Double.NaN;

lc2.SetDefaultColor(Color.ORANGE);

plot hc1 = if first30 then highConf else Double.NaN;

hc1.SetDefaultColor(Color.ORANGE);

plot hc2 = if !first30 then highConf else Double.NaN;

hc2.SetDefaultColor(Color.ORANGE);

def decisionL = if close > lowConf then Double.NaN else if close crosses below lowConf then low else
decisionL[1];

def decisionH = if close < highConf then Double.NaN else if close crosses above highConf then high else
decisionH[1];

plot dL = if !today then Double.NaN else decisionL;

dL.SetDefaultColor(Color.WHITE);

plot dH = if !today then Double.NaN else decisionH;


dH.SetDefaultColor(Color.WHITE);

def TL = CompoundValue(1, if IsNaN(dL) then Double.NaN else if !IsNaN(TL[1]) then TL[1] else if close
crosses below dL then dL - 2 * ATR else Double.NaN, Double.NaN);

def SL = CompoundValue(1, if IsNaN(dL) then Double.NaN else if !IsNaN(SL[1]) then SL[1] else if close
crosses below dL then dL + 2 * ATR else Double.NaN, Double.NaN);

plot Target1Low = if !today then Double.NaN else TL;

Target1Low.SetDefaultColor(Color.GREEN);

Target1Low.SetStyle(Curve.SHORT_DASH);

plot Stop1Low = if !today then Double.NaN else SL;

Stop1Low.SetDefaultColor(Color.RED);

Stop1Low.SetLineWeight(2);

AddChartBubble(IsNaN(TL[1]) and !IsNaN(TL), TL, "Target 1\n" + Round(TL, 2), Color.GREEN, no);

AddChartBubble(IsNaN(SL[1]) and !IsNaN(SL), SL, "Stop\n" + Round(SL, 2), Color.RED);

def TH = CompoundValue(1, if IsNaN(dH) then Double.NaN else if !IsNaN(TH[1]) then TH[1] else if close
crosses above dH then dH + 2 * ATR else Double.NaN, Double.NaN);

def SH = CompoundValue(1, if IsNaN(dH) then Double.NaN else if !IsNaN(SH[1]) then SH[1] else if close
crosses above dH then dH - 2 * ATR else Double.NaN, Double.NaN);

plot Target1High = if !today then Double.NaN else TH;

Target1High.SetDefaultColor(Color.GREEN);

Target1High.SetStyle(Curve.SHORT_DASH);

plot Stop1High = if !today then Double.NaN else SH;

Stop1High.SetDefaultColor(Color.RED);
Stop1High.SetLineWeight(2);

AddChartBubble(IsNaN(TH[1]) and !IsNaN(TH), TH, "Target 1\n" + Round(TH, 2), Color.GREEN);

AddChartBubble(IsNaN(SH[1]) and !IsNaN(SH), SH, "Stop\n" + Round(SH, 2), Color.RED, no);

# E-Charts v2

declare upper;

input short_average = 5;

input medium_average = 10;

input long_average = 20;

input average_type = {default "SMA", "EMA"};

input show_vertical_line = no;

input show_bubble_labels = yes;

def MA1;

def MA2;

def MA3;

switch (average_type) {

case "SMA":

MA1 = Average(close, short_average);

MA2 = Average(close, medium_average);

MA3 = Average(close, long_average);

case "EMA":
MA1 = ExpAverage(close, short_average);

MA2 = ExpAverage(close, medium_average);

MA3 = ExpAverage(close, long_average);

# define e-signal and crossover point

def Eup = MA1 > MA2 && MA2 > MA3;

def Edn = MA1 < MA2 && MA2 < MA3;

def CrossUp = close > MA1 && Eup && !Eup[1];

def CrossDn = close < MA1 && Edn && !Edn[1];

# Define up and down signals

def higherHigh = close > Highest(max(open,close), 3)[1];

def lowerLow = close < Lowest(min(open,close), 3)[1];

def SignalUp = if (CrossUp && higherHigh)

then 1

else if (CrossUp[1] && higherHigh && !higherHigh[1])

then 1

else if (CrossUp[2] && higherHigh && !higherHigh[1] && !higherHigh[2])

then 1

else Double.NaN;

def SignalDn = if (CrossDn && lowerLow)

then 1

else if (CrossDn[1] && lowerLow && !lowerLow[1])


then 1

else if (CrossDn[2] && lowerLow && !lowerLow[1] && !lowerLow[2])

then 1

else Double.NaN;

# Plot the moving average lines

plot ln1 = MA1;

ln1.SetDefaultColor(CreateColor(145, 210, 144));

ln1.SetLineWeight(2);

plot ln2 = MA2;

ln2.SetDefaultColor(CreateColor(111, 183, 214));

ln2.SetLineWeight(2);

plot ln3 = MA3;

ln3.SetDefaultColor(CreateColor(249, 140, 182));

ln3.SetLineWeight(2);

# Draw vertical line to indicate call and put signals

AddVerticalLine(SignalUp && show_vertical_line, "Up", Color.UPTICK);

AddVerticalLine(SignalDn && show_vertical_line, "Down", Color.LIGHT_RED);

# Show Call / Put Signal in a Chart Bubble

AddChartBubble(SignalUp && show_bubble_labels, low - 0.3, "Up", Color.UPTICK, no);

AddChartBubble(SignalDn && show_bubble_labels, high + 0.3, "Dn", Color.LIGHT_RED);

# Add label for Eup or Edn


AddLabel(Eup, "E Up", Color.GREEN);

AddLabel(Edn, "E Dn", Color.RED);

#start

#hint: <b>Ask SLM Ribbon</b>\nThe Ask SLM Ribbon is a momentum indicator that uses a combination
of three exponential moving averages. When the averages are in alinement, with the "superfast" moving
average above the "fast" moving average and the fast moving average above the "slow" moving
average, the momentum condition is positive. A "buy signal" is generated, with an up arrow, when
above conditions are met and a "clear bar" occurs; with the low of that bar is above all of the moving
averages. The positive momentum ends if the superfast moving average touches the fast moving
average; then condition is considered neutral and an oppostive arrow will appear. Negative momentum
and a "Sell signal" are the opposite of the bullish conditions. \n \n\n------------------------------------------------
--------------------------------\nVolume bars can be colored to match the Chart by clicking on
Style>Settings>Appearance>Common, and color symbol as ticks \n

input price = close;

input superfast_length = 8;

input fast_length = 13;

input slow_length = 21;

input displace = 0;

def mov_avg8 = ExpAverage(price[-displace], superfast_length);

def mov_avg13 = ExpAverage(price[-displace], fast_length);

def mov_avg21 = ExpAverage(price[-displace], slow_length);

#moving averages

Plot Superfast = mov_avg8;

plot Fast = mov_avg13;


plot Slow = mov_avg21;

def buy = mov_avg8 > mov_avg13 and mov_avg13 > mov_avg21 and low > mov_avg8;

def stopbuy = mov_avg8 <= mov_avg13;

def buynow = !buy[1] and buy;

def buysignal = CompoundValue(1, if buynow and !stopbuy then 1 else if buysignal[1]==1 and stopbuy
then 0 else buysignal[1], 0);

plot Buy_Signal = buysignal[1] == 0 and buysignal==1;

Buy_signal.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

Buy_signal.setdefaultColor(color.dark_GREEN);

Buy_signal.hidetitle();

Alert(condition = buysignal[1] == 0 and buysignal == 1, text = "Buy Signal", sound = Sound.Bell, "alert
type" = Alert.BAR);

plot Momentum_Down = buysignal[1] ==1 and buysignal==0;

Momentum_down.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

Momentum_Down.setdefaultColor(color.plum);

Momentum_down.hidetitle();

Alert(condition = buysignal[1] == 1 and buysignal == 0, text = "Momentum_Down", sound = Sound.Bell,


"alert type" = Alert.BAR);

def sell = mov_avg8 < mov_avg13 and mov_avg13 < mov_avg21 and high < mov_avg8;

def stopsell = mov_avg8 >= mov_avg13;

def sellnow = !sell[1] and sell;


def sellsignal = CompoundValue(1, if sellnow and !stopsell then 1 else if sellsignal[1]==1 and stopsell
then 0 else sellsignal[1], 0);

Plot Sell_Signal = sellsignal[1] ==0 and sellsignal;

Sell_signal.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);

sell_signal.setDefaultColor(color.red);

Sell_signal.hidetitle();

Alert(condition = sellsignal[1] == 0 and sellsignal == 1, text = "Sell Signal", sound = Sound.Bell, "alert
type" = Alert.BAR);

Plot Momentum_Up = sellsignal[1]==1 and sellSignal==0;

Momentum_up.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_up);

Momentum_up.setDefaultColor(color.plum);

Momentum_up.hidetitle();

Alert(condition = sellsignal[1] == 1 and sellSignal == 0, text = "Momentum_Up", sound = Sound.Bell,


"alert type" = Alert.BAR);

plot Colorbars = if buysignal ==1 then 1 else if sellsignal ==1 then 2 else if buysignal ==0 or sellsignal==0
then 3 else 0;

colorbars.hide();

Colorbars.definecolor("Buy_Signal_Bars", color.dark_green);

Colorbars.definecolor("Sell_Signal_Bars", color.red);

Colorbars.definecolor("Neutral", color.plum);
AssignPriceColor(if Colorbars ==1 then colorbars.color("buy_signal_bars") else if colorbars ==2 then
colorbars.color("Sell_Signal_bars") else colorbars.color("neutral"));

#end

#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);

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

### By. Ivan Kurniawan ##

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

declare upper;

input n = 5;

input simpleMovingAvg = 0;

input showLines = yes;

def SMA5 = simpleMovingAvg(close, 7);

#SMA5.SetDefaultColor(color.BLACK);

def SMA10 = simpleMovingAvg(close, 10);

def SMA15 = simpleMovingAvg(close, 15);

def SMA1 = simpleMovingAvg ;

rec sma_5 = SimpleMovingAvg(close,3);

rec sma_10 = SimpleMovingAvg(close,15);

def signal = sma15;

plot Slooping = sma15;


Slooping.AssignValueColor(if sma_5 > sma_10[1] then color.GREEN else (if sma_5 < sma_10[1] then
color.RED else color.YELLOW));

Slooping.SetLineWeight(4);

#ADX

def ADXsignal = ADX(5);

def up = ADXsignal > 25;

AddLabel(1, concat("ADX : ",ADXsignal), Color.BLUE);

#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;

def MACD_DN = MACD1 < Avg;

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<=3;

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

def MACD_LASTdn= MACD_DN==1 and count1 >=4;

def MACD_LASTup=MACD_UP==1 and count >=4;

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

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

def Chigh = close > (SMA5 + 0.25)and close>(SMA10 + 0.25);

def Ophigh = Open <(SMA10 + 0.25)and open <(SMA5 + 0.25);

plot AS3_CALL = close crosses above sma5 and dotUp and up and Chigh and Ophigh;

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

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

def Clow = close < (SMA10 + 0.25)and close <(SMA5 + 0.25);

def OpLow = Open >(SMA10 + 0.25)and open >(SMA5 + 0.25);

plot AS3_PUT = close crosses below sma5 and dotDn and up and Clow and OpLow ;

AddLabel (AS3_PUT, " AS3 PUT ", if AS3_PUT then Color.red else color.red);

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


AS3_CALL.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

AS3_CALL.SetDefaultColor(color.blue);

AS3_CALL.SetLineWeight(4);

alert(AS3_CALL," CALL !!!! ",alert.bar,sound.Ring);

AS3_PUT.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

AS3_PUT.SetDefaultColor(color.red);

AS3_PUT.SetLineWeight(4);

alert(AS3_put," PUT !!!! ",alert.bar,sound.Ring);

addLabel(yes," AS3 ", color.BLACK

);

Potrebbero piacerti anche