0111101000100010110010101111101100001100111010100110010001111001111111010001000110010011110111011101001101101100010001000101101011101111000101011101111110100101101100000110101111011010000001000100001000111010000000001000100010100110100111001010010001100100111000110100001100000101011000010010111100000000110100011010010111100110111110011100110011101000011010100000110001110011010111010101111011110001 1010001100110100000110110110011101111110000010110001111001111101011011010111101101111101101111001001001001001111110010110000111010110110000110001011010000101001100101001010001011000000011101110000111001111011010010111111110101110010010101010111111100111011000110011000101001100010100101101100000101111101001100001111001111111111010111001011000001110100001010111011010001100100101010000110100111010111 0011101111000110111110010001000000110011111100110100011001000010101010101110101010001101010100101110000001000101010000001100101000010001001101110000010101010010001010110101000001001010001010010010010000111110010101001110101001110110010000010011001101010111111111011000101111111010101000010011001010110111101001011101101100101010111101101000001011110110010101101001010010100001011110011101110101101101 1000011110000101101011000111101101011001110011100010100101011000010100001101111101110110110111010101000001101010001111111000000010001000011111000000011000111001000111000101101111011000101000011110010101011101111101010001111010110011001001100100011000001000100011111000000001000011111111000101110000001010101111000001101110001010010100100001011110001101011101100110001011001111010101110001000100111010 1000010011001000101000101110100111001111010001100010111011100011100010011001111100111111011100111010101110011100010010011000001111110100010111010100110111001000111000101110111011000011000000100010011000101011010110100010010011001110000011000101010110111011010101110111100101111111011111010111101101011000010111011100010001010100111000100011100100000000110111011010011100011001100100001111010111100101 1000000001001011000100100000011000000110100001111111110110110110001111111101000010011100100110111001111101001110001010110111000010110100011001010111100001010011010101111000000010011010111111101110100001100110111010001001110000011101000101000010100100001011001101000101011000010001010011001011111010100000001110010111111010001000011001100000110101010111001011001111000001011011101110000000110001001110 0010110010101111010001100000011101001000001100010000000000000011111100011000010011101001100111101101101110010101110010100110100001011010010101110001011111110100110111101011010111000110011101110100100000010010101001011010010001110000100000100010001001000110011101110101111100110010010100001010010001100100010000000010000000011100011010001000100111101000001101111001111111000110000001101000011010001100 0100001001100010011011001111001101000111110000011101101110000001011001101000000000001100001111110111001010011000101100010111010011111111011000111000100101100111010100000001001111001011000110011100010110110101100100000100011000101111011011010100111111001111000110100110000101010100100011011001100101111110100110101011100011100101010110010100110010110111000101101110011000000110010111100000111110011010 0001110100111110101110010100111000000100000100011101110111000101000100100100011010110111000011100000010100101010110010010000001100011110001001101101010011110000110001110010100111011011111101001000101101001011001010000100110000000001110000111000111100100101010101110011000110000010000000111100110110111001101111111100010001111101001101111110011000101000000011011010100001111100001101010111100010011001 0001011000110011100000100111110110000101000101100000010100010011001010000100100100101000111000010111110000110010110001000001000111000100101111010000001111101011010010101111100011010101001101010101001001001000010101110001011011101111001000110000100000001010110010001101100000011010001111010000000111111011011100111101000000110101110100010001010110001101100100001101111101110011110111101010010001000011 1011010000011111011111000001001100101101100000001110100111011001111010111001010100100110101001000000100100000101111110010111101110000000000101111110101100010001000101000111001111010000001010010010100000010111011110110111101111100001010000110101110000111000110010110111001101111111110110100011101111011000000101111000011010110110011000111010011011011110111111001110010011111011011010010111011110100011 0011111100101000111010011100101010000011101000010010000011001110000011111010100011100001001100001101100011100111001010110100101000111011100011100011110101100100011011111111000010011001100111011101001101110001001010111010100001001110000011000100100010110110011000000111011101000001011000100010110100000110100110010111000111100101011001100000101111111000100011001011010010010101001001100101100100111011 0011011000100001100111011000111011110100001001011001000011100011111010111010101000100111111010110111010011001010111001100000101110011111010010101011010101111101110001100000000000101011111001010010110001001001000000000001100010010001010001110100010100101101110100110011001111011110110011010010111100000010001011111100011011101000100000100101110011111100101110010010110111011011100110000101011000010100 0100100011110000100001000100000010010101000100001000001010111110100010011011100100010010011011001100000101111001011000111100110010101011101011011111000101100101001001000001010100010000000010010100011100100000101110010100000110101101010010100000000001101101010000111001011100111110010010000011010110101000001010000111001101110001010011111100001100100110000101111100100010110010100000000010110010000011 0001110011110100101100000100111001000011110111000010000110110111011001110100001100001101000110101111011011001000111101000010011000000001110001000111110110000110110000000011011010011000010110101110001110010001011011001001100010010000001100111001110110011011111101001001101110011110100101011011011001010010001001111101000111011001110010110011101010001101011111111101001110001001101011110000011100100110 0010111001100110101110100111111001001111110000010111000001101011001110100000010011000110100100010110100101100111111001110100101111011000110011101101010001100111010101001010110101000001000010001110010110001101101010001001100101001011111000011101001110110110110000001111100101100101100000100000011101110100000011111110000111001000100110111101101010110110000101010111001001001101011101101010100000010000 0110110000101111111101100010011111000111100011011110001101110110111000011100001100111110100110111101000111111011111010000010100000100101010101010011101010101010011111001011110000011110001011011010010001100000100000001010011010010111111101101111010011000000010111100111100001010110110111011100100100000100101110110000111100111101010111101101100001100001111010101101000011101001010110000111010000001000 0100101111011101100000100010011100101101101001001110110000111001000001010000111000011100100110000110011010100110111101010101100001000101110100111001101000111110100001110110010100110111000100101101110001101010110101011111001001000011001110000011100000011000110000010000000110101100000001000101110110001001010101101101100011101000111101101001111001001011000100100011001100001010001010010001101101101101 0101011010000011100101100111010100111011111110101110111100101001000100001110110100110010111101100111101010100011010100000001111101110111101001001100111010100101100010111000011000101100100001110011110011011000101101111010101001000000011110110110000111010101110100011111101111111111110000111101111011000010101001011101100010100010101010001010000011111101010010000111100101110010111110001111111110011010 0001000111111110001000011100101100011101000100101011111001000100110001010001110110100110110010001011011011100111010101101010101111011011000100010111010010111010010010011101111110101111000110011000100011000100010011001001111011011001000001000010110001100111011100010011000101011101100000100010011101101010100111110000100110001001111101110010001010011101101100100111011111000000110000100100101110111001 0110100101111100110011011101010000110101101101001111011100101100000110000101111110111101010110110100001001101111000000100001111011111000111001000001010101111001101101000101000100001000001111010111010001010110101001100000101110110010101100100011111100001100011000101101010101100011000111110000011100101101000100001001010110100110110111110100110100100000000001001001111011100111100001101111011010011111 1011101001010001010110110111111110011011011111110010110011011000100111011101011110110000111010001111111111110011111011111100001101110101010001100111001111110000000110100101011111010101001011011110000011000000000011110111111110000110011011001011101011010100110111111000111100101110010010100000010101001100001100100111101010101011101101000000101101001101101000011101010010110001101001010010010110111010 1010001100010100001010111011011111110000000110111100011010111111011110100010000001011111001111000110111110111100110001111000000110100111100011110010011000011001111000010010110010011111110001000011001001000101100000111001000111010110100010110110110110100001110011010010111000101001100001011010110100111000111010011010011001011001111111000110010010000111001101000000001111011111110001111000110011100011 1110010011011111001011010011100001001000001111010111001110001000011111001101000011110011110001110101011001111100101100100001000011110000011001101001010001100010001011010010101111110111101001011111010011000011001000011101011011001111011001101110100100001001011010010001001011010100101111101001110110000101110011001011101010111101000000011101000001111110110010110101100010110101001011011010001000000100 0110011000011011010110000001011110011010111010100011010001011111001001010001001110100001110001110011000010111101101000111101010011011000011001111010010010110001001110111110101001010110011001111110101110110000001001111110000111111010100000101100110001001110110101110110011011100101111111111111001110010000011010100010001000010000011111001101010000010101000010001001010100100101100010100101110001110000 1101110001100111101010111101000000101100001011100111001101110000001011110110110110100110110001110100101100110100100000111111010000111000100101111111101101011101010011001001101010111010110100101010111110110101100110000100101000011110100110000101110010001110011001111010110101011000010100000100010101110010100011110001000111001001111011001001110011110111101111000000011100110101111101001110001000111101 0001100100001010111001011101110101001100110001000010010010001011111110010011110010111000110110101110111010110001101110000011100011100011111010000010001111011101100100110101110101110010101111101011101000110011010100000001110001110001010000111110001000010101110100011010111111011001110011001111011010011011110100011000100001001100011110110001101011111101101100010000010101110010000001000001101101111001 1000111111110100011100101100100000010010011111000010001110110001111010001101101001011111001111111011101100101110101100110000101011110011100010110110010001001100011101011100111111111110101111001011110001110001001001101011100010010001011111001101000111110001101011011101011000101000110010000000100101000111101000001101100101000000001101111001010110001010000101011111011100001000010101111111110011111101 1111110010100100011000111100111010101100100101101011111011110100110011111000010000010000011111100000011011001100111011110100000011010100000011100000010111101100111101111100111111010001100101100110100100111000011010101110111101101010011111001000010001010001100011110101010011000001101001001000001000011000101100001000111100001000101000001111100101111001000011101001100100101011110010110000000110101001 0000011111110111010000111101001010011000010010011101001110001110100000001110110100100110001101001001100000110011011011100100001001010111111000100000111000000111111101010000010011001000110111110001010110101111100110000111011001110000001011110111000111001110110010011000010000011000110110110010100010101010010111111010010001000010001111011011010011100110010001011111010011001011101010110000111011001000 0100011000101101011000101100011010100001101111111101100111011001011100001111110000111011111010010101110111010100010011110000000001110000000011100111110011111011000001100010011101101110110001101111011100101011011011001110001100101011101101100110011100011010010111101110111001101101110000100000011101011101110011100111110000101101011110011000111110011111110010000011001001011101111011100100001101010100 1010011110001100011111101111110111001010010000101111011011011010110000101100000001011110001000110001001010111000110111110001000010111011001000100001000110001101001011110110000111100000001111011111101100111101111111000100000011001101000100111100110110110000101010100110111101100010111101011001001110011111111000100101111011100110000001000000000111101000110001100001000011000000011011011010110011010111 0110110000110111001101100010111010011001011111100100111111010100001001010101110011111100111111011010010010011100100001011000001010111101000011011111000111111100010111110110111010111110100110011011010101100111100010100000001100110010111111100011000110100000100011000101111000110011011111011110010111011001110110000010010011010010011101100011011001111000100011111011100100101000111111011100110001100001 1100111000101011101000001001110100111110110100011011111011000011011110111100111111001001100101000000010011101001111011010100001011111101010011100100011101000001000100011100001100001110111000111011011101101000101111000101000100101000111011000101111100110111100011100000111000011001101011100110111011110101110011000100010000011111111100010001011101111010010010001100110111100101101001000100000010101001 0110111010001010100101010001011000000111000111110111001000000111010111001001001111100111000100111001110001110010111011011101101100101000111010110110111001001110111110100011000111101110101001110011111110110101010001000100111100000000100010001101100011101010101101011010001011010001110111010110111110110000100111110001000000001011100010010111100011001010001101100101011000110111100100101001110101000101 1101100111101000011101110101011101000001010001010101101110111011001111001010111001011110010110000001011110010111000110101101001011001010010100101001011100011101101100010110001000110111111000011100100101101001101110111111001100110100101111100100000101000000001001111010101110000111110000110101110010000011110101000001000111001011001001011100010100001100100011101001010110111101100001100100110000000010 0011000101111111011110001100010000101100111000010110001010100011000011111011101001010000101010100110010010111111010100000001001000000000010011010001111000110111000011111011101010011011100011000010011011010100100111101000010011110001100111110100000000000001100000111100111111110001110110110010110000100100100011111001100011110001010110001100111111010111011010011011011011000100110001111001100000010100 1010011110001000101101101110111000011000010111100101100110100110100001111100010000001110010101111000011010100100011000010010110111101000010010110001100100010001101011110100101100010000001100001010001011111101010001010100110100001111111101001000000101100000000000110100111100111101110010101001001100100001111000100110100110110011111101000110100111010100111111001111101011100110011110011010100000000111 0110110100000010011110011000000110001111011011010000000001000110100001111011011000110011110000010000011001111011110001001010000011010100100101110000011101101001010010111111011101001010100111001011000010000000010101110111101100101011110101101110000110101011010010011010010100110011011000011101101111110110011100011101010100001100000110110011001001110000000100001010010011101011010011100100010111101100 0001000010001011101111100101011100011001111100000011111101010101100111001010110000011001011011110001110001111011100011010010100001101101110110011010000000110011010110110110101010010101101010000110001100110111110101110101110100010001111001111001100000000100000111111001011100000000110110001101110101001100001000000101001011000111000111000011011100011000101011001010100111101110001011110010111000100101 1101010000001100010011001111001011011011011110011111110000101110100000110000001010000101101000011110001100111000111110111101110110010111000100101100010010100010000110101000100000101101010100000010000000011101111001011100110100100101011001001011100010001011000111110001100000111011110110000101011100111000111101001001011000100101101100111101101000011100011011001111111011001111111100110011101001111000 1100010010010011010101000101010011110101101111010000100111001110010101000101100111001001001011001111111011011101110000001101100000111100100000000000000100011110011110110110010000001111110011000100000111010001100011110010000110000000011000101001010100111111111001101111010000000100001011000011011101101000010011110000110011110101000010100110111101010100010110001100000001100010010111001001000110011001 1111101011010010110010111010101110011001001110101100010110101000001001011110111110111110000001011010111001100001111011000100110110010101010000010010000100000000000001001110111111101101000110001001110011001101010001101101110001010110110010111110010101010111010001000000011000111011000011001101100111100101101111010100111010101000110110010011000101100101000110111111000001011101011000001001110010110111 0101110101100010110101001111101011100110100001110011010001111011010001010110101111100000010100101110001010010010100110100101000111001100000101111000101000110011011010011001100010100111011010100001011110011101111010000110010101111100001100110111101111111011001000010010001101001101011001110101000001010000111100001101010000000111111111001001111001111000110110010000111100110110110110010000001110111011 1000011001110001001101010000100110111010110011011111000000011111000000011110101101000110100000111110100110100000010000101101000010110001111001100111100101010010101011011100011111101100001011101111011101111001001110010000000100011010100101000110000110100100111100010100000101000011001010111101101010000100110000001011000000101000001011110101011000101010011001101111001101001101111111101101011101011011 0001100011101111011001101110110100111111111010010011000010011100000101100100001110111111001000100100100000001000001100100101001000001011100111001011010000011010100111011110011010101011000111101001000110011101110101111000010100101101011110010110011110010010011010000101000011001111000010011000111011001111100110111111000001101111111100011011111011101010000110011000111010111111000001110000110011101010 1001011001000000011010001100001100001001100100000000101011100100001100011111110011100011010000011110000011111011011000111000100101101101001010101010101110111101000100100110100011111001100000010110000011001011000101001001111011010010111001111011000000000110101001100101100001111111011000001111101000011100010001110011000111101001001000101110001100000100101101101010011010011100000010111100001110000000 1001101010011000001011011010101010100011110100110110111010001000100100011110110001000000101100010100101001100010101011101110110100011011001010100111100010010110010011101001001011100000010111011111110101011010010111010001001101011001111110011100100111000101110110001111011100001011100010101111000011011010110110101111000011100010111111001001000101110000110010111101010111001011001011000001110100001001 0000100100101111110011110011010011001111001011101110000111111001100110110000001000111100010000110011001001110010111100011111110100100101101010100001010100001010101011110001111011000110000111111111111100000100011101110011010101010110100010101001101101011101101010010001100100111110100111000000001100111001010101111111110001100011100010101010110000100100001001110000101100010101000110001011010011011100 1000000110010101101010000110011011000001010001010011010101111011100011001110111111010111000001110111000101000011010000011100101100011011111110110001111010110110010111111111000000110100110000011001100010010110100010000110010001111011000100011100100111010100011111011010110011110101011101101001000110001001010010110110001111010000010100011000001010110111001010000110011000001111010101100010100100111001 0010000001100000001001010001001000101111110101010000100111011111111000010001011100011101110000010001001011011001110101101100111100010111101111110111010000000000000011110000111000011001010110101010110001011100010110110100111111010000000010101111110101011000001101100001001110010101111010000001100111001000100100010010001011000010110000110101010101010000001110010001010111001100000111111010111001100000 1001010000100000010111101111100000111100010110101000011001100011011011001100001100001000000101101101110011101100101101001100010010111101010011111100100000110010111011111010001010110010100110101110100111110110100100111110011011001001000101011011101000001001101100111111111010101111100110000101101100001011000101010100100000000001010111010100000100010101000000000100110100010100110100011110010000110010 0100001001110000010011000000011110000110101111010101001110011000100001100101010100111110001100110010001111011001111011001100000011001011011010101011101110011110110000100000000110111010111011111100010000111011001010100011010010011100101000000100110100111110010000010100111111111000101110000010001111011110011110001110110100001110010100001111010000110010001010010100000011101100100000001101101111110100 1010011110001100111110111001100000110011100110000000000010101110110000000001000101100011110101110110110001011010111110011001000100000111110111110111000101101001110110000011001010001011000001010000110000111000000111000011010110110011100000000001100100000001111010101110100010110001100101101000010011110010111101011010001011111111111011011100111111010011010000100111111100111110001001111000111011000010 1111010100000111110100111100101000011110110110101100110100010001010100110001001110101001011111010000100111010010010001011000100000101100010011101011001010001010011001100001001001100000101101101000101000101100011001110110111001001010101000011100111011101010110010000011010111001111010011111001000010110111111110010101100101110011000011000000110000000111101110000000001110001010010101010101101001110101 0001001000011110101101000011001000100100010100110110010010100100101011111000101101101110101011011100001011010011000010000101111010010111110000100110110110011101001111001010101000011111101101100101110000010100001110110011010101010111101010101010101000010101100100000100110101111101010100110010111101110110000001011110110001101111000100011100000010011111100010001100001111010000111111100010000000011111 0101001000001001101110001011110001011100001110010101011100100011011110001111111011111101110001001110010110110111100011010001000111000001111100100000100111010111111101011001001111110111000111100111011111101000100011110110010011101100000101111000001111101001001000110110100100011010110111011111010101100000000000101101010011001010011001100100101111010111111001101111101001100110001000100011101110100111 0110110111100011110100000010110110000010011001100110101000011001111011000000010100010011100011100100110111000010100000010111010110111010111001110001100101111000011001101010100110000101011011111010001101101100010100011010001011000111110110111110011101010100001110111110000111100001011110010001011000011101001100100000111110101111111100000110111101011101001000110011010100100100111001011011101100001001 1001001101111001011000101000100011111100111010100001110100011000101110111100110101010111111111000111101000110010011101011100110100011110011110011111001000010010110110011101101000111110110110110110001110000111010101111100100010011010011101111001000011100101101100111100100101101111011111011000101001111110101101101011111011100000010000100111111100010111011111110010000110011110010111001101110000110101 1100010101101111110000011101001011101101110010011010101010100111001100101110010011101111101000011110011111110101011100110101111110110010100000010111011000010000010101111101100010110111101101101101000101010010110101011011001100000111100000100100000101000111100010101110100111010110100110001100001100110000111000111010110001100011101001001000100010110000100111111000011111001111110101001011101101110111 0101011000000101111101001001010001001110101110110101001011111011011000001000010001011101111000111100010100001100100100100111010110101000111001111101100110000111101100110011100111101100100011000100110000001010101111010101100110011100001111111000000010110111011111011100000000111011001001101011110110101111001011101010100010011000000110001111000111011111111010010100010011000101110110111101011000101101 1101101101001000001111111010111101100110011101110110010110110000011011010101000110000111000000111111011000001010011101110111101010000101111010001110101100111100010000100000111011100101100110110101100000111101001011010110011011010111101110100010011111001110101001010010110100011110110111111011010101011010001110111100001110111100010001001111000001101111000001101010001000001001000101000001000000100011 1010011001100000101101101010010000011100000010000101110111101101001010001100010010111110111000011011101110100010011111111111101010110111011001101001000101001010100011110011110111011100011000100100101011000001001110110101011010110011010000110010101001011111010101111000110001111010100110101111010001101111011101000011000000000101100010111100110000010100000100110100100011111111011010001111010100100000 0110111110101100001110000001010111110001000010010001010111101111100000111001010100010001111010101011100110110010111101011000100001101111110101000011100100111001110101000110100010101110111001100010001010111010101111101000001100100111000001111001101111110110001101100110001001001110110010111001000001111111010011110110000000100101000000000111011100011011100010110000011001100001011110011101000011010111 0000000100100110111000100011110111111000111000111100110101011000100101111000110011100110111101111011101000101000001111100111001010100011101001011010111110000111100101110010010011001110110100000100111000111101010001001000011011101100001100101111010010001110111001000010111001001010111100110101101110001011001010110001001100011001100100111111110000001110001100100110111100111100101010011000110000110000 1101101000110101111100011000011101000111111000100000001011010001010101111100000101000001001000100011000000100000101010111101101110000101111010000101001010010101010110111101100101111000011000110111010111001000001011101111001101010111000110100011010000101111000001010000011100010011000111101001100111011111001001010110100111001110000000111110101100100000001110010110010100001001100110000000101000101110 1001001011101011001000100001010101000100101110001000011000101000111010101010001001010110001010011101100101100100100111100010011000001011011101111100100110101101000000101000111110000011101110001001011111100001111100111010111001011110000100101101011000000110111100010110110000110110000111111010001100010010111011100011101101010001110001110001111111100000110011100111110010000000111000010001100101001111 0011100101011000100111101001110111011101000010110001101100010000111011100110101010000000011001110001010111001101101110111101110000101011100111001010111010101111011101010101111100000001110010010011111111000011001000000100010110111111000010110010110001100111011111001111110011011000111000000010011001101011010101011010111001011011000100101011011100001100101110111011010110001011111100001110011011010110 0111001001100100101000111110010100111111001010111111001100001010111111110110111001011101000001001110101101100010000110011110001111100110100001010000011011101000111111111100000110011000101111111110110111010111101010111010010101011111001011100100101010101111011000111011010100111111111010011011000000010011000111010010111110011100000000000000101100101000001001011101101001010001010001011010011010011011 1000100010010000000001001000001010000001100100001110010101100000011001010011001001111101101001000110101011111110111111110001010001001000001101101011110001111011010011100000100101101111100111111100000100111110011010000010000111001100111111001110101100110010010010011101001101010110010100110011100000010011110000101111110110011011101010000100101101110111110000010100011010110110011111110111110000111111 1110100001001101100011000110111100100000100100101000111100011101101011111111000100011010011100111111000111011010101100111011100001100101011010100011111001110010001101010000010001000011001101010110010000101010100100111111101111001110001101100100110000000101011110110010101011011101110101110001111111011010000011010011101011101011010111001101110001100111011010101110001000011101110110110100001011010011 1001100011101000111001010100111001001011110011011101100011010011011111010000000110001110000010001011111100101000001000101010111011011111010000000001111000000110011111001100011110111010111101011100001001101001110111001000000011111011111001011001111011011111100000011101001011001010000111110111100000010110001101011001000011100101010000110111101010001001111010101001101110011101110001001101010010001011 1100110000010101110111110001110100101011101000010101110101111110000001100110111011010000101011000010110110101101110110000101011000101010001000001110001100001101100000101010010110001111000101111110001011000000110100100100111110001000100101010011111011100100100010011111100000011010101011111100100100001001111010101110101000101110100000111011101001101001111011101001100101010110011000100100110000000100 0110000110001011010100100001000001100010110001010101001001100011010001111000101000111101111010011101011000001110100101001011010101011001000111011110011101001111111010001111100110011011011110010110111001010110001100100111010010000101100101000010000111111001111011100011100100111111000110010010000001111110001011001101000100100000111000011001001010001100000100111101000010111010010010001101000000010100 0100101011010100001101111110010100011111101101101111111000111110001011111111010010101100001001001001111000000010111101010000110001100010100101010001000011010001100000001101111010010000011000111111110000011110110011010100001111011001100000111101011101111101000101010011110010000111001001100110100000111000111111110010001000000111000100101111111100000110110101101000001100011001111111000011011111111011 1001010010101100011001111111111110101110111001101111111000111010001000001000001100110111111110001111111000100011100100111001010100011001011111001010101111011111000100001001001111011111010110011100111111010110001010001111001111001001010101111110110100000010001000000001011101011011001110001100111011101100101100110110000010010010000101011110110111010101100101001011000100110110111010000011101010110111 0111010101000000000101011100110000100100000110110110000010001001111001110000001010001000000010000001000000000010001001010001100001011101010111010110110100011010011011010100111100000011111011000110010010011000000010111100000100110111000010001101010000001111100110011011111111101011000001001101110001010111001110010111000001000001011001010100111100101010101010110011010000100011011001010001001000000110 1011110010000101111100000101010010000110011100011111110101000001101000000110101001011011101110001011001010100101100001010111001110111000001101000111101101100000100110010111000000101000011101111011101101000101110001000001000001000011001100110111101100100011000010110001000101100101000011000010000110010101011111001000000111100001000011110000001011111100101111100110100111001101100111000110011001101001 1100010111000101010000011010001110101100001111001010011110100101110001110110101111111000000100111100100011001101010011010100000110011101011111111010001011011111100101110100101100001101000111101100000110110000111100011110011110100111111001000100000001011110011100001000010000111100000100101111001011000110110100011100100110001010111101011110001111111110010111101001100111010110101000110100001001101111 1010110010110101011101101111101101011000101001011110011110101000001101010101100010110011000000011011110111100100000101100000010011100111001000100101101001101110101001101111101011011010100000001111000110000110110000001110101111110000001001101110110000001101010011101010101111011011111111001010101000110010101011010101101111001011110011011010010011111110000111110101111000011001011110011001000110011010 0001011100010111011100111110100100101010110111101110001110100010100000001111101010011000110000111111100110111010101011011111111101101001111011100110011011110001000110100001010010011110110101001111010111100001011100101000011100101110001111101101110001001111000111010001011011000111100011001001001001111010001011100110001010100111111010000010111000100101100100111101100001111100011000101111000000011111 0100101101001011110010100000111100111111001001110100110100100101110000100001001001101011101111010100111101001111011101000011010110100000000110111111100101000001110010000011000101100111000010001010010100000010010001101001000001111011111101001001100100001100010100001100111010100100110010111101101010010100100000100010000010001101101101000101111010100100011111010111011111101011000001101100010000111111 0011101000011000110100010101110101000010110100011010100000010100010110000001111010111100000011111110010010011000111000011000100011001011101010000011111001100010110101100001101001001011000010011001100011011011111101010110111110000000101011001011100000110000100110001010100011111101001011011010010010110011001011011111111011111101101001101000110101011000110011100101011101101010000110100001101000100011 0100000011111010111110111101111101001111011000001100101000100110101111001111111101011101110000111011000011100010000000111001111001010111000111111010000010110110101010110011111101111011001010011110100010000100001010011110101100010001000111010111101000111111101101001111001000010111011110000011111000011110101111001100100110010010101100010101001101111001110010110100110111000111101000100001011010110001 0111000000111011110111110000110000111011011110100010000010011101110101011100101110100001101101110001111110011000111111100010010011110000100011010111011100010011101100100011110111011100100110101100000100101011100111101011101001101011111010110100111101111110001110100010101000101000000101010100101011101111011110001110110001111110001110011110110010100110100011000100010111011000111001110101100011011000 0011100001101001101000101001111011111011010010001100000110101111000010100111111111010110001011101111000001101110000010010100011011110101101111011001100001111000011111101110100000011011100011011100111100011010011000011111011011100011110111011001000111111110011111100010010010111011011100010111000100111111001101100101000001111000110101000010111010011101100001001101000001110010110011101101111000110100 1010011010100011000100010010110110110000111100110011111011110100101001011010101101100111011011111000001100101100100100010001010101011010110111011001111001110110111001011100010010111111110000110100000101000110100000010110001111110101101000010011010000100100010010001111101000011000001001100000001010010111011010001001100000101110001100000111100100000001010001001100110000010001000001010001011010100101 1111100100000010101111111100101011011111100110101001001000001110001100111000111101110111001111111111100011010000110001110010011000100011011111011110010110100000000001010101111000111011111111111011011001101000000000110110111000101010011001111011000111011010100001000100100101101110000101010000010110001000001011011010100001001111100101101010100000001101010011000111101011000000110000001010100011001110 0110001001110111010011011101101001111001100010011000011110101110111110001011001010000111000010000001111000111110001001100100001111101010100101001100011110000111111110111000110010011000110100010001100001010101111111011101100101101011000110010010001101101001100111010111110110101010110111011110010010011110101011110010001100110010101110001010000110111100000101001000000110101111010001010111001001000000 0011111110111101001010110111100000000010001000111101000110001100111010100101101110101101100101100101111110110000001001011010111010101101010101011000110000101111001010011111011101000100110100110111001000110011011010001000011001001000011001111001110001110101011011100100101111101010111110111101000111101000010110010110001010111110100100011111010011110101110100101001010110011010011100011011111110000010 1010100100100111101111011000011110010011011101110100110001001110110010011010110111111010110010001000000101011000001010111000001111010101001111010010001011000100011110101100010110101010101111100010010111001010001011000011000100111001011100000110100100101000111011001111010101111000000010100101100001000001000010000000101001000010010110100000011101101101110110101111100100110111100101000100110110011010 0101001101101001110010011100101111010100110010101011001100100100111010101011000100011111000001001000111101101101110101001110001100101001111001110000111100100010000101001110110100110001011000100111011010111110010010111001101100010011001100101111111101101010100000001001111101110110110000110011000101100110000001110011010110101000110110110011010101010110001001101001101100100111001110001001111011110100 0101001110100000101011101101001001110111111011000010011111111111000011100100011001010111100011010000001010000110001101011011011101010000001101010111001111100011011101011011000010100011001011011001111001101001000001100110101111110101100101011100011011110101100111000101011011001101110000100101010100010010011100001010000001110100110110011110100010011011100000111101001011111001010111100100101011010101 1101010111100000000110000011010010110111110110100101101010110100111110011010011101010001101001000001010011000010010110001101010010000001011010011100111110111110110100100010011101001100000011110000000000110000001110111100100010110000011100100001111000100011101111110010110111100110001110111101001010001001101010011100110100101100010110011001101110000001001000100011110000110011100001101111000001001001 0011100111001000100100111000111101010110001001111101101000001100111001001001101010001101110001001110100110001010000010000000111100110110000000101111100101010010101000100101010001011011110101000000010001010110011000101010010100110111000011000001110101010010011111111011011011001100001001101101010000001001111010110011000000110101010111000000100001011111011110100010001101101100100001001011100110000010 1110101010101010101100000111000000101001111000010010111000100111110010001001001011011000110001100000101000110010111110011110000000110110100101000001001010000011000010000000000010001011111001000110101110101100000001010101011011011010000100110110000000101110101010110010101101000000111101100111110011011010101100111101110110100100000111001100101101110101110000110011001001110110000101110001101001111110 1110110000100010011000100111001111000111010011101010001111111100011110000000010110001100001110110111010111000000100000000000110001100000001110011011011010011111001001010101011101010001110111000101001100000001010011001001101111100110111011011000001001100100100101000010101100011001100011110000001001010000001101110000100001001010000101110011111110001100110100100100110010011011111100101101011111011001 1110101110000111101111100010100100000011001101010001011111101000101001101111001011101111110100101110000001000001100011010100001011100101110011111110110010101011110101010100000101010000101001110011101000010010000011010100101111100000000101101011010101100111010101010011110010101110111101101101100011000110000101111000110010011101011011111000110111110101111011000001101001101011100111010001100111110000 1000001110110100011000011110010000000000011010101001111011001011001101100010010100000011100010011100100001101111101001100100010101000100011101101110110110010010111110101101100011010010101011101011010101111011001111010111000000111000110100011010110101111111101001010000000110110011101111101010101100100010101010011110110110110111101111111101101100001111100011101101111000101010011000111010110011011000 0001010011000110100010011010101011011010000001010111111101001101111110101011011000101110100001011011000001001100000010010011011110101111100100111100011000000011000100110110001101010010110100111001011101101001000100101101000011000010110111001011100100100101111101101100100111000110111110111010100110010001101001100100110000111100010111101001111000010100110110100001000101111110000010000111111110010011
cTrader AlgocTrader

