There is no connection between what you have mentioned about your eye twitching and bad luck. Rather this is a kind of superstition which the Muslim must beware of, because it is one of the actions of Jaahiliyyah. It was proven that the Prophet (peace and blessings of Allaah be upon him) forbade superstitious belief in bad omens and he said that this is a form of minor shirk that is contrary to the Tawheed in which we must believe, because superstition is a trick by means of which the Shaytaan seeks to cause fear and whisper into people’s hearts. What is meant by superstition here is regarding something that one sees, hears or knows as a bad omen.
The Prophet’s prohibition of superstition is mentioned in more than one hadeeth, for example:
The hadeeth of Abu Hurayrah (may Allaah be pleased with him) who said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “There is no ‘adawa (contagion except by the will of Allaah) and no tiyarah (superstitious belief in bird omens).” Narrated by al-Bukhaari, 5757; Muslim, 102.
Abu Dawood (3910) and al-Tirmidhi (1614) narrated, in a report that was classed as saheeh by al-Tirmidhi, that Ibn Mas’ood (may Allaah be pleased with him) said: “The Messenger of Allaah (peace and blessings of Allaah be upon him) said: ‘Tiyarah is shirk, tiyarah is shirk,’ but there is none of us who… but Allaah takes it away by means of trust in Him (tawakkul).” The words “there is none of us who…” are the words of Ibn Mas’ood (may Allaah be pleased with him), not of the Prophet (peace and blessings of Allaah be upon him). What this means is that there is no one among us who does not experience some kind of tiyarah and superstition in his heart, but Allaah takes that away from the heart by means of the person putting his trust in Him and delegating his affairs to Him.
Anas ibn Maalik (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “There is no ‘adawa and no tiyarah, but I like optimism.” They said: “What is optimism?” He said: A good word.” Narrated by al-Bukhaari, 5756; Muslim, 2220.
These ahaadeeth clearly indicate that superstition is haraam and warn against it, because it involves the heart being attached to something other than Allaah, and because everyone who believes that some things may have an effect of bringing benefits or causing harm when Allaah has not caused them to be so, has committed the sin of minor shirk, and has opened the door to the Shaytaan to make him afraid and cause him mental, physical or financial harm. Hence the Lawgiver forbids superstition and declares it to be false, and tells us that it has no effect of either bringing benefits or warding off harm.
Once you have understood this, then if any such thoughts occur to you, you must fear Allaah and put your trust in Him and seek His help. You should not pay any attention to these bad thoughts and false notions. The Messenger (peace and blessings of Allaah be upon him) has told us the remedy for superstition, which was narrated by Imam Ahmad in his Musnad (2/220) and classed as saheeh by al-Albaani in al-Saheehah (1065), from the hadeeth of ‘Abd-Allaah ibn ‘Amr ibn al-‘Aas (may Allaah be pleased with him) who said: “If tiyarah stops a man from doing what he needs to, then he has committed shirk.” They said: “What is the expiation for that?’ He said: “To say: ‘Allaahumma laa khayra illa khayruka wa laa tayra illa tayruka, wa laa ilaaha ghayruka (O Allaah, there is no goodness except Your goodness, and no birds except Your birds, and no god except You).” [Translator’s note: birds are mentioned here because the Arabs of the Jaahiliyyah had a superstitious belief in bird omens and would make decisions based on observations of bird movements]
The believer should not be pessimistic or superstitious, rather he should always be optimistic and think well of His Lord. If he hears something or sees something he should hope for the best, even if it seems to be otherwise. He should hope for good from his Lord in all circumstances. This is how the believer is, for all his affairs are good, as the Prophet (peace and blessings of Allaah be upon him) said: “How wonderful is the affair of the believer, for his affairs are all good, and that does not apply for anyone except the believer. If something good happens to him he gives thanks, and that is good for him; if something bad happens to him he bears it with patience, and that is good for him.” Saheeh Muslim, 2999. Thus the believer is always in a state of contentment and peace of mind, putting his trust in Allaah and far removed from worries and distress which the Shaytaan, who loves to cause grief to the believers although he cannot do them any harm, tries to whisper into his heart. We ask Allaah to keep us and you safe and sound from all bad things. And Allaah knows best.
For more information, please see Fataawa al-Shaykh Ibn ‘Uthaymeen, 2/210.