Inclusion Criteria:  Diagnosis of Major Depressive Episode or Depressive phase in Bipolar Disorder DSM-5 criteria. Moderate severity (>14 points in HDRS) 2 antidepressant failures or failure in enhancing strategies in the case of bipolar depression. No changes in treatment 3 week previous to the onset of treatment with TMS. Ability to sign informed consent.  Exclusion Criteria:  Any psychiatric comorbidity in axis I or II. Depressive episode with psychotic features. Dysthymia. Treatment with ECT in current depressive episode. Multiresistance (> 6 trials of therapeutic strategies). Suicide risk assessed previous to each session. Patients who missed 2 TMS sessions in a row Neurological comorbidities (epilepsy, Parkinson disease, neurocognitive disorders). Contraindications to TMS: pregnancy, metallic cervical or head implants.