【cTrader】MTF対応ストキャスティクスとか【Tools】

2/6/2021 3/2/2021

4年以上前の記事です。内容が古くなっている可能性があります。

MTF_Stochastics

マルチタイムフレーム対応のストキャスティクスが見当たらないと聞いてちょっと作ってみました。

あまりMTF系インジケーターを使ったことないので、こんなんで実際使ってる方の役に立つのかわからないのですが、一応公開しておきます。

 

機能概要

チャートとは別時間足のストキャスティクスを表示します。

一つ目は普通の組み込みインジケータのストキャスティクス、一番下が今回作ったMTF_Stochasticsです。

わかりやすいよう一つだけ表示させてますが、時間足を変えて2種類まで表示できます。

 

パラメータ

TimeFrame1、TimeFrame2

ストキャスティクスを表示させたい時間足を指定します。

%K Periods, %K Slowing, %D Periods, MA Type

組込のストキャスティクスと同じです。

ShowLabel1, ShowLabel2

インジケータ窓の左上に対象時間足を表示するかどうか指定します。

 

ダウンロード

(2/8更新 下記不具合を修正済み)

ソースコード付きです。

 

組み込みインジケーターのMTF化

実はcTraderで組み込みインジケーターのMTF版を作るのはそんなに難しくないです。

