Wednesday, June 25, 2014

Test aja

def isVolNaik = volume[1] < volume;
def isLidiAtasLemah = (((high - close) * 100 / (close - low)) < 50);
def isMACDNaik = MACD(8, 17, 9, "EMA").diff > 0;



def yesClose = close(period = AggregationPeriod.DAY)[1];
def pcnChange = Round(AbsValue(close - yesClose) / yesClose * 100, 2);

def isVolNaik = volume[1] < volume;
def isLidiAtasLemah = (((high - close) * 100 / (close - low)) < 50);
def isMACDNaik = MACD(8, 17, 9, "EMA").diff > 0;

def theMACD    = MACD(8, 17, 9, "EMA").diff;
def MACDke2_Naik = theMACD[0] > theMACD[1];
def MACDke2_Turun = theMACD[0] < theMACD[1];

def TTM = TTM_Squeeze(close, 20, 1.5, 2, 1);

def SMA10 = SimpleMovingAvg(length = 10);
def SMA20 = SimpleMovingAvg(length = 20);
def SMA40 = SimpleMovingAvg(length = 40);

def mekar0 = AbsValue(SMA40 - SMA20);
def mekar1 = AbsValue(SMA40[1] - SMA20[1]);
def mekar2 = AbsValue(SMA40[2] - SMA20[2]);
def mekar  = mekar0 >= mekar1 and mekar1 >= mekar2;
input MaxBar = 78;
def BN = BarNumber() - ((BarNumber() > MaxBar) * MaxBar);
def ADX5 = ADX(5);

plot NaikLemah = (open < close and (isLidiAtasLemah == 0)
             and ADX5[1] < ADX5
             and close > SMA10
             and BN >= 4
             and mekar
             and MACDke2_Naik
             and SMA20 > SMA40
             and isMACDNaik and TTM > 0) * low;
NaikLemah.SetDefaultColor(Color.DARK_GREEN);
NaikLemah.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

plot NaikKuat = (open < close and isLidiAtasLemah
             and ADX5[1] < ADX5
             and close > SMA10
             and BN >= 4
             and mekar
             and MACDke2_Naik
             and SMA20 > SMA40
             and isMACDNaik and TTM > 0) * low;
NaikKuat.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
NaikKuat.SetDefaultColor(Color.LIGHT_GREEN);

def isLidiBawahLemah = (((close - low) * 100 / (high - close)) < 50);
def isMACDTurun = MACD(8, 17, 9, "EMA").diff < 0;
plot TurunKuat = (open > close and isLidiBawahLemah
             and ADX5[1] < ADX5
             and close < SMA10
             and BN >= 4
             and mekar
             and MACDke2_Turun
             and SMA20 < SMA40
             and isMACDTurun and TTM < 0) * high;
TurunKuat.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
TurunKuat.SetDefaultColor(Color.LIGHT_RED);

plot TurunLemah = (open > close and (isLidiBawahLemah == 0)
             and ADX5[1] < ADX5
             and close < SMA10
             and BN >= 4
             and mekar
             and MACDke2_Turun
             and SMA20 < SMA40
             and isMACDTurun and TTM < 0) * high;
TurunLemah.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
TurunLemah.SetDefaultColor(Color.DARK_RED);

AddLabel(yes, (if NaikKuat or NaikLemah or TurunKuat or TurunLemah then "" + BN else ""), color =
Color.YELLOW);

AddLabel(yes, "" + pcnChange + "%" , if pcnChange >= 1.6 then Color.LIGHT_ORANGE else Color.LIGHT_GRAY);

plot pcnNAIK=pcnChange>=1.6
     and (NaikKuat or NaikLemah)
;
pcnNAIK.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
pcnNAIK.setdefaultColor(Color.WHITE);

plot pcnTURUN=pcnChange>=1.6
     and (TurunKuat or TurunLemah)
;
pcnTURUN.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
pcnTURUN.setdefaultColor(Color.WHITE);

No comments:

Post a Comment