ESP8266 goes to off

I’ve connected my PC to ESP8266 by wifi and also uploaded ESP8266WebServer->HelloServer on it, but sometimes goes to off like below picture.
Any Idea?

esp8266 needs more power than a nano can provide. You need an external voltage regulator, plus a cap between Vcc and gnd.

I tried by external power, but nothing happened...

I think problem is from program because when I create a server by AT Command , every thing is well.Any Idea?

Well, you didn't post your program so if you think its in your program i'll agree.