ソースコード見てもらうとわかりますが、パラメータ部分を除くと2,30行のコードで済んでしまってます。ストキャスティクス以外でも基本は同じなんで簡単に手順を説明します。

1.別時間足のbarsを取得して、それをもとにインジケーターを取得

//------------------------------
// init
protected override void Initialize()
{
    // 中略
    _bars1 = MarketData.GetBars(TimeFrame1);
    _bars2 = MarketData.GetBars(TimeFrame2);
    _stocha1 = Indicators.StochasticOscillator(_bars1, KPeriod, Slowing, DPeriod, MaType);
    _stocha2 = Indicators.StochasticOscillator(_bars2, KPeriod, Slowing, DPeriod, MaType);
}

BarsはMarketData.GetBarsで取得、そのままIndicators.<組込インジケーター名>で別時間足のインジケーターが取得できます。これらはフィールド (メンバ変数) に持っておきます。

 

2.Calculateではindexを変換して配列に代入する

要は自分の時間足のindexが示す時間が、別時間足でどこのindexにあたるか求めます。今回は変換メソッドを作りました。

//-------------------------------
// convert index myTF→anotherTF
int _convertIndex(Bars bars, int index) {
    var newIndex = bars.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
    int load = 1;
    while(newIndex == -1 && load!=0) {
        load = bars.LoadMoreHistory();
        newIndex = bars.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
    }
    return newIndex;
}

一応barsが足りない場合、追加で読み込む処理を入れましたが、自分より長期時間足だけを表示させるならなくてもさほど問題ないと思います。

で、あとは代入するだけ。

//------------------------------
// calculate
public override void Calculate(int index) {
    var index1 = _convertIndex(_bars1, index);
    if (index1 != -1) {
        PercentK1[index] = _stocha1.PercentK[index1];
        PercentD1[index] = _stocha1.PercentD[index1];
    }
    var index2 = _convertIndex(_bars2, index);
    if (index2 != -1) {
        PercentK2[index] = _stocha2.PercentK[index2];
        PercentD2[index] = _stocha2.PercentD[index2];
    }
}

これで完成です。詳しくはソースコード全文をご覧ください。

別の組み込みインジケーターでもぜひ試してみてください。

 

(2/8 追記)

すみません、嘘でした。完成してません。

書き換え処理が抜けておりました。(ゆきちFXさんご指摘ありがとうございます!)

 

3.上位時間足の場合は未確定分をさかのぼって書き換える

Calculateの一番下にこのコードを追加してください。

// リライト処理
if (IsLastBar) {
    for (int i = 1; index - i >= 0 && index1 == _convertIndex(_bars1, index - i); i++) {
        PercentK1[index - i] = _stocha1.PercentK[index1];
        PercentD1[index - i] = _stocha1.PercentD[index1];
    }
    for (int i = 1; index - i >= 0 && index2 == _convertIndex(_bars2, index - i); i++) {
        PercentK2[index - i] = _stocha2.PercentK[index2];
        PercentD2[index - i] = _stocha2.PercentD[index2];
    }
}

