A system and method for stimulating a brain structure of a patient for treating a condition. A stimulating electrode is inserted into a brain structure of the patient. After inserting the stimulating electrode into a brain structure of the patient, the patient is prompted with a task. When the task is completed by the patient, the stimulating electrode is used to transmit a stimulating signal into the brain structure of the patient. In an alternative implementation, the patient's brain is monitored for the existence of a particular condition. When the condition is detected, the stimulating electrode is used to transmit a stimulating signal into the brain structure of the patient.