Thursday, December 29, 2016

isleapyear by Java


public class LeapYear {
    public static final int LEAP = 1;
    public static final int COMMON = 0;
    public static int isLeapYear(int d) {
        if(d%400 == 0) return 1;
        if(d%100 == 0) return 0;
        if(d%4 == 0) return 1;
       
        return 0;
    }
}


import org.junit.*;
import static org.junit.Assert.*;
public class LeapYearTest {
    @Test
    public void test_1996_is_leap_year() {
        int actual = LeapYear.isLeapYear(1996);
        assertEquals(LeapYear.LEAP, actual);
    }
    @Test
    public void test_2001_is_common_year() {
        int actual = LeapYear.isLeapYear(2001);
        assertEquals(LeapYear.COMMON, actual);
    }
    @Test
    public void test_1900_is_common_year() {
        int actual = LeapYear.isLeapYear(1900);
        assertEquals(LeapYear.COMMON, actual);
    }
    @Test
    public void test_2000_is_leap_year() {
        int actual = LeapYear.isLeapYear(2000);
        assertEquals(LeapYear.LEAP, actual);
    }

}

Tuesday, June 28, 2016



Bull trap for oil, falls to middle line and goes back.



Follow H4 bull engulfing, today it breaks the middle line.




For daily chart, it look 46.20 is the bottom, my first target is 49.



Saturday, June 25, 2016



Brexit post a big spike on gold. I was thinking of Soros. He knew Britons.

From James Joyce's Ulysses, the Martello tower,  Citizen, the ordinary people, xenophobia. It's a fact, Brexit is a fact now. The mind can detect this! But not me, because I am too depend on Computer (or technology), that's why I lose the touch with the mind.

It looks to me trading is not about technology, so meditate, reciting the mantra, reading James Joyce & Joseph Campbell, walk in the nature, to have a touch with the mind!



Tuesday, June 21, 2016


For oil, bull engulfing still have effect. In the morning it dropped, but from afternoon, it reversed after API report. (In trading, patience is number 1 factor, I have to wait the day for the trend to continue)


Gold dropped today, will Silver follow?



Silver dropped, but not under the low of previous bear engulfing, so I am still waiting!




Thursday, June 16, 2016



Wait for several days, today silver turned to black. Enter with bear.


Friday, June 10, 2016



Bear engulfing does not need confirmation, today it drops very big. I buy HOU when it's under the middle line, may not be a good time. looks that bear is full in control.


Gold is in bull trend now. I sale the gold for profit, now I am balanced.


Thursday, June 9, 2016



Bear engulfing for today. A signal to buy HOD. For me, just wait (to buy HOU).


Gold, bull no change. Since 1270 is the resistant point, I would think it will stay here for a while, could go up to 1304.