IsLastBarはIndicator特有のプロパティで最新のBarを計算している時だけtrueになります。つまりif(IsLastBar){ }の中身は最新のBarを計算してるときだけ実行されます。

for文があまり見慣れない形でわかりにくいかもしれませんが、要は上位時間足のindexが切り替わる直前までさかのぼって、今計算した値に書き換えてるしているだけです。

今度こそ完成です。たぶん。また変なとこあったら教えてください。(他力本願)

 

書き換え処理について

なんで書き換え処理が必要かピンとこない人へ一応説明。

たいていのインジケーターは一度確定した値は変わることはありません。たとえば15分足の移動平均値であれば10時開始のローソク足の値は10時15分になった時点、つまり次のローソク足開始時点で確定され、以後書き換わることはありません

しかしマルチタイムフレームで上位時間足のインジケーター値を表示させてる場合は事情が異なります

たとえば15分足に1時間足の値を表示させてるとすると、(15分足で)10時開始の足の場所に表示すべき値は当然ながら(1時間足での)10時開始のローソク足の値です。この値は11時になって初めて確定されるのです。

そのため、11時に値が確定した時点で、とっくに確定してるはずの(15分足の)10時開始の足までさかのぼって値を更新する書き換え処理が必要になるのです。

参考までに書き換え処理が抜けてたバージョンではこうなります。

 

