Opta resets when I put off it

every time I upload the code to my Arduino it opts through the Arduino IDE, once I disconnect the power it resets and I have to reload the code how can I make sure it remains in memory?