Doing a medical study on yourself?
One of the cornerstones of research ethics worldwide is the Nuremberg code, which was formulated shortly after the Second World War and set off by the cruelties performed by the Nazi Doctors. The Declaration of Helsinki, which is currently widely used as the guiding principle of research ethics, was directly inspired by the Nuremberg code. 

Interestingly, article 5 in the Nuremberg code reads, and I quote:


  No experiment should be conducted where there is an a priori reason to believe that death or disabling injury will occur; except, perhaps, in those experiments where the experimental physicians also serve as subjects.


Basically what this tells you is that when you are a physician, you are not only ethically allowed to experiment on yourself, even when you can reasonably expect death may follow, you are even allowed to put others at that risk(!) Admittedly, it does not specifically talk about non-physicians. Nonetheless, with regard to your question, this Nuremberg article implies that self-experimentation is allowed, regardless the risks. 

Annas (2010), rightfully argues that, even where risks are minimal, prior ethics committee review of research should always be sought, if only to confirm the reasonableness of the risk assessment and regardless whether investigators are subjects. 

The problem then becomes whether self-experimentation (an experiment done by the investigator on himself or herself only) must be reviewed and approved by an ethics committee before it is conducted. Here Annas (2010) concludes that:


  [...] When an investigator proposes to experiment only on him or herself, that activity is not properly categorized as research at all, but as self indulgence (or, some may say, self abuse). Trivial interventions masquerading as research studies are primarily a source of amusement. 


Although I do not necessarily share the concluding accusations against self-experimentation, I do share her view that self-experimentation should not be regarded as proper scientific research, and therefore should not be subject to ethical review.  

Reference
Annas, BMJ (2010); 341: c7103