以下余談

ちなみにマルチタイムフレーム以外でもさかのぼって値を書き換えるインジケーターはありますが、このリライト(書き換え)有無を理解しないで使っていると変な誤解をしてしまう可能性があるので初心者の方は注意が必要です。

有名なものだとZigzagなんかがそうですが、リライト有りのインジケーターって過去チャートに表示させるとあたかも見事に天底とらえる神インジケーターのように見えてしまったりするんですよね。

リライトの有無でインジケーターの使い方自体が全く異なりますので、聞いたこともないようなインジケーターを使用する場合はせめてリライトするかどうかくらいは確認してから使用することをお勧めします。

 

(2021/3/2追記)

特定の値で音鳴らしたい!

という要望があったため、機能追加してみました。こちらのLineAlertの音鳴らす機能をそのまんま放り込んだ感じですね。

 

いつ音を鳴らすのか?

音鳴らすこと自体は簡単なんですが、どのタイミングで鳴らすかが結構難しかったりします。ストキャスティクスだと%K%D両方の値を基準とするのか、クロスも同時に見るのかなど。

特にMTF系だと、メインの時間足更新タイミングを基準とするのか、上位時間足更新(確定)タイミングを基準とするのか、というのも悩みどころです。普通に考えれば確定後がスタンダードでしょうけど、メインとして短期の時間足を見てるのに、上位時間足確定まで待つというのはどうも使い勝手が悪い感じもします。

この辺は使い方次第なんでしょうね。今回もソースコードついてるので使う方はいろいろいじって自分好みに仕上げてみてください。

 

ダウンロード

とりあえず、上位時間足の確定は待たずに%K%Dともに指定値以上(以下)と同時に%K%Dのクロスを検知した場合に音を鳴らすように作ってあります。また、1度音を鳴らしたらメインの時間足が更新するまで音はならないようになってます。

たいしてテストしてないのでおかしなところあってもご容赦下さい。

 

その他変更点

・2つ目の%Kと%Dのデフォルトラインスタイルが逆転しててわかりにくかったので修正しました。

・見にくいLevels表示を消し、パラメータのSoundAlertHighとLowの位置に灰色の点線を引くようにしました。(音鳴らしたくなければFileを空欄にしておいてください。)

 


まだコメントはありません

新しいコメント

コメントは承認後に公開されます。承認まで次のコメントは投稿できません。

cTrader's Life

© 2025 